Implemented all project APIs, the main workflow, and partial features (#199)
* fix(*): 1. 合并代码, 2. 处理格式问题
* fix(*):1. 提升插件版本 2. 添加协议头
---------
Co-authored-by: jie <jie@apache.org>
diff --git a/README.zh-CN.md b/README.zh-CN.md
index cb9f70c..ccb82a8 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -94,4 +94,13 @@
2. 配置协议头工具 license-eye。
1. 检查命令:license-eye header check
2. 使用命令:license-eye header fix
- 3. 下载地址: https://skywalking.apache.org/downloads/
\ No newline at end of file
+ 3. 下载地址: https://skywalking.apache.org/downloads/
+
+
+### 提交代码前
+在项目根目录执行下面命令
+```
+license-eye -v info -c .licenserc.yaml header check
+./mvnw -B package -DskipTests --file pom.xml
+./mvnw -B test --file pom.xml
+```
\ No newline at end of file
diff --git a/eventmesh-dashboard-common/pom.xml b/eventmesh-dashboard-common/pom.xml
index 50890fe..806a289 100644
--- a/eventmesh-dashboard-common/pom.xml
+++ b/eventmesh-dashboard-common/pom.xml
@@ -30,20 +30,17 @@
<artifactId>eventmesh-dashboard-common</artifactId>
<properties>
- <java.version>1.8</java.version>
+ <java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
- <!-- TODO: common module should not contains spring framework, considering remove this dependency -->
- <!-- Spring Boot Starter -->
<dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- <scope>provided</scope>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>5.1.19.RELEASE</version>
</dependency>
-
<!-- Utility -->
<dependency>
<groupId>org.projectlombok</groupId>
@@ -55,6 +52,11 @@
<version>3.14.0</version>
</dependency>
<dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections4</artifactId>
+ <version>4.4</version>
+ </dependency>
+ <dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>2.0.51</version>
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/annotation/RemotingServiceMapper.java
similarity index 62%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/annotation/RemotingServiceMapper.java
index bf167b1..20a278b 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/annotation/RemotingServiceMapper.java
@@ -15,16 +15,23 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.common.annotation;
-@Data
-public class ChangeConfigEntity {
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
- private String configName;
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
- private String configValue;
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface RemotingServiceMapper {
- private Integer alreadyUpdate;
+
+ ClusterType clusterType();
+
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RuntimeRemotingService.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/annotation/RemotingServiceMethodMapper.java
similarity index 61%
copy from eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RuntimeRemotingService.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/annotation/RemotingServiceMethodMapper.java
index b673c27..fb619f6 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RuntimeRemotingService.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/annotation/RemotingServiceMethodMapper.java
@@ -15,15 +15,24 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.service.remoting;
-import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeRequest;
-import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeResult;
+package org.apache.eventmesh.dashboard.common.annotation;
+
+import org.apache.eventmesh.dashboard.common.model.remoting.RemotingActionType;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
- *
+ *
*/
-public interface RuntimeRemotingService {
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface RemotingServiceMethodMapper {
- GetRuntimeResult getRuntimeMetadata(GetRuntimeRequest request);
+ RemotingActionType[] value();
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/ApiPrefix.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/ApiPrefix.java
index df5f071..a25ee55 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/ApiPrefix.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/ApiPrefix.java
@@ -15,8 +15,10 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.constant;
+@Deprecated
public class ApiPrefix {
public static final String API_PREFIX = "/eventmesh-dashboard/";
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/ConfigConst.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/ConfigConst.java
deleted file mode 100644
index f13a40e..0000000
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/ConfigConst.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.common.constant;
-
-public class ConfigConst {
-
- // yml config
- public static final String ADMIN_PROPS_PREFIX = "eventmesh";
- public static final String META_TYPE_NACOS = "nacos";
- public static final String META_TYPE_ETCD = "etcd";
- public static final String STORE_TYPE_STANDALONE = "standalone";
- public static final String STORE_TYPE_ROCKETMQ = "rocketmq";
- public static final String STORE_TYPE_KAFKA = "kafka";
-
- // Open-API
- public static final String HTTP_PREFIX = "http://";
- public static final String HTTPS_PREFIX = "https://";
-
- // common
- /**
- * colon with space
- */
- public static final String COLON = ": ";
-
-}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/NacosConst.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/NacosConst.java
index b23a8d3..592a7e9 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/NacosConst.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/NacosConst.java
@@ -15,8 +15,10 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.constant;
+@Deprecated
public class NacosConst {
public static final String LOGIN_API = "/nacos/v1/auth/login";
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/StoreTypeConstant.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/StoreTypeConstant.java
index 665024a..455f121 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/StoreTypeConstant.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/StoreTypeConstant.java
@@ -15,8 +15,10 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.constant;
+@Deprecated
public class StoreTypeConstant {
public static final String STORE_TYPE_TYPE_UNKNOWN = "unknown";
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/health/HealthCheckTypeConstant.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/health/HealthCheckTypeConstant.java
index 5252899..31f095a 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/health/HealthCheckTypeConstant.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/health/HealthCheckTypeConstant.java
@@ -15,10 +15,12 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.constant.health;
import org.apache.eventmesh.dashboard.common.constant.StoreTypeConstant;
+@Deprecated
public class HealthCheckTypeConstant {
public static final String HEALTH_CHECK_TYPE_UNKNOWN = "unknown";
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/health/HealthConstant.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/health/HealthConstant.java
index dd72488..b00ea3d 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/health/HealthConstant.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/health/HealthConstant.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.constant.health;
public class HealthConstant {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/dto/Result.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/dto/Result.java
deleted file mode 100644
index e34fd92..0000000
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/dto/Result.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.common.dto;
-
-import org.apache.eventmesh.dashboard.common.enums.Status;
-import org.apache.eventmesh.dashboard.common.exception.BaseException;
-
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-/**
- * A RESTful response DTO.
- */
-
-@Data
-@Builder
-@NoArgsConstructor
-@AllArgsConstructor
-public class Result<T> {
-
- private T data;
-
- private Integer pages;
-
- private StatusMessage message;
-
- public Result(StatusMessage statusMessage) {
- this.message = statusMessage;
- }
-
- public Result(T data, Integer pages) {
- this.data = data;
- this.pages = pages;
- }
-
- /**
- * The request is valid and the result is wrapped in {@link Result}.
- */
- public static <T> Result<T> success() {
- return new Result<>(new StatusMessage(Status.SUCCESS));
- }
-
- public static <T> Result<T> success(Result<T> result) {
- result.setMessage(new StatusMessage(Status.SUCCESS));
- return result;
- }
-
- public static <T> Result<T> success(T data) {
- return new Result<>(data, null, new StatusMessage(Status.SUCCESS));
- }
-
- /**
- * The request is valid and the result is returned in {@link ResponseEntity}. Logic issues should use 422 Unprocessable Entity instead of 200 OK.
- */
- public static <T> ResponseEntity<Result<T>> ok() {
- return ResponseEntity.ok(new Result<>(new StatusMessage(Status.SUCCESS)));
- }
-
- public static <T> ResponseEntity<Result<T>> ok(Result<T> result) {
- result.setMessage(new StatusMessage(Status.SUCCESS));
- return ResponseEntity.ok(result);
- }
-
- /**
- * The request is invalid.
- */
- public static <T> ResponseEntity<Result<T>> badRequest(String message) {
- return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new Result<>(new StatusMessage(message)));
- }
-
- /**
- * The request is valid but cannot be processed due to business logic issues.
- */
- public static <T> ResponseEntity<Result<T>> unprocessable(String message) {
- return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(new Result<>(new StatusMessage(message)));
- }
-
- /**
- * Uncaught exception happened in EventMeshAdmin application.
- */
- public static <T> ResponseEntity<Result<T>> internalError(String message) {
- return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new Result<>(new StatusMessage(message)));
- }
-
- /**
- * Upstream service unavailable such as Meta.
- */
- public static <T> ResponseEntity<Result<T>> badGateway(String message) {
- return ResponseEntity.status(HttpStatus.BAD_GATEWAY).body(new Result<>(new StatusMessage(message)));
- }
-
- @Data
- public static class StatusMessage {
-
- private String status;
-
- private String category;
-
- private String desc;
-
- public StatusMessage(BaseException e) {
- this.status = e.getStatus().name();
- this.category = e.getStatus().getCategory().name();
- this.desc = e.getMessage();
- }
-
- /**
- * Only recommended for returning successful results, the stack trace cannot be displayed when returning unsuccessful results.
- */
- public StatusMessage(Status status) {
- this.status = status.name();
- this.category = status.getCategory().name();
- this.desc = status.getDesc(); // no stack trace
- }
-
- public StatusMessage(String desc) {
- this.desc = desc;
- }
- }
-}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/BusinessType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/BusinessType.java
index 41ca551..2b6bfaf 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/BusinessType.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/BusinessType.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.enums;
/**
@@ -23,6 +24,7 @@
* sinkConnector:可选值(rocketmq,spring,pravega,wechat,openfunction,file,knative,pulsar,lark,slack,rabbitmq,redis,mongodb,dingtalk)
* sourceConnector:可选值(rocketmq,spring,pravega,openfunction,jdbc,file,http,wecom,knative,pulsar,prometheus,rabbitmq,redis,mongodb)',
*/
+@Deprecated
public enum BusinessType {
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterFramework.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterFramework.java
new file mode 100644
index 0000000..0de7ccb
--- /dev/null
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterFramework.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.common.enums;
+
+import java.util.Objects;
+
+public enum ClusterFramework {
+
+ NOT,
+
+ INDEPENDENCE,
+
+ /**
+ * AP 架构,的 meta 有控制行为,需要逐一通知
+ */
+ AP,
+
+ CP,
+
+ CAP,
+
+ MAIN_SLAVE,
+
+ PAXOS,
+
+ RAFT,
+
+ ZK,
+ ;
+
+ public boolean isAP() {
+ return Objects.equals(this, AP);
+ }
+
+ public boolean isCP() {
+ return Objects.equals(this, CP);
+ }
+
+ public boolean isMainSlave() {
+ return Objects.equals(this, MAIN_SLAVE);
+ }
+
+ public boolean isCAP() {
+ return Objects.equals(this, ZK) || Objects.equals(this, RAFT) || Objects.equals(this, PAXOS) || Objects.equals(this, CAP);
+ }
+
+ public boolean isNot() {
+ return this == NOT;
+ }
+}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterOwnType.java
similarity index 75%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterOwnType.java
index bf167b1..b5deee5 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterOwnType.java
@@ -15,16 +15,24 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.common.enums;
-@Data
-public class ChangeConfigEntity {
+public enum ClusterOwnType {
- private String configName;
+ NOT,
- private String configValue;
+ INDEPENDENCE,
- private Integer alreadyUpdate;
+ SHARE,
+
+ OVERALL_SHARE,
+
+ ORGANIZATION_SHARE,
+
+ ;
+
+ public boolean isIndependence() {
+ return this == INDEPENDENCE;
+ }
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterSyncMetadataEnum.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterSyncMetadataEnum.java
new file mode 100644
index 0000000..7560b19
--- /dev/null
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterSyncMetadataEnum.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.common.enums;
+
+import org.apache.eventmesh.dashboard.common.model.ClusterSyncMetadata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+
+import lombok.Getter;
+
+/**
+ * 集群的特性
+ */
+public enum ClusterSyncMetadataEnum {
+
+
+ EVENTMESH_RUNTIME(
+ ClusterSyncMetadata.builder().clusterFramework(ClusterFramework.INDEPENDENCE).metadataTypeList(ClusterSyncMetadata.STORAGE).build()),
+
+ EVENTMESH_META_ETCD(ClusterSyncMetadata.builder().clusterFramework(ClusterFramework.RAFT).metadataTypeList(ClusterSyncMetadata.META).build()),
+
+ EVENTMESH_META_NACOS(ClusterSyncMetadata.builder().clusterFramework(ClusterFramework.AP).metadataTypeList(ClusterSyncMetadata.META).build()),
+
+ STORAGE_ROCKETMQ_NAMESERVER(
+ ClusterSyncMetadata.builder().clusterFramework(ClusterFramework.AP).metadataTypeList(ClusterSyncMetadata.META).build()),
+
+ STORAGE_ROCKETMQ_BROKER_MAIN_SLAVE(
+ ClusterSyncMetadata.builder().clusterFramework(ClusterFramework.MAIN_SLAVE).metadataTypeList(ClusterSyncMetadata.STORAGE).build()),
+
+ STORAGE_ROCKETMQ_BROKER_RFT(
+ ClusterSyncMetadata.builder().clusterFramework(ClusterFramework.RAFT).metadataTypeList(ClusterSyncMetadata.STORAGE).build()),
+
+ STORAGE_KAFKA_ZK(ClusterSyncMetadata.builder().clusterFramework(ClusterFramework.ZK).metadataTypeList(ClusterSyncMetadata.META).build()),
+
+ STORAGE_KAFKA_RAFT(ClusterSyncMetadata.builder().clusterFramework(ClusterFramework.RAFT).metadataTypeList(ClusterSyncMetadata.META).build()),
+
+ STORAGE_KAFKA_BROKER(
+ ClusterSyncMetadata.builder().clusterFramework(ClusterFramework.CAP)
+ .metadataTypeList(ListWrapper.build().add(ClusterSyncMetadata.STORAGE).add(ClusterSyncMetadata.AUTH).list)
+ .replicationDimension(ReplicationDimension.TOPIC).build()),
+
+ STORAGE_JVM_BROKER(
+ ClusterSyncMetadata.builder().clusterFramework(ClusterFramework.MAIN_SLAVE).metadataTypeList(ClusterSyncMetadata.TEST_ONE).build()),
+
+ STORAGE_JVM_CAP_BROKER(
+ ClusterSyncMetadata.builder().clusterFramework(ClusterFramework.CAP).metadataTypeList(ClusterSyncMetadata.STORAGE)
+ .replicationDimension(ReplicationDimension.TOPIC).build()),
+ ;
+
+ private static final Map<ClusterType, ClusterSyncMetadata> SYNC_METADATA_CONCURRENT_HASH_MAP = new ConcurrentHashMap<>();
+
+ public static ClusterSyncMetadata getClusterSyncMetadata(ClusterType clusterType) {
+ ClusterSyncMetadata clusterSyncMetadata = SYNC_METADATA_CONCURRENT_HASH_MAP.get(clusterType);
+ try {
+ if (Objects.isNull(clusterSyncMetadata)) {
+ ClusterSyncMetadataEnum clusterSyncMetadataEnum = ClusterSyncMetadataEnum.valueOf(clusterType.toString());
+ SYNC_METADATA_CONCURRENT_HASH_MAP.put(clusterType, clusterSyncMetadataEnum.getClusterSyncMetadata());
+ clusterSyncMetadata = clusterSyncMetadataEnum.getClusterSyncMetadata();
+ }
+ } catch (Exception e) {
+ clusterSyncMetadata = ClusterSyncMetadata.EMPTY_OBJECT;
+ SYNC_METADATA_CONCURRENT_HASH_MAP.put(clusterType, clusterSyncMetadata);
+ }
+ return clusterSyncMetadata;
+ }
+
+ public static ClusterFramework getClusterFramework(ClusterType clusterType) {
+ return getClusterSyncMetadata(clusterType).getClusterFramework();
+ }
+
+ static class ListWrapper {
+
+ static ListWrapper build() {
+ return new ListWrapper();
+ }
+
+ private List<MetadataType> list = new ArrayList<>();
+
+ ListWrapper add(List<MetadataType> list) {
+ list.addAll(list);
+ return this;
+ }
+ }
+
+ @Getter
+ private ClusterSyncMetadata clusterSyncMetadata;
+
+ ClusterSyncMetadataEnum(ClusterSyncMetadata clusterSyncMetadata) {
+ this.clusterSyncMetadata = clusterSyncMetadata;
+ }
+
+
+}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterTrusteeshipType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterTrusteeshipType.java
index 44b852d..66daa53 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterTrusteeshipType.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterTrusteeshipType.java
@@ -15,16 +15,123 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.enums;
+import java.util.List;
+
+import lombok.Getter;
+
+/**
+ *
+ */
+@Getter
public enum ClusterTrusteeshipType {
- FIRE_AND_FORGET_TRUSTEESHIP,
- TRUSTEESHIP,
+ NOT("", List.of(ClusterType.CLUSTER, ClusterType.META, ClusterType.RUNTIME, ClusterType.META_AND_RUNTIME)),
- REVERSE,
+ /**
+ * 全托管 存储不好做全托管 RocketMQ, kafhka,都适合
+ **/
+ SELF("自维护", List.of(ClusterType.CLUSTER, ClusterType.META, ClusterType.RUNTIME, ClusterType.META_AND_RUNTIME)),
- NO_TRUSTEESHIP;
+ /**
+ *
+ */
+ TRUSTEESHIP("托管", List.of(ClusterType.CLUSTER, ClusterType.META, ClusterType.RUNTIME, ClusterType.META_AND_RUNTIME)),
+ /**
+ * 托管,从 meta 获得 runtime 提供了 meta地址,从 meta 获得 runtime 主要用于已经存在的集群 支持: eventmesh cluster RocketMQ cluster
+ **/
+ TRUSTEESHIP_FIND("托管且从 meta 获得 runtime,同时同步配置", List.of(ClusterType.META, ClusterType.META_AND_RUNTIME)),
+
+ /**
+ * 继承 TRUSTEESHIP_FIND 能力 同时以 集群为主
+ **/
+ TRUSTEESHIP_FIND_REVERSE("以集群为主", List.of(ClusterType.CLUSTER, ClusterType.META, ClusterType.RUNTIME, ClusterType.META_AND_RUNTIME)),
+
+ // 不托管
+ NO_TRUSTEESHIP("不托管", List.of(ClusterType.CLUSTER, ClusterType.META, ClusterType.RUNTIME, ClusterType.META_AND_RUNTIME));
+
+ private List<ClusterType> clusterTypeList;
+
+ private final String type;
+
+ private String name;
+
+ private FirstToWhom firstToWhom;
+
+ public enum FirstToWhom {
+
+ NOT,
+
+ DASHBOARD,
+
+ RUNTIME,
+
+ /**
+ * 等待开始
+ */
+ WAIT_START,
+
+ /**
+ * 同步完成
+ */
+ COMPLETE,
+
+ /**
+ * 同步中
+ */
+ UNDER_WAY,
+
+ FAIL,
+
+ ;
+ }
+
+ /**
+ * 注册 meta, 表示需要从 meta 读取 runtime。 如果 FirstToWhom.DASHBOARD , 那么读取的 runtime 都标记为 DASHBOARD 如果 不托管 , 那么读取的 runtime 标记如 托管状态
+ * <p>
+ * 读取 runtime 的会后, 如何是 DASHBOARD , 使用 database 同步 如果是 RUNTIME , 使用 runtime 同步 执行完之后,判断 同步状态, 如果是 以 runtime 为主,使用 runtime 同步, 以 runtime 的不允许修改
+ * 如果是 以 database 为主,使用 database 同步 分为第一次同步,与永久同步
+ */
+ @Deprecated
+ public enum TrusteeshipArrangeType {
+
+ /**
+ * 同时注册了 meta 与 runtime
+ */
+ META_AND_RUNTIME,
+
+ /**
+ * 只注册 meta
+ */
+ META,
+
+ /**
+ * 只注册 runtime
+ */
+ RUNTIME,
+
+ /**
+ * 自维护
+ */
+ SELF,
+
+
+ }
+
+ ClusterTrusteeshipType(String type, List<ClusterType> clusterTypeList) {
+ this.type = type;
+ }
+
+
+ public boolean isSelf() {
+ return this == ClusterTrusteeshipType.SELF || this == ClusterTrusteeshipType.TRUSTEESHIP;
+ }
+
+ public boolean isReverse() {
+ return this == ClusterTrusteeshipType.TRUSTEESHIP_FIND || this == ClusterTrusteeshipType.TRUSTEESHIP_FIND_REVERSE;
+ }
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterType.java
index 41d918f..f8b2451 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterType.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterType.java
@@ -15,8 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.enums;
+import org.apache.commons.lang3.reflect.FieldUtils;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -25,20 +28,55 @@
public enum ClusterType {
+ DEFINITION(0),
+
DEFAULT(1),
+
EVENTMESH(20),
- STORAGE(21),
-
- DEFAULT_TYPE_NAME(1),
-
CLUSTER(1),
META(2),
RUNTIME(3),
+ META_AND_RUNTIME(4),
+
+ BROKER(4),
+
+ COPY_BROKER(5),
+
+ ZK_BROKER(6),
+
+ RFT_BROKER(6),
+
+ STORAGE(21),
+
+ RUNTIME_CLUSTER(21),
+
+ META_CLUSTER(22),
+
+ STORAGE_CLUSTER(22),
+
+ DEFAULT_TYPE_NAME(1),
+
+
+ CLUSTER_TYPE_META(1),
+
+ CLUSTER_TYPE_RUNTIME(1),
+
+ CLUSTER_TYPE_STORAGE(1),
+
+
+ NODE_BY_COPY_IN_TYPE(2),
+
+ NODE_BY_COPY_IN_TYPE_NOT_HAVE(2),
+
+ NODE_BY_COPY_IN_TYPE_MAIN(2),
+
+ NODE_BY_COPY_IN_TYPE_SLAVE(3),
+
RUNTIME_EVENT_RUNTIME(ClusterType.META.code + 1),
@@ -48,10 +86,13 @@
META_TYPE_NACOS(ClusterType.META.code + 2),
+ META_TYPE_ZK(ClusterType.META.code + 3),
+
META_TYPE_ROCKETMQ_NAMESERVER(ClusterType.META.code + 31),
+ KUBERNETES_RUNTIME(DEFAULT, DEFAULT, CLUSTER, RUNTIME, RemotingType.KUBERNETES),
- EVENTMESH_CLUSTER(EVENTMESH, EVENTMESH, CLUSTER, DEFAULT, RemotingType.EVENT_MESH_RUNTIME),
+ EVENTMESH_CLUSTER(EVENTMESH, EVENTMESH, CLUSTER, DEFINITION, RemotingType.EVENT_MESH_RUNTIME),
EVENTMESH_RUNTIME(EVENTMESH, EVENTMESH, RUNTIME, DEFAULT, RemotingType.EVENT_MESH_RUNTIME),
@@ -61,27 +102,130 @@
STORAGE_ROCKETMQ(ClusterType.STORAGE.code + 1),
- STORAGE_ROCKETMQ_CLUSTER(STORAGE, STORAGE_ROCKETMQ, CLUSTER, DEFAULT, RemotingType.ROCKETMQ),
+ STORAGE_ROCKETMQ_CLUSTER(STORAGE, STORAGE_ROCKETMQ, CLUSTER, DEFINITION, RemotingType.ROCKETMQ),
STORAGE_ROCKETMQ_NAMESERVER(STORAGE, STORAGE_ROCKETMQ, META, DEFAULT, RemotingType.ROCKETMQ_NAMESERVER),
- STORAGE_ROCKETMQ_BROKER(STORAGE, STORAGE_ROCKETMQ, RUNTIME, DEFAULT, RemotingType.ROCKETMQ);
+ STORAGE_ROCKETMQ_BROKER(STORAGE, STORAGE_ROCKETMQ, RUNTIME, DEFINITION, RemotingType.ROCKETMQ),
+
+ STORAGE_ROCKETMQ_BROKER_MAIN_SLAVE(STORAGE, STORAGE_ROCKETMQ_BROKER, RUNTIME, DEFAULT, RemotingType.ROCKETMQ),
+
+ STORAGE_ROCKETMQ_BROKER_RAFT(STORAGE, STORAGE_ROCKETMQ_BROKER, RUNTIME, DEFAULT, RemotingType.ROCKETMQ),
- public static final List<ClusterType> STORAGE_TYPES = getStorage();
+ STORAGE_KAFKA(STORAGE_ROCKETMQ.code + 1),
+
+ STORAGE_KAFKA_CLUSTER(STORAGE, STORAGE_KAFKA, CLUSTER, DEFINITION, RemotingType.KAFKA),
+
+ STORAGE_KAFKA_ZK(STORAGE, STORAGE_KAFKA, META, META_TYPE_ZK, RemotingType.ZK),
+
+ STORAGE_KAFKA_RAFT(STORAGE, STORAGE_KAFKA, META_AND_RUNTIME, STORAGE_KAFKA, RemotingType.KAFKA),
+
+ STORAGE_KAFKA_BROKER(STORAGE, STORAGE_KAFKA, RUNTIME, DEFAULT, RemotingType.KAFKA),
+
+
+ STORAGE_REDIS(STORAGE_KAFKA.code + 1),
+
+ STORAGE_REDIS_CLUSTER(STORAGE, STORAGE_REDIS, CLUSTER, DEFINITION, RemotingType.REDIS),
+
+ STORAGE_REDIS_BROKER(STORAGE, STORAGE_REDIS, RUNTIME, DEFAULT, RemotingType.REDIS),
+
+ STORAGE_JVM(STORAGE_REDIS.code + 1),
+
+ STORAGE_JVM_CLUSTER(STORAGE, STORAGE_JVM, CLUSTER, DEFINITION, RemotingType.JVM),
+
+ STORAGE_JVM_META(STORAGE, STORAGE_JVM, META, DEFAULT, RemotingType.JVM),
+
+ STORAGE_JVM_BROKER(STORAGE, STORAGE_JVM, RUNTIME, DEFAULT, RemotingType.JVM),
+
+ STORAGE_JVM_CAP(STORAGE_REDIS.code + 1),
+
+ STORAGE_JVM_CAP_CLUSTER(STORAGE, STORAGE_JVM_CAP, CLUSTER, DEFINITION, RemotingType.JVM),
+
+ STORAGE_JVM_CAP_BROKER(STORAGE, STORAGE_JVM_CAP, META_AND_RUNTIME, DEFAULT, RemotingType.JVM),
+ ;
+
+
+ private static final List<ClusterType> STORAGE_MAIN_CLUSTER_TYPE_LIST = new ArrayList<>();
+
+ private static final List<ClusterType> STORAGE_META_CLUSTER_TYPE_LIST = new ArrayList<>();
+
+ private static final List<ClusterType> STORAGE_RUNTIME_CLUSTER_TYPE_LIST = new ArrayList<>();
+
+ private static final List<ClusterType> STORAGE_META_RUNTIME_TYPE_LIST = new ArrayList<>();
+
+ static {
+ for (ClusterType clusterType : ClusterType.values()) {
+ if (clusterType.isStorageCluster()) {
+ STORAGE_MAIN_CLUSTER_TYPE_LIST.add(clusterType);
+ }
+ if (clusterType.isStorageMeta()) {
+ STORAGE_META_CLUSTER_TYPE_LIST.add(clusterType);
+ }
+ if (clusterType.isStorageRuntime()) {
+ STORAGE_RUNTIME_CLUSTER_TYPE_LIST.add(clusterType);
+ }
+ if (clusterType.isMetaAndRuntime()) {
+ STORAGE_META_RUNTIME_TYPE_LIST.add(clusterType);
+ }
+ }
+ }
+
+ public static List<ClusterType> getStorageCluster() {
+ return STORAGE_MAIN_CLUSTER_TYPE_LIST;
+ }
+
+ public static List<ClusterType> getStorageMetaCluster() {
+ return STORAGE_META_CLUSTER_TYPE_LIST;
+ }
+
+ public static List<ClusterType> getStorageRuntimeCluster() {
+ return STORAGE_RUNTIME_CLUSTER_TYPE_LIST;
+ }
+
+ public static List<ClusterType> getStorageMetaRuntimeCluster() {
+ return STORAGE_META_RUNTIME_TYPE_LIST;
+ }
+
+ /**
+ * 集群在 eventmesh 集群内的 节点(集群)类型。meta集群,存储集群,runtime集群
+ */
@Getter
private ClusterType eventmeshNodeType;
+ /**
+ * 具体类型集群
+ */
@Getter
private ClusterType assemblyName;
+
+ /**
+ * 这个节点在 具体集群内是什么节点
+ */
@Getter
private ClusterType assemblyNodeType;
+
+ /**
+ * 厂商是什么类型。比如注册中心。注册中心有 etc,nacos
+ */
@Getter
private ClusterType assemblyBusiness;
+
+ /**
+ * 远程协议类型
+ */
@Getter
private RemotingType remotingType;
+
@Getter
private int code;
+
+ private List<ClusterType> mainClusterType;
+
+ private List<ClusterType> metaClusterType;
+
+ private List<ClusterType> runtimeClusterType;
+
ClusterType(int code) {
this.code = code;
}
@@ -96,29 +240,137 @@
this.remotingType = remotingType;
}
- private static List<ClusterType> getStorage() {
- List<ClusterType> list = new ArrayList<>();
- for (ClusterType clusterType : ClusterType.values()) {
- if (Objects.equals(clusterType.eventmeshNodeType, ClusterType.STORAGE) && Objects.equals(clusterType.assemblyNodeType,
- ClusterType.CLUSTER)) {
- list.add(clusterType);
- }
+
+ /**
+ * 半托管状态需要 如要从
+ */
+ public boolean isEventMethMeta() {
+ return this.eventmeshNodeType.equals(EVENTMESH) && this.assemblyNodeType.equals(META);
+ }
+
+
+ public boolean isEventMethRuntime() {
+ return this == EVENTMESH_RUNTIME;
+ }
+
+ public boolean isMeta() {
+ if (Objects.isNull(this.assemblyNodeType)) {
+ return false;
}
- return list;
+ return this.assemblyNodeType.equals(META);
+ }
+
+ public boolean isMetaAndRuntime() {
+ if (Objects.isNull(this.eventmeshNodeType)) {
+ return false;
+ }
+ return this.eventmeshNodeType.equals(META_AND_RUNTIME);
+ }
+
+ public boolean isRuntime() {
+ if (Objects.isNull(this.assemblyNodeType)) {
+ return false;
+ }
+ return this.assemblyNodeType.equals(RUNTIME) || this.eventmeshNodeType.equals(META_AND_RUNTIME);
+ }
+
+ public boolean isStorage() {
+ if (Objects.isNull(this.eventmeshNodeType)) {
+ return false;
+ }
+ return this.eventmeshNodeType.equals(STORAGE);
}
public boolean isMainCluster() {
return Objects.equals(this, ClusterType.EVENTMESH_CLUSTER) || Objects.equals(this.assemblyNodeType, ClusterType.CLUSTER);
}
- public boolean isFirstLayer() {
- return Objects.equals(this, ClusterType.EVENTMESH_META_NACOS) || Objects.equals(this, ClusterType.EVENTMESH_META_ETCD) || Objects.equals(this,
- ClusterType.EVENTMESH_RUNTIME) || Objects.equals(this.getAssemblyNodeType(), ClusterType.CLUSTER);
+
+ public boolean isHealthTopic() {
+ return Objects.equals(this, EVENTMESH_RUNTIME) || this.isStorageRuntime();
}
- public boolean isSecondFloor() {
- return Objects.equals(eventmeshNodeType, ClusterType.STORAGE) ? (Objects.equals(assemblyNodeType, ClusterType.RUNTIME) || Objects.equals(
- assemblyNodeType, ClusterType.META)) : false;
+ public boolean isStorageCluster() {
+ return Objects.equals(this.eventmeshNodeType, STORAGE) && Objects.equals(this.assemblyNodeType, CLUSTER);
}
+ public boolean isStorageRuntime() {
+ return Objects.equals(this.eventmeshNodeType, STORAGE) && Objects.equals(this.assemblyNodeType, RUNTIME);
+ }
+
+ public boolean isStorageMeta() {
+ return Objects.equals(this.eventmeshNodeType, STORAGE) && Objects.equals(this.assemblyNodeType, META);
+ }
+
+ public boolean isMain() {
+ return Objects.equals(this, NODE_BY_COPY_IN_TYPE_MAIN);
+ }
+
+ public boolean isSlave() {
+ return Objects.equals(this, NODE_BY_COPY_IN_TYPE_SLAVE);
+ }
+
+ public boolean isDefinition() {
+ return Objects.equals(this.assemblyBusiness, DEFINITION);
+ }
+
+ public List<ClusterType> getMetaClusterInStorage() {
+ List<ClusterType> list = new ArrayList<>();
+ for (ClusterType allClusterType : ClusterType.values()) {
+ if (Objects.equals(allClusterType.eventmeshNodeType, STORAGE) && Objects.equals(allClusterType.assemblyNodeType, META)) {
+ list.add(allClusterType);
+ }
+ }
+ return list;
+ }
+
+ public List<ClusterType> getMainClusterType() {
+ return this.getThisClusterType(CLUSTER, this.mainClusterType, "mainClusterType");
+
+ }
+
+ public List<ClusterType> getMetaClusterType() {
+ return this.getThisClusterType(META, this.metaClusterType, "metaClusterType");
+ }
+
+ public List<ClusterType> getRuntimeClusterType() {
+ return this.getThisClusterType(RUNTIME, this.runtimeClusterType, "runtimeClusterType");
+ }
+
+
+ private List<ClusterType> getThisClusterType(ClusterType assemblyNodeType, List<ClusterType> clusterTypeList, String fieldName) {
+ if (Objects.equals(assemblyNodeType, this.assemblyNodeType) && !this.isDefinition()) {
+ return null;
+ }
+ if (Objects.nonNull(clusterTypeList)) {
+ return clusterTypeList;
+ }
+ clusterTypeList = new ArrayList<>();
+ synchronized (this) {
+ for (ClusterType allClusterType : ClusterType.values()) {
+ if (this == allClusterType) {
+ continue;
+ }
+ if (Objects.equals(this.eventmeshNodeType, allClusterType.eventmeshNodeType)
+ && (Objects.equals(this.assemblyName, allClusterType.assemblyName) || Objects.equals(this, allClusterType.assemblyName))
+ && Objects.equals(assemblyNodeType, allClusterType.assemblyNodeType)) {
+ clusterTypeList.add(allClusterType);
+ }
+ }
+ }
+ if (clusterTypeList.isEmpty()) {
+ // TODO
+ // String message = String.format("cluster %s assemblyNodeType is %s fieldName is %s ", this, assemblyNodeType, fieldName);
+ // throw new RuntimeException(message);
+ }
+
+ try {
+ FieldUtils.writeField(this, fieldName, clusterTypeList, true);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ return clusterTypeList;
+ }
+
+
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/DeployStatusType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/DeployStatusType.java
new file mode 100644
index 0000000..2e8556b
--- /dev/null
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/DeployStatusType.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.common.enums;
+
+public enum DeployStatusType {
+
+
+ RESOURCE_APPLY,
+
+ RESOURCE_APPLY_FAILED,
+
+ CREATE_WAIT,
+
+ CREATE_FULL_WAIT,
+
+ CREATE_WAIT_TIMEOUT,
+
+ CREATE_CAP_UPDATE_WAIT,
+
+ CREATE_CAP_UPDATE_WAIT_TIMEOUT,
+
+ CREATE_ING,
+
+ CREATE_FULL_ING,
+
+ CREATE_FAIL,
+
+ CREATE_FULL_SUCCESS,
+
+ CREATE_FULL_FAIL,
+
+ CREATE_CAP_UPDATE_FAIL,
+
+ CREATE_CAP_UPDATE_ING,
+
+ CREATE_SUCCESS,
+
+ CREATE_CAP_UPDATE_SUCCESS,
+
+ UPDATE_WAIT,
+
+ UPDATE_ING,
+
+ UPDATE_SUCCESS,
+
+ UPDATE_FAIL,
+
+ UPDATE_FULL_WAIT,
+
+ UPDATE_FULL_ING,
+
+ UPDATE_FULL_SUCCESS,
+
+ UPDATE_FULL_FAIL,
+
+
+ PAUSE_WAIT,
+
+ PAUSE_ING,
+
+ PAUSE_FULL_ING,
+
+ PAUSE_FULL_WAIT,
+
+ PAUSE_SUCCESS,
+
+ PAUSE_FAIL,
+
+ PAUSE_FULL_SUCCESS,
+
+ PAUSE_FULL_FAIL,
+
+ RESET_WAIT,
+
+ RESET_ING,
+
+ RESET_FAIL,
+
+ RESET_SUCCESS,
+
+ UNINSTALL,
+
+ UNINSTALL_FAIL,
+
+ UNINSTALL_FAILED,
+
+ UNINSTALL_ING,
+
+ UNINSTALL_SUCCESS,
+ ;
+}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/KubernetesPodStatus.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/KubernetesPodStatus.java
index 1e6d8a0..1a08cec 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/KubernetesPodStatus.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/KubernetesPodStatus.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.enums;
import lombok.AllArgsConstructor;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/MetadataType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/MetadataType.java
new file mode 100644
index 0000000..42ca89d
--- /dev/null
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/MetadataType.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.common.enums;
+
+import org.apache.eventmesh.dashboard.common.model.metadata.AclMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.ClientMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.ConnectionMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.ConsumeOffsetMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.GroupMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.TopicOffsetMetadata;
+
+import lombok.Getter;
+
+
+@Getter
+public enum MetadataType {
+
+ CLUSTER(ClusterMetadata.class),
+
+ CONFIG(ConfigMetadata.class),
+
+ RUNTIME(RuntimeMetadata.class),
+
+ TOPIC(TopicMetadata.class),
+
+ GROUP(GroupMetadata.class),
+
+ TOPIC_OFFSET(TopicOffsetMetadata.class, true),
+
+ CONSUME_OFFSET(ConsumeOffsetMetadata.class, true),
+
+ SUBSCRIBER(GroupMetadata.class),
+
+ CLIENT(ClientMetadata.class, true),
+
+ NET_CONNECT(ConnectionMetadata.class, true),
+
+ USER(ConnectionMetadata.class),
+
+ ACL(AclMetadata.class);
+
+ private Class<?> metadataClass;
+
+ private boolean readOnly = false;
+
+ MetadataType(Class<?> metadataClass) {
+ this.metadataClass = metadataClass;
+ }
+
+ MetadataType(Class<?> metadataClass, boolean readOnly) {
+ this.metadataClass = metadataClass;
+ this.readOnly = readOnly;
+ }
+}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/OperationRange.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/OperationRange.java
new file mode 100644
index 0000000..bfe248d
--- /dev/null
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/OperationRange.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.common.enums;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * 比如: 通过 topic id 修改配置。 Kafka 只需要 操作 cluster 就可以了。 RocketMQ 需要操作 broker集群,复制集群,
+ */
+public class OperationRange {
+
+ private static final OperationRange operationRange = new OperationRange();
+
+ private static Map<ClusterType, List<OperationRangeType>> operationRangeListHashMap = new HashMap<>();
+
+ public static OperationRange getInstance() {
+ return operationRange;
+ }
+
+ private OperationRange() {
+
+ }
+
+
+ private void setOperationRange(ClusterType clusterType, OperationRangeType operationRangeType) {
+ operationRangeListHashMap.computeIfAbsent(clusterType, k -> new ArrayList<>()).add(operationRangeType);
+ }
+
+ public List<OperationRangeType> getOperationRangeTypeList(ClusterType clusterType) {
+ return operationRangeListHashMap.get(clusterType);
+ }
+
+ /**
+ * 依据范围查询数据
+ * 集群, runtime , topic ,SUBSCRIBER , SUBSCRIBER_QUEUE
+ */
+ public enum OperationRangeType {
+
+ ALL(null),
+
+ CLUSTER(null),
+
+ ALL_RUNTIME(null),
+
+ ONCE_CLUSTER(null),
+
+ RANGE_CLUSTER_CAP(CLUSTER),
+
+ MAIN_SLAVE(CLUSTER),
+
+ RANGE_RUNTIME(MAIN_SLAVE),
+
+
+ GROUP(RANGE_RUNTIME),
+
+ TOPIC(RANGE_RUNTIME),
+
+ SUBSCRIBER(RANGE_RUNTIME),
+
+ SUBSCRIBER_QUEUE(RANGE_RUNTIME),
+
+ QUEUE(TOPIC),
+
+ ;
+
+ private Map<ClusterType, List<OperationRangeType>> operationRangeListHashMap;
+
+ private int index;
+
+ OperationRangeType() {
+
+ }
+
+ OperationRangeType(OperationRangeType operationRangeType) {
+ this.index = Objects.isNull(operationRangeType) ? 0 : operationRangeType.index + 1;
+ }
+ }
+
+
+}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/RecordStatus.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/RecordStatus.java
index 5ed81c7..07d026e 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/RecordStatus.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/RecordStatus.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.enums;
import lombok.AllArgsConstructor;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/RemotingType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/RemotingType.java
index aa0ad0e..226e14d 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/RemotingType.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/RemotingType.java
@@ -15,16 +15,24 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.enums;
+import java.util.HashSet;
+import java.util.Set;
+
public enum RemotingType {
NOT,
+ JVM,
+
META,
STORAGE,
+ REDIS,
+
EVENT_MESH_RUNTIME,
EVENT_MESH_NACOS,
@@ -32,5 +40,29 @@
EVENT_MESH_ETCD,
ROCKETMQ,
- ROCKETMQ_NAMESERVER;
+
+ ROCKETMQ_NAMESERVER,
+
+ KAFKA,
+
+
+ ZK,
+
+ KUBERNETES,
+
+ ;
+
+ private Set<ClusterType> supportClusterType = new HashSet<>();
+
+ RemotingType() {
+ }
+
+ RemotingType(ClusterType... clusterType) {
+ for (ClusterType c : clusterType) {
+ this.supportClusterType.add(c);
+ }
+
+ }
+
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ReplicationDimension.java
similarity index 76%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ReplicationDimension.java
index bf167b1..67d11af 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ReplicationDimension.java
@@ -15,16 +15,24 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.common.enums;
-@Data
-public class ChangeConfigEntity {
+public enum ReplicationDimension {
- private String configName;
+ NOT,
- private String configValue;
- private Integer alreadyUpdate;
+ /**
+ * 节点复制 复制,
+ */
+ FULL_REPLICATION,
+
+ TOPIC,
+
+ /**
+ * 部分复制
+ */
+ SECTION_REPLICATION,
+ ;
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshException.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ReplicationType.java
similarity index 66%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshException.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ReplicationType.java
index 444e530..8b29f9e 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshException.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ReplicationType.java
@@ -15,17 +15,35 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.exception;
-/**
- * EventMesh Runtime side exception
- */
+package org.apache.eventmesh.dashboard.common.enums;
-public class EventMeshException extends BaseException {
+public enum ReplicationType {
- private static final long serialVersionUID = 5648256502005456586L;
+ NOT,
- public EventMeshException(String message) {
- super(message);
+ MAIN,
+
+ SLAVE,
+
+ MAIN_SLAVE,
+ ;
+
+
+ public boolean isNot() {
+ return this == NOT;
+ }
+
+ public boolean isMain() {
+ return this == MAIN;
+ }
+
+ public boolean isSlave() {
+ return this == SLAVE;
+ }
+
+
+ public boolean isMainSlave() {
+ return this == MAIN_SLAVE;
}
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ResetOffsetMode.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ResetOffsetMode.java
index 519767a..822e260 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ResetOffsetMode.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ResetOffsetMode.java
@@ -15,15 +15,37 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.enums;
public enum ResetOffsetMode {
+ /**
+ * 支持维度如下:
+ * <p>
+ * event mesh cluster 。
+ * RockerMQ 查出 所有的 存储集群,然后存储存储集群里面,所有子集群,以及子集群里面所有的 broker ,对每个broker 进行一次请求奥做。
+ * Kkakfa 查出 所有的 存储集群,然后存储存储集群里面。 只需要对 cluster 进行一次请求操作
+ * <p>
+ * storage cluster
+ * <p>
+ * storage definition cluster
+ * <p>
+ * storage runtime cluster
+ *
+ *
+ */
CONSUME_FROM_LAST_OFFSET,
CONSUME_FROM_FIRST_OFFSET,
+
CONSUME_FROM_TIMESTAMP,
+ /**
+ * 只有此模式支持 Queue 维度
+ * <p>
+ * 只有这个模式,传递Queue id
+ */
CONSUME_FROM_DESIGNATED_OFFSET
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/Status.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/Status.java
deleted file mode 100644
index 4a6036f..0000000
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/Status.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.common.enums;
-
-import static org.apache.eventmesh.dashboard.common.constant.ConfigConst.COLON;
-
-import org.springframework.http.HttpStatus;
-
-import lombok.Getter;
-
-/**
- * An error enumeration class that conforms to the RESTful specifications and custom error reporting requirements.
- * <ul>
- * <li>The 'code' field is used to return the HTTP status code using {@link HttpStatus}.</li>
- * <li>The 'category' field represents the major category of the error.</li>
- * <li>the 'desc' field represents the detailed subcategory and information of the error.</li>
- * </ul>
- */
-
-@Getter
-public enum Status {
-
- SUCCESS(HttpStatus.OK, Category.SUCCESS, "Operation success."),
-
- NACOS_SDK_CONFIG_ERR(HttpStatus.INTERNAL_SERVER_ERROR, Category.SDK_CONFIG_ERR,
- "Failed to create Nacos ConfigService. Please check EventMeshAdmin application configuration."),
-
- NACOS_GET_CONFIGS_ERR(HttpStatus.BAD_GATEWAY, Category.META_COM_ERR, "Failed to retrieve Nacos config(s)."),
-
- NACOS_EMPTY_RESP_ERR(HttpStatus.BAD_GATEWAY, Category.META_COM_ERR, "No result returned by Nacos. Please check Nacos."),
-
- NACOS_LOGIN_ERR(HttpStatus.UNAUTHORIZED, Category.META_COM_ERR, "Nacos login failed."),
-
- NACOS_LOGIN_EMPTY_RESP_ERR(HttpStatus.BAD_GATEWAY, Category.META_COM_ERR, "Nacos didn't return accessToken. Please check Nacos status."),
- ;
-
- // error code
- private final HttpStatus code;
-
- // error type
- private final Category category;
-
- // error message
- private final String desc;
-
- Status(HttpStatus code, Category category, String desc) {
- this.code = code;
- this.category = category;
- this.desc = desc;
- }
-
- @Override
- public String toString() {
- return name() + " of " + category + COLON + desc;
- }
-
- @Getter
- public enum Category {
-
- SUCCESS("Successfully received and processed"),
-
- SDK_CONFIG_ERR("Meta SDK config error"),
-
- META_COM_ERR("Network communication to Meta error"),
- ;
-
- /**
- * Helpful for understanding and not used for now
- */
- private final String desc;
-
- Category(String desc) {
- this.desc = desc;
- }
- }
-}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/StoreType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/StoreType.java
index ed15a86..50ea191 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/StoreType.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/StoreType.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.enums;
import static org.apache.eventmesh.dashboard.common.constant.StoreTypeConstant.STORE_TYPE_KAFKA;
@@ -27,6 +28,7 @@
import lombok.AllArgsConstructor;
import lombok.Getter;
+@Deprecated
@AllArgsConstructor
public enum StoreType {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/SyncErrorType.java
similarity index 84%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/SyncErrorType.java
index 82e6c7f..c66626b 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/SyncErrorType.java
@@ -15,12 +15,16 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.common.enums;
-@Data
-public class GlobalRequest {
+public enum SyncErrorType {
- private Long clusterId;
+ NOT,
+
+ METADATA_SYNC_ERROR,
+
+ CHECK_SYNC_ERROR,
+ ;
+
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/health/HealthCheckStatus.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/health/HealthCheckStatus.java
index 7542376..34a5891 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/health/HealthCheckStatus.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/health/HealthCheckStatus.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.enums.health;
import lombok.AllArgsConstructor;
@@ -23,12 +24,25 @@
@Getter
@AllArgsConstructor
public enum HealthCheckStatus {
- FAILED(0, "failed"),
- PASSED(1, "passed"),
- CHECKING(2, "checking"),
- TIMEOUT(3, "timeout"),
- NOT_CONNECTED(4, "not connected");
- private final Integer number;
+ SUCCESS(1L, "success"),
+
+ FAILED(0L, "failed"),
+
+ PASSED(1L, "passed"),
+
+ CHECKING(2L, "checking"),
+
+ TIMEOUT(3L, "timeout"),
+
+ NOT_CONNECTED(4L, "not connected"),
+
+ USER_AUTHENTICATION_FAIL(5L, "user authentication fail"),
+
+ REQUEST_AUTHENTICATION_FAIL(6L, "request authentication fail"),
+ ;
+
+ private final Long number;
+
private final String name;
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/health/HealthCheckType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/health/HealthCheckTypeEnum.java
similarity index 86%
rename from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/health/HealthCheckType.java
rename to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/health/HealthCheckTypeEnum.java
index 54c061e..457e65b 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/health/HealthCheckType.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/health/HealthCheckTypeEnum.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.enums.health;
import org.apache.eventmesh.dashboard.common.constant.health.HealthCheckTypeConstant;
@@ -23,14 +24,23 @@
import lombok.Getter;
@AllArgsConstructor
-public enum HealthCheckType {
+public enum HealthCheckTypeEnum {
UNKNOWN(0, HealthCheckTypeConstant.HEALTH_CHECK_TYPE_UNKNOWN),
+ PROCESS(0, "检查进场"),
+
+ PORT(1, "端口"),
+
+ PING(2, "ping"),
+
+
+ TOPIC(3, HealthCheckTypeConstant.HEALTH_CHECK_TYPE_TOPIC),
+
+
CLUSTER(1, HealthCheckTypeConstant.HEALTH_CHECK_TYPE_CLUSTER),
RUNTIME(2, HealthCheckTypeConstant.HEALTH_CHECK_TYPE_RUNTIME),
- TOPIC(3, HealthCheckTypeConstant.HEALTH_CHECK_TYPE_TOPIC),
STORAGE(4, HealthCheckTypeConstant.HEALTH_CHECK_TYPE_STORAGE);
@@ -40,7 +50,7 @@
private final String name;
public static Integer toNumber(String name) {
- for (HealthCheckType healthCheckTypeEnum : HealthCheckType.values()) {
+ for (HealthCheckTypeEnum healthCheckTypeEnum : HealthCheckTypeEnum.values()) {
if (healthCheckTypeEnum.name.equals(name)) {
return healthCheckTypeEnum.number;
}
@@ -49,7 +59,7 @@
}
public static String toName(Integer number) {
- for (HealthCheckType healthCheckTypeEnum : HealthCheckType.values()) {
+ for (HealthCheckTypeEnum healthCheckTypeEnum : HealthCheckTypeEnum.values()) {
if (healthCheckTypeEnum.number.equals(number)) {
return healthCheckTypeEnum.name;
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/BaseException.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/BaseException.java
deleted file mode 100644
index c336401..0000000
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/BaseException.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.common.exception;
-
-import static org.apache.eventmesh.dashboard.common.constant.ConfigConst.COLON;
-
-import org.apache.eventmesh.dashboard.common.enums.Status;
-import org.apache.eventmesh.dashboard.common.util.ExceptionUtil;
-
-import lombok.Getter;
-
-/**
- * Exceptions in EventMeshAdmin application
- */
-
-@Getter
-public class BaseException extends RuntimeException {
-
- private static final long serialVersionUID = 3509261993355721168L;
-
- private Status status;
-
- public BaseException(String message) {
- super(message);
- }
-
- /**
- * Customized error reporting using enums and exceptions
- */
- public BaseException(Status status, Throwable cause) {
- super(ExceptionUtil.trimDesc(status.getDesc()) + COLON + cause.getMessage(), cause);
- this.status = status;
- }
-
- public BaseException(Status status) {
- super(status.getDesc());
- this.status = status;
- }
-}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshAdminException.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshAdminException.java
deleted file mode 100644
index f0ce811..0000000
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshAdminException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.common.exception;
-
-import org.apache.eventmesh.dashboard.common.enums.Status;
-
-/**
- * EventMeshAdmin Application side exception
- */
-
-public class EventMeshAdminException extends BaseException {
-
- private static final long serialVersionUID = 2002022502005456586L;
-
- public EventMeshAdminException(String message) {
- super(message);
- }
-
- /**
- * Customized error reporting using enums and exceptions
- */
- public EventMeshAdminException(Status status, Throwable cause) {
- super(status, cause);
- }
-}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/MetaException.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/MetaException.java
deleted file mode 100644
index b479fc6..0000000
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/MetaException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.common.exception;
-
-import org.apache.eventmesh.dashboard.common.enums.Status;
-
-/**
- * Meta side exception with EventMeshAdmin Application
- */
-
-public class MetaException extends BaseException {
-
- private static final long serialVersionUID = 6246145526338359773L;
-
- public MetaException(String message) {
- super(message);
- }
-
- /**
- * Customized error reporting using enums and exceptions
- */
- public MetaException(Status status, Throwable cause) {
- super(status, cause);
- }
-
- public MetaException(Status status) {
- super(status);
- }
-}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/ClusterSyncMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/ClusterSyncMetadata.java
new file mode 100644
index 0000000..c58890d
--- /dev/null
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/ClusterSyncMetadata.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.common.model;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterFramework;
+import org.apache.eventmesh.dashboard.common.enums.MetadataType;
+import org.apache.eventmesh.dashboard.common.enums.ReplicationDimension;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import lombok.Builder;
+import lombok.Data;
+
+@Data
+@Builder
+public class ClusterSyncMetadata {
+
+ public static final ClusterSyncMetadata EMPTY_OBJECT = new ClusterSyncMetadata(new ArrayList<>(), ReplicationDimension.NOT, ClusterFramework.NOT);
+
+ public static List<MetadataType> TEST_ONE = new ArrayList<>();
+
+ public static List<MetadataType> META = new ArrayList<>();
+
+ public static List<MetadataType> STORAGE = new ArrayList<>();
+
+ public static List<MetadataType> LANTERN = new ArrayList<>();
+
+ public static List<MetadataType> AUTH = new ArrayList<>();
+
+ static {
+
+ TEST_ONE.add(MetadataType.TOPIC);
+
+ META.add(MetadataType.RUNTIME);
+
+ STORAGE.add(MetadataType.CONFIG);
+ STORAGE.add(MetadataType.TOPIC);
+ STORAGE.add(MetadataType.GROUP);
+ STORAGE.add(MetadataType.NET_CONNECT);
+ STORAGE.add(MetadataType.SUBSCRIBER);
+
+ AUTH.add(MetadataType.USER);
+ AUTH.add(MetadataType.ACL);
+
+ }
+
+ private List<MetadataType> metadataTypeList;
+
+ private ReplicationDimension replicationDimension;
+
+ private ClusterFramework clusterFramework;
+
+
+}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/ConnectionInfo.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/ConnectionInfo.java
index 3934e8f..b6d79e0 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/ConnectionInfo.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/ConnectionInfo.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model;
public class ConnectionInfo {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/ConvertMetaData.java
similarity index 82%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/ConvertMetaData.java
index 82e6c7f..c8417c9 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/ConvertMetaData.java
@@ -15,12 +15,17 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.common.model;
-@Data
-public class GlobalRequest {
+/**
+ *
+ */
+public interface ConvertMetaData<E, M> {
- private Long clusterId;
+
+ E toEntity(M meta);
+
+ M toMetaData(E entity);
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/DatabaseAndMetadataMapper.java
similarity index 69%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/DatabaseAndMetadataMapper.java
index 6dafeef..1f89aab 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/DatabaseAndMetadataMapper.java
@@ -15,20 +15,26 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+package org.apache.eventmesh.dashboard.common.model;
+import org.apache.eventmesh.dashboard.common.enums.MetadataType;
+
+import lombok.Builder;
import lombok.Data;
@Data
-public class UpdateConfigsLog {
+@Builder
+public class DatabaseAndMetadataMapper {
- private Long instanceId;
- private Long clusterId;
+ private MetadataType metaType;
- private String name;
+ private Class<?> databaseHandlerClass;
- private String configProperties;
+ private Class<?> metadataHandlerClass;
+
+ private ConvertMetaData<?, ?> convertMetaData;
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/MetadataSyncResultMetadata.java
similarity index 65%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/MetadataSyncResultMetadata.java
index bf167b1..df371e7 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/MetadataSyncResultMetadata.java
@@ -15,16 +15,21 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.common.model;
-@Data
-public class ChangeConfigEntity {
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+import org.apache.eventmesh.dashboard.common.enums.MetadataType;
- private String configName;
+@Deprecated
+public class MetadataSyncResultMetadata {
- private String configValue;
- private Integer alreadyUpdate;
+ private MetadataType metadataType;
+
+ private ClusterTrusteeshipType clusterTrusteeshipType;
+
+ private boolean isFast = false;
+
+ private String resultData;
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/PortHandler.java
similarity index 81%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/PortHandler.java
index 82e6c7f..e404672 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/PortHandler.java
@@ -15,12 +15,17 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.common.model;
-@Data
-public class GlobalRequest {
+@Deprecated
+public class PortHandler {
- private Long clusterId;
+
+ private Integer port;
+
+ private Integer jmsPort;
+
+ private Integer mainPort;
+
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/SubscriptionInfo.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/SubscriptionInfo.java
index 6052d6c..482c8e2 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/SubscriptionInfo.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/SubscriptionInfo.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model;
import lombok.Builder;
@@ -22,6 +23,7 @@
@Data
@Builder
+@Deprecated
public class SubscriptionInfo {
// client name
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/base/BaseClusterIdBase.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/base/BaseClusterIdBase.java
new file mode 100644
index 0000000..b45c9e0
--- /dev/null
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/base/BaseClusterIdBase.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.common.model.base;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+
+public abstract class BaseClusterIdBase extends BaseOrganizationBase {
+
+ private Long clusterId;
+
+ private ClusterType clusterType;
+
+ public Long getClusterId() {
+ return clusterId;
+ }
+
+ public void setClusterId(Long clusterId) {
+ this.clusterId = clusterId;
+ }
+
+ public ClusterType getClusterType() {
+ return clusterType;
+ }
+
+ public void setClusterType(ClusterType clusterType) {
+ this.clusterType = clusterType;
+ }
+
+ public boolean isDelete() {
+ return this.getStatus() == 0;
+ }
+
+ public boolean isUpdate() {
+ return !this.isDelete() && !this.isInsert();
+ }
+
+ public boolean isInsert() {
+ return true;
+ }
+
+}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/base/BaseOrganizationBase.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/base/BaseOrganizationBase.java
new file mode 100644
index 0000000..a4c2356
--- /dev/null
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/base/BaseOrganizationBase.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.common.model.base;
+
+
+public abstract class BaseOrganizationBase {
+
+ private Long id;
+
+ private Long status;
+
+ private Long organizationId;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Long getOrganizationId() {
+ return organizationId;
+ }
+
+ public void setOrganizationId(Long organizationId) {
+ this.organizationId = organizationId;
+ }
+
+ public Long getStatus() {
+ return status;
+ }
+
+ public void setStatus(Long status) {
+ this.status = status;
+ }
+
+ public String getUnique() {
+ return this.getClass().getSimpleName() + "-" + this.id.toString();
+ }
+
+ /**
+ * 主要用于 database 数据 与 节点数据 对比用。这个数据在node的唯一
+ * @return
+ */
+ public abstract String nodeUnique();
+}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshException.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/base/BaseRuntimeIdBase.java
similarity index 72%
rename from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshException.java
rename to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/base/BaseRuntimeIdBase.java
index 444e530..7ceeb0b 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshException.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/base/BaseRuntimeIdBase.java
@@ -15,17 +15,20 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.exception;
-/**
- * EventMesh Runtime side exception
- */
+package org.apache.eventmesh.dashboard.common.model.base;
-public class EventMeshException extends BaseException {
+public abstract class BaseRuntimeIdBase extends BaseClusterIdBase {
- private static final long serialVersionUID = 5648256502005456586L;
+ private Long runtimeId;
- public EventMeshException(String message) {
- super(message);
+
+ public Long getRuntimeId() {
+ return runtimeId;
}
+
+ public void setRuntimeId(Long runtimeId) {
+ this.runtimeId = runtimeId;
+ }
+
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/base/BaseSyncBase.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/base/BaseSyncBase.java
new file mode 100644
index 0000000..a027241
--- /dev/null
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/base/BaseSyncBase.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.common.model.base;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType.FirstToWhom;
+import org.apache.eventmesh.dashboard.common.enums.ReplicationType;
+import org.apache.eventmesh.dashboard.common.enums.SyncErrorType;
+
+import java.time.LocalDateTime;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public abstract class BaseSyncBase extends BaseClusterIdBase {
+
+
+ private ClusterTrusteeshipType trusteeshipType;
+
+ private FirstToWhom firstToWhom;
+
+ private FirstToWhom firstSyncState;
+
+ private ReplicationType replicationType;
+
+ private SyncErrorType syncErrorType;
+
+ private String config;
+
+ /**
+ * 上线时间
+ */
+ private LocalDateTime onlineTimestamp;
+
+ /**
+ * 下线时间
+ */
+ private LocalDateTime offlineTimestamp;
+
+
+ private LocalDateTime startTimestamp;
+
+ public boolean isCluster() {
+ return true;
+ }
+
+}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/AclMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/AclMetadata.java
index 982fa5a..729849d 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/AclMetadata.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/AclMetadata.java
@@ -15,26 +15,37 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.metadata;
+import org.apache.eventmesh.dashboard.common.model.base.BaseRuntimeIdBase;
+
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
-public class AclMetadata extends MetadataConfig {
+public class AclMetadata extends BaseRuntimeIdBase {
private Long clusterId;
+
private String principal;
+
private Integer operation;
+
private String permissionType;
+
private String host;
+
private String resourceType;
+
private String resourceName;
+
private Integer patternType;
+
@Override
- public String getUnique() {
- return null;
+ public String nodeUnique() {
+ return this.principal;
}
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClientMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClientMetadata.java
index 8dd240a..ca2491b 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClientMetadata.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClientMetadata.java
@@ -15,14 +15,17 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.metadata;
+import org.apache.eventmesh.dashboard.common.model.base.BaseRuntimeIdBase;
+
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
-public class ClientMetadata extends MetadataConfig {
+public class ClientMetadata extends BaseRuntimeIdBase {
private String name;
@@ -47,8 +50,9 @@
*/
private String protocol;
+
@Override
- public String getUnique() {
- return host + ":" + port;
+ public String nodeUnique() {
+ return this.host + "-" + this.port;
}
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterMetadata.java
index 57f37b2..a45d68c 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterMetadata.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterMetadata.java
@@ -15,18 +15,19 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.metadata;
import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
import org.apache.eventmesh.dashboard.common.enums.ClusterType;
-import org.apache.eventmesh.dashboard.common.enums.StoreType;
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
-public class ClusterMetadata extends MetadataConfig {
+public class ClusterMetadata extends BaseSyncBase {
private String clusterName;
@@ -50,17 +51,12 @@
private Integer runState;
- private Integer status;
-
- /**
- * @see StoreType
- */
- private StoreType storeType;
private String description;
+
@Override
- public String getUnique() {
- return clusterName + "/" + registryAddress;
+ public String nodeUnique() {
+ return this.getClusterId().toString();
}
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterRelationshipMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterRelationshipMetadata.java
index 1b5d564..d2b9759 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterRelationshipMetadata.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterRelationshipMetadata.java
@@ -15,15 +15,19 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.metadata;
import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.model.base.BaseRuntimeIdBase;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class ClusterRelationshipMetadata extends MetadataConfig {
+@EqualsAndHashCode(callSuper = true)
+public class ClusterRelationshipMetadata extends BaseRuntimeIdBase {
private ClusterType clusterType;
@@ -31,10 +35,9 @@
private ClusterType relationshipType;
- private Integer status;
@Override
- public String getUnique() {
- return null;
+ public String nodeUnique() {
+ return this.relationshipId + "-" + this.getClusterId();
}
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConfigMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConfigMetadata.java
index 3592010..6a5f26d 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConfigMetadata.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConfigMetadata.java
@@ -15,8 +15,12 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.metadata;
+import org.apache.eventmesh.dashboard.common.enums.MetadataType;
+import org.apache.eventmesh.dashboard.common.model.base.BaseClusterIdBase;
+
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -25,21 +29,22 @@
*/
@Data
@EqualsAndHashCode(callSuper = true)
-public class ConfigMetadata extends MetadataConfig {
+public class ConfigMetadata extends BaseClusterIdBase {
/**
* property key
*/
- private String configKey;
+ private String configName;
private String configValue;
- private Integer instanceType;
+ private MetadataType instanceType;
private Long instanceId;
+
@Override
- public String getUnique() {
- return configKey;
+ public String nodeUnique() {
+ return this.configName;
}
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConnectionMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConnectionMetadata.java
index 49856ea..39f1adf 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConnectionMetadata.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConnectionMetadata.java
@@ -15,16 +15,21 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.metadata;
+import org.apache.eventmesh.dashboard.common.model.base.BaseRuntimeIdBase;
+
import lombok.Data;
+import lombok.EqualsAndHashCode;
/**
* when insert data to db from meta service, connection metadata operation should be called after cluster and client in order to fetch information
* from them.
*/
@Data
-public class ConnectionMetadata extends MetadataConfig {
+@EqualsAndHashCode(callSuper = true)
+public class ConnectionMetadata extends BaseRuntimeIdBase {
/**
@@ -67,8 +72,9 @@
private String description;
+
@Override
- public String getUnique() {
+ public String nodeUnique() {
return getClusterId() + "/" + sourceId + "/" + sinkId + "/" + topic;
}
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConnectorMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConnectorMetadata.java
index 57e2e95..2f12a47 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConnectorMetadata.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConnectorMetadata.java
@@ -15,12 +15,14 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.metadata;
import org.apache.eventmesh.dashboard.common.enums.KubernetesPodStatus;
+import org.apache.eventmesh.dashboard.common.model.base.BaseRuntimeIdBase;
-public class ConnectorMetadata extends MetadataConfig {
+public class ConnectorMetadata extends BaseRuntimeIdBase {
private String name;
@@ -37,8 +39,9 @@
*/
private Integer podState;
+
@Override
- public String getUnique() {
- return host + ":" + port;
+ public String nodeUnique() {
+ return "";
}
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConsumeOffsetMetadata.java
similarity index 71%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConsumeOffsetMetadata.java
index bf167b1..a714618 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConsumeOffsetMetadata.java
@@ -15,16 +15,21 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+package org.apache.eventmesh.dashboard.common.model.metadata;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class ChangeConfigEntity {
+@EqualsAndHashCode(callSuper = true)
+public class ConsumeOffsetMetadata extends TopicOffsetMetadata {
- private String configName;
+ private String groupName;
- private String configValue;
+ private Long consumeOffset;
- private Integer alreadyUpdate;
+ private Integer consumeRate;
+
+ private Long delayNum;
+
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/GroupMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/GroupMetadata.java
index 3827f93..e08bf8a 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/GroupMetadata.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/GroupMetadata.java
@@ -15,14 +15,17 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.metadata;
+import org.apache.eventmesh.dashboard.common.model.base.BaseRuntimeIdBase;
+
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
-public class GroupMetadata extends MetadataConfig {
+public class GroupMetadata extends BaseRuntimeIdBase {
private String name;
@@ -32,10 +35,10 @@
private Integer type;
- private String state;
+
@Override
- public String getUnique() {
- return name;
+ public String nodeUnique() {
+ return this.name;
}
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/InstanceUserMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/InstanceUserMetadata.java
index aaf81ba..d25661d 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/InstanceUserMetadata.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/InstanceUserMetadata.java
@@ -15,9 +15,8 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.metadata;
-import org.apache.eventmesh.dashboard.common.enums.StoreType;
+package org.apache.eventmesh.dashboard.common.model.metadata;
import lombok.Data;
@@ -28,7 +27,7 @@
public class InstanceUserMetadata {
private String userName;
- //service users are only store users by now
- private StoreType serviceType;
+
+
private String password;
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/MetadataConfig.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/MetadataConfig.java
deleted file mode 100644
index 09483cf..0000000
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/MetadataConfig.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.common.model.metadata;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
-/**
- * This class is used to represent a piece of metadata, which can be used in create, update or delete operations to metadata service(eventmesh meta
- * center, eventmesh runtime cluster)<p> follow method should be called in init block which is used to indicate the type of metadata:
- * {@code this.setServiceTypeEnums(MetadataServiceTypeEnums.RUNTIME);}
- */
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-@SuperBuilder
-public abstract class MetadataConfig {
-
- //eventmesh registry url
- private String registryAddress;
- //cluster id in database
- private Long clusterId;
-
-
- private Long id;
-
- /**
- * @return A string that is unique to the source, usually a url
- */
- public abstract String getUnique();
-}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshException.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/QueueMetadata.java
similarity index 69%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshException.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/QueueMetadata.java
index 444e530..70e869c 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshException.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/QueueMetadata.java
@@ -15,17 +15,21 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.exception;
-/**
- * EventMesh Runtime side exception
- */
+package org.apache.eventmesh.dashboard.common.model.metadata;
-public class EventMeshException extends BaseException {
+import org.apache.eventmesh.dashboard.common.model.base.BaseRuntimeIdBase;
- private static final long serialVersionUID = 5648256502005456586L;
+public class QueueMetadata extends BaseRuntimeIdBase {
- public EventMeshException(String message) {
- super(message);
+ private String topicName;
+
+ private String queueName;
+
+
+ @Override
+ public String nodeUnique() {
+ return this.topicName + "-" + this.queueName;
}
+
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RegistryMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RegistryMetadata.java
index 890ce75..882f421 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RegistryMetadata.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RegistryMetadata.java
@@ -15,20 +15,15 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.metadata;
import org.apache.eventmesh.dashboard.common.enums.RecordStatus;
import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
@Data
-@SuperBuilder
-@NoArgsConstructor
-@EqualsAndHashCode(callSuper = true)
-public class RegistryMetadata extends MetadataConfig {
+public class RegistryMetadata {
private String clusterName;
@@ -55,9 +50,4 @@
* @see RecordStatus
*/
private Integer status;
-
- @Override
- public String getUnique() {
- return host + ":" + port;
- }
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RuntimeMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RuntimeMetadata.java
index eb88e38..9d51ad8 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RuntimeMetadata.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RuntimeMetadata.java
@@ -15,20 +15,17 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.metadata;
-import lombok.AllArgsConstructor;
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
+
import lombok.Data;
import lombok.EqualsAndHashCode;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@SuperBuilder
@EqualsAndHashCode(callSuper = true)
-public class RuntimeMetadata extends MetadataConfig {
+public class RuntimeMetadata extends BaseSyncBase {
private String host;
@@ -36,20 +33,26 @@
private Integer jmxPort;
+ private Integer runtimeIndex;
+
private String rack;
private String endpointMap;
private Long storageClusterId;
- private Long startTimestamp;
- private String clusterName;
-
- private Integer status;
+ public String clusterUnique() {
+ return ClusterMetadata.class.getSimpleName() + "-" + this.getClusterId();
+ }
@Override
- public String getUnique() {
- return host + ":" + port;
+ public boolean isCluster() {
+ return false;
+ }
+
+ @Override
+ public String nodeUnique() {
+ return this.host + "-" + this.port;
}
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/TopicMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/TopicMetadata.java
index b85c346..d5173ce 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/TopicMetadata.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/TopicMetadata.java
@@ -15,25 +15,19 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.metadata;
-import org.apache.eventmesh.dashboard.common.enums.StoreType;
+import org.apache.eventmesh.dashboard.common.model.base.BaseRuntimeIdBase;
import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
+import lombok.EqualsAndHashCode;
@Data
-@SuperBuilder
-@NoArgsConstructor
-public class TopicMetadata extends MetadataConfig {
+@EqualsAndHashCode(callSuper = true)
+public class TopicMetadata extends BaseRuntimeIdBase {
- private StoreType storeType;
- private String storeAddress;
-
- //rocketmq -> broker url
- private String connectionUrl;
private String topicName;
@@ -49,8 +43,9 @@
private String topicConfig;
+
@Override
- public String getUnique() {
- return topicName;
+ public String nodeUnique() {
+ return this.topicName;
}
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/TopicOffsetMetadata.java
similarity index 67%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/TopicOffsetMetadata.java
index 344d02d..5c69506 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/TopicOffsetMetadata.java
@@ -15,28 +15,30 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.message;
+package org.apache.eventmesh.dashboard.common.model.metadata;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+import org.apache.eventmesh.dashboard.common.model.base.BaseRuntimeIdBase;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
-@EqualsAndHashCode(callSuper = true, exclude = "status")
-public class GroupMemberEntity extends BaseEntity {
+@EqualsAndHashCode(callSuper = true)
+public class TopicOffsetMetadata extends BaseRuntimeIdBase {
- private Long id;
- private Long clusterId;
+ private String offsetRecordType;
+
+ private Long topicId;
private String topicName;
- private String groupName;
+ private Long topicOffset;
- private String eventMeshUser;
+ private Integer increaseRate;
- private String state;
-
- private Integer status;
+ @Override
+ public String nodeUnique() {
+ return "";
+ }
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/AbstractGlobal2Request.java
similarity index 83%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/AbstractGlobal2Request.java
index 82e6c7f..4991274 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/AbstractGlobal2Request.java
@@ -15,12 +15,17 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting;
+
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class GlobalRequest {
+@EqualsAndHashCode(callSuper = true)
+public abstract class AbstractGlobal2Request<T> extends Global2Request {
- private Long clusterId;
+ private T metaData;
+
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/BaseGlobalResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/BaseGlobalResult.java
index 28d413a..d7dbf05 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/BaseGlobalResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/BaseGlobalResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting;
public class BaseGlobalResult extends GlobalResult<String> {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/Global2Request.java
similarity index 82%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/Global2Request.java
index 82e6c7f..14a5634 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/Global2Request.java
@@ -15,12 +15,21 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+
import lombok.Data;
@Data
-public class GlobalRequest {
+public class Global2Request {
private Long clusterId;
+
+ private ClusterType clusterType;
+
+ private Long runtimeId;
+
+ private ClusterType runtimeType;
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalResult.java
index d6866a3..2870a57 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting;
import lombok.AllArgsConstructor;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingAction.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingAction.java
index ce62564..fffc11c 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingAction.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingAction.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting;
import org.apache.eventmesh.dashboard.common.enums.RemotingType;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingActionType.java
similarity index 90%
rename from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
rename to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingActionType.java
index 82e6c7f..76668dd 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingActionType.java
@@ -15,12 +15,19 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting;
-import lombok.Data;
+public enum RemotingActionType {
-@Data
-public class GlobalRequest {
+ ADD,
- private Long clusterId;
+ UPDATE,
+
+ DELETE,
+
+ QUEUE_ALL,
+
+ ;
+
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingOperate.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingOperate.java
index 39bda20..c6c1052 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingOperate.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingOperate.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting;
public enum RemotingOperate {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclRequest.java
index e1844ce..6e37bbd 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclRequest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.acl;
public class CreateAclRequest {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclResponse.java
index 8e2b3a4..f60993d 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.acl;
public class CreateAclResponse {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclResult.java
index 4e3d6c2..4bc9527 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.acl;
public class CreateAclResult {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/DeleteAclRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/DeleteAclRequest.java
index 97211b1..382573a 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/DeleteAclRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/DeleteAclRequest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.acl;
public class DeleteAclRequest {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/DeleteAclResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/DeleteAclResponse.java
index f79d7f3..2bf276f 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/DeleteAclResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/DeleteAclResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.acl;
public class DeleteAclResponse {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/DeleteAclResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/DeleteAclResult.java
index db1dbfd..6d76eee 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/DeleteAclResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/DeleteAclResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.acl;
public class DeleteAclResult {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAcls2Request.java
similarity index 84%
rename from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsRequest.java
rename to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAcls2Request.java
index 37d78ec..6c8099f 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAcls2Request.java
@@ -15,11 +15,12 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.acl;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.AbstractGlobal2Request;
-public class GetAclsRequest extends GlobalRequest {
+public class GetAcls2Request extends AbstractGlobal2Request<Object> {
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsResponse.java
index 95688e2..97d4065 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.acl;
public class GetAclsResponse {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsResult.java
index 036dcd6..8389741 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.acl;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/client/GetClientRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/client/GetClientRequest.java
index 2369a24..f856b44 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/client/GetClientRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/client/GetClientRequest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.client;
public class GetClientRequest {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/client/GetClientResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/client/GetClientResponse.java
index f19f9e5..17fb22a 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/client/GetClientResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/client/GetClientResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.client;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/client/GetClientResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/client/GetClientResult.java
index 340d33a..173a5ab 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/client/GetClientResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/client/GetClientResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.client;
import java.util.concurrent.CompletableFuture;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigRequest.java
index 0f8d3de..5519f6d 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigRequest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.config;
import org.apache.eventmesh.dashboard.common.model.remoting.RemotingOperate;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResponse.java
index d951a91..e61b525 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.config;
public class AddConfigResponse {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResult.java
index 2af482a..af31a02 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.config;
public class AddConfigResult {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/ConfigType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/ConfigType.java
index 585e932..ec46516 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/ConfigType.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/ConfigType.java
@@ -15,8 +15,12 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.config;
+/**
+ *
+ */
public enum ConfigType {
NODE,
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigRequest.java
index c656612..0c9844b 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigRequest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.config;
import org.apache.eventmesh.dashboard.common.model.remoting.RemotingOperate;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResponse.java
index b580d43..138c66d 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.config;
public class DeleteConfigResponse {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResult.java
index 935fb4d..b3ee9bf 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.config;
public class DeleteConfigResult extends AddConfigResult {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigRequest.java
index b24ab36..acb2ac3 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigRequest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.config;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigResponse.java
index c96809a..d7b4fa7 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.config;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigResult.java
index 3fb1053..0086884 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.config;
import java.util.concurrent.CompletableFuture;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigRequest.java
index baae002..17af516 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigRequest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.config;
import org.apache.eventmesh.dashboard.common.model.remoting.RemotingOperate;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResponse.java
index 2686df1..7981d30 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.config;
public class UpdateConfigResponse {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResult.java
index a3128da..7b24a75 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.config;
public class UpdateConfigResult extends AddConfigResult {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/CreateConnectorRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/CreateConnectorRequest.java
index 7117dd9..4ed6b17 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/CreateConnectorRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/CreateConnectorRequest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.connector;
import org.apache.eventmesh.dashboard.common.model.metadata.ConnectorMetadata;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/CreateConnectorResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/CreateConnectorResponse.java
index 4e149df..1f12f4d 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/CreateConnectorResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/CreateConnectorResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.connector;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/CreateConnectorResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/CreateConnectorResult.java
index e674650..198adf3 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/CreateConnectorResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/CreateConnectorResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.connector;
import java.util.concurrent.CompletableFuture;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/GetConnectorRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/GetConnectorRequest.java
index a386d7c..81a442c 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/GetConnectorRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/GetConnectorRequest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.connector;
public class GetConnectorRequest {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/GetConnectorResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/GetConnectorResponse.java
index 4de89a6..d8beee7 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/GetConnectorResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/GetConnectorResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.connector;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/GetConnectorResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/GetConnectorResult.java
index e21d239..5ba13dd 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/GetConnectorResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/connector/GetConnectorResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.connector;
import java.util.concurrent.CompletableFuture;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupResult.java
index b41acc3..d2c653a 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.group;
import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult;
@@ -22,8 +23,10 @@
import java.util.concurrent.CompletableFuture;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
+@EqualsAndHashCode(callSuper = true)
public class GetGroupResult extends GlobalResult<GetGroupsResponse> {
private CompletableFuture<GetGroupsResponse> future;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupsRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupsRequest.java
index 6586fe7..eb4c589 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupsRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupsRequest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.group;
public class GetGroupsRequest {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupsResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupsResponse.java
index fbe9023..cecc430 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupsResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupsResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.group;
import org.apache.eventmesh.dashboard.common.model.metadata.GroupMetadata;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/GetOffsetRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/GetOffsetRequest.java
index 96f4b69..3d62e25 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/GetOffsetRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/GetOffsetRequest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.offset;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/GetOffsetResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/GetOffsetResponse.java
index 3358b89..6d76f40 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/GetOffsetResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/GetOffsetResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.offset;
public class GetOffsetResponse {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/GetOffsetResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/GetOffsetResult.java
index 2b0a449..4516db6 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/GetOffsetResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/GetOffsetResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.offset;
import java.util.concurrent.CompletableFuture;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetRequest.java
index 3fa223e..8fc0407 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetRequest.java
@@ -15,15 +15,19 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.offset;
import org.apache.eventmesh.dashboard.common.enums.ResetOffsetMode;
+import org.apache.eventmesh.dashboard.common.model.remoting.Global2Request;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class ResetOffsetRequest {
+@EqualsAndHashCode(callSuper = true)
+public class ResetOffsetRequest extends Global2Request {
private Long timestamp;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetResponse.java
index ed1417b..3f8be3f 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.offset;
import lombok.Data;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetResult.java
index 3f0773e..cd64d55 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.offset;
import java.util.concurrent.CompletableFuture;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntime2Request.java
similarity index 87%
rename from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeRequest.java
rename to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntime2Request.java
index de8ac0a..f5a6f34 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntime2Request.java
@@ -15,14 +15,17 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.runtime;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.Global2Request;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class GetRuntimeRequest extends GlobalRequest {
+@EqualsAndHashCode(callSuper = true)
+public class GetRuntime2Request extends Global2Request {
private String registryAddress;
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeResponse.java
index 483a609..6e74132 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.runtime;
import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeResult.java
index d0ec3e1..09b74eb 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.runtime;
import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult;
@@ -22,8 +23,10 @@
import java.util.concurrent.CompletableFuture;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
+@EqualsAndHashCode(callSuper = true)
public class GetRuntimeResult extends GlobalResult<GetRuntimeResponse> {
private CompletableFuture<GetRuntimeResponse> future;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/subscription/GetSubscriptionRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/subscription/GetSubscriptionRequest.java
index c5271ff..15149df 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/subscription/GetSubscriptionRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/subscription/GetSubscriptionRequest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.subscription;
public class GetSubscriptionRequest {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/subscription/GetSubscriptionResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/subscription/GetSubscriptionResponse.java
index 853675f..3c2e28e 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/subscription/GetSubscriptionResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/subscription/GetSubscriptionResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.subscription;
public class GetSubscriptionResponse {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/subscription/GetSubscriptionResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/subscription/GetSubscriptionResult.java
index f5a2215..b5e89f8 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/subscription/GetSubscriptionResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/subscription/GetSubscriptionResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.subscription;
import java.util.concurrent.CompletableFuture;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopic2Request.java
similarity index 74%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsRequest.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopic2Request.java
index d9920d8..5a0e74d 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopic2Request.java
@@ -15,20 +15,19 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.topic;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
-import lombok.AllArgsConstructor;
+import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata;
+import org.apache.eventmesh.dashboard.common.model.remoting.AbstractGlobal2Request;
+
import lombok.Data;
-import lombok.NoArgsConstructor;
+import lombok.EqualsAndHashCode;
@Data
-@NoArgsConstructor
-@AllArgsConstructor
-public class GetTopicsRequest extends GlobalRequest {
+@EqualsAndHashCode(callSuper = true)
+public class CreateTopic2Request extends AbstractGlobal2Request<TopicMetadata> {
- private String runtimeHost;
- private Integer runtimePort;
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResponse.java
index d4e4a78..244ead5 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.topic;
import lombok.AllArgsConstructor;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResult.java
index 9fb6327..0c19d45 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.topic;
import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicRequest.java
index b2bd216..deecfb4 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicRequest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.topic;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResponse.java
index df81875..383c618 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.topic;
import lombok.AllArgsConstructor;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResult.java
index a340735..a55698b 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.topic;
import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopics2Request.java
similarity index 85%
rename from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsRequest.java
rename to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopics2Request.java
index d9920d8..2178d09 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopics2Request.java
@@ -15,18 +15,17 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.topic;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.Global2Request;
-import lombok.AllArgsConstructor;
import lombok.Data;
-import lombok.NoArgsConstructor;
+import lombok.EqualsAndHashCode;
@Data
-@NoArgsConstructor
-@AllArgsConstructor
-public class GetTopicsRequest extends GlobalRequest {
+@EqualsAndHashCode(callSuper = true)
+public class GetTopics2Request extends Global2Request {
private String runtimeHost;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResponse.java
index dfe3408..154dd7a 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.topic;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResult.java
index debdbdb..1e6c47e 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.topic;
import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/CreateUserRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/CreateUserRequest.java
index 2031153..0a1a1a4 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/CreateUserRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/CreateUserRequest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.user;
import org.apache.eventmesh.dashboard.common.model.metadata.InstanceUserMetadata;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/CreateUserResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/CreateUserResponse.java
index 7d9a79b..403af2c 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/CreateUserResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/CreateUserResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.user;
public class CreateUserResponse {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/CreateUserResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/CreateUserResult.java
index 3e187f2..24356d8 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/CreateUserResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/CreateUserResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.user;
public class CreateUserResult {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleteUserResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleteUserResponse.java
index a8c1027..02f553f 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleteUserResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleteUserResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.user;
public class DeleteUserResponse {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleteUserResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleteUserResult.java
index d6241c2..b9de0e9 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleteUserResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleteUserResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.user;
public class DeleteUserResult {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleterUserRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleterUserRequest.java
index 30541d7..4771567 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleterUserRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleterUserRequest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.user;
public class DeleterUserRequest {
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserRequest.java
index faccba5..e302289 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserRequest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.user;
import org.apache.eventmesh.dashboard.common.enums.StoreType;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserResponse.java
index 8fdf0bc..805f6c1 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserResponse.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.user;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserResult.java
index 8014118..2b68396 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserResult.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserResult.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.model.remoting.user;
import java.util.concurrent.CompletableFuture;
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/port/AbstractPortValidate.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/port/AbstractPortValidate.java
new file mode 100644
index 0000000..2035eb1
--- /dev/null
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/port/AbstractPortValidate.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.common.port;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+public abstract class AbstractPortValidate implements PortValidate {
+
+ protected List<PortRule> portRules = new ArrayList<>();
+
+
+ protected void createNotValid(List<String> portNameList) {
+ AtomicInteger index = new AtomicInteger(0);
+ portNameList.forEach(portName -> {
+ PortRule portRule = PortRule.builder().valid(false).index(index.incrementAndGet()).name(portName).build();
+ this.setPortRules(portRule);
+ });
+ }
+
+ protected void setPortRules(PortRule portRule) {
+ this.portRules.add(portRule);
+ }
+
+
+ @Override
+ public List<PortRule> portRules() {
+ return portRules;
+ }
+
+}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/port/NotPortValidate.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/port/NotPortValidate.java
new file mode 100644
index 0000000..d2a7cef
--- /dev/null
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/port/NotPortValidate.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.common.port;
+
+import java.util.List;
+
+public class NotPortValidate extends AbstractPortValidate {
+
+
+ public static NotPortValidate builder() {
+ return builder(1);
+ }
+
+ public static NotPortValidate builder(Integer num) {
+ NotPortValidate notPortValidate = new NotPortValidate();
+ notPortValidate.build(num);
+ return notPortValidate;
+ }
+
+
+ protected void build(Integer num) {
+ for (int i = 0; i < num; i++) {
+ PortRule rule = PortRule.builder().valid(false).build();
+ this.setPortRules(rule);
+ }
+ }
+
+
+ @Override
+ public boolean validate(PortRule lastPortRule, Integer lastPort, PortRule current, Integer port, List<PortRule> portRules) {
+ return false;
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/port/PortRule.java
similarity index 77%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/port/PortRule.java
index 6dafeef..9c14995 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/port/PortRule.java
@@ -15,20 +15,24 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+package org.apache.eventmesh.dashboard.common.port;
-
+import lombok.Builder;
import lombok.Data;
+/**
+ * 目前只支持范围获得 port
+ */
@Data
-public class UpdateConfigsLog {
+@Builder
+public class PortRule {
- private Long instanceId;
-
- private Long clusterId;
+ private boolean valid;
private String name;
- private String configProperties;
+ private Integer index;
+
+ private Integer spanValue;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/port/PortValidate.java
similarity index 74%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/port/PortValidate.java
index bf167b1..4936477 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/port/PortValidate.java
@@ -15,16 +15,17 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+package org.apache.eventmesh.dashboard.common.port;
-import lombok.Data;
+import java.util.List;
-@Data
-public class ChangeConfigEntity {
+/**
+ *
+ */
+public interface PortValidate {
- private String configName;
- private String configValue;
+ List<PortRule> portRules();
- private Integer alreadyUpdate;
+ boolean validate(PortRule lastPortRule, Integer lastPort, PortRule current, Integer port, List<PortRule> portRules);
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/util/ClasspathScanner.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/util/ClasspathScanner.java
new file mode 100644
index 0000000..1ab9fc7
--- /dev/null
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/util/ClasspathScanner.java
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.common.util;
+
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.ArrayUtils;
+
+import java.io.IOException;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.util.ClassUtils;
+
+import lombok.Builder;
+import lombok.Data;
+
+
+@Data
+@Builder
+public class ClasspathScanner {
+
+ private Class<?> base;
+
+ private String baseString;
+
+ private String subPath;
+
+
+ private boolean allSubDirectory = true;
+
+ private Set<Class<?>> interfaceSet;
+
+ private String designation;
+
+
+ private Resource[] getResource() throws IOException {
+ PathMatchingResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
+ return resourcePatternResolver.getResources(this.createLocationPattern());
+ }
+
+ public List<Class<?>> getClazz() throws Exception {
+ Resource[] resources = this.getResource();
+ List<Class<?>> resourcesList = new ArrayList<>();
+ for (Resource resource : resources) {
+ if (this.excludeTest(resource)) {
+ continue;
+ }
+ Class<?> clazz = this.createClass(resource);
+ if (Modifier.isAbstract(clazz.getModifiers())) {
+ continue;
+ }
+ if (this.includeInterface(clazz)) {
+ resourcesList.add(clazz);
+ }
+ Class<?>[] innerClass = clazz.getDeclaredClasses();
+ if (ArrayUtils.isEmpty(innerClass)) {
+ continue;
+ }
+ for (Class<?> c : innerClass) {
+ if (this.includeInterface(c)) {
+ resourcesList.add(c);
+ }
+ }
+ }
+ return resourcesList;
+ }
+
+ private boolean excludeTest(Resource resource) throws IOException {
+ return resource.getFile().getPath().indexOf("/target/test-classes/") != -1;
+ }
+
+ private Class<?> createClass(Resource resource) throws IOException, ClassNotFoundException {
+ String path = resource.getURL().getPath();
+ String classPath = path.substring(path.indexOf(this.baseString)).replace("/", ".").replace(".class", "");
+ return Class.forName(classPath);
+ }
+
+ private boolean includeInterface(Class<?> clazz) throws Exception {
+ if (CollectionUtils.isEmpty(this.interfaceSet)) {
+ return true;
+ }
+ Set<Class<?>> classInterfaceSet = ClassUtils.getAllInterfacesForClassAsSet(clazz);
+ for (Class<?> c : this.interfaceSet) {
+ if (classInterfaceSet.contains(c)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private String createLocationPattern() {
+ StringBuffer stringBuffer = new StringBuffer();
+ stringBuffer.append("classpath*:./");
+ this.baseString = base.getPackage().getName().replace('.', '/');
+ stringBuffer.append(this.baseString);
+ stringBuffer.append("/");
+ stringBuffer.append(subPath);
+ if (this.allSubDirectory) {
+ stringBuffer.append("/**");
+ }
+ /**
+ * SDK*.class
+ */
+ if (Objects.isNull(this.designation)) {
+ stringBuffer.append("/*");
+ } else {
+ stringBuffer.append("/");
+ stringBuffer.append(this.designation);
+ }
+ stringBuffer.append(".class");
+ return stringBuffer.toString();
+ }
+}
+
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/util/ExceptionUtil.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/util/ExceptionUtil.java
index a9bd0e0..1b37a0d 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/util/ExceptionUtil.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/util/ExceptionUtil.java
@@ -15,8 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.common.util;
+
+@Deprecated
public class ExceptionUtil {
/**
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/utils/ClusterTypeRelationship.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/utils/ClusterTypeRelationship.java
new file mode 100644
index 0000000..3159cf3
--- /dev/null
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/utils/ClusterTypeRelationship.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.common.utils;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+public class ClusterTypeRelationship {
+
+ private static final ClusterTypeRelationship INSTANCE = new ClusterTypeRelationship();
+
+ public static ClusterTypeRelationship getInstance() {
+ return INSTANCE;
+ }
+
+
+ private final List<ClusterType> storageClusterTypeList = new ArrayList<>();
+
+ {
+ ClusterType[] clusterTypes = ClusterType.values();
+ for (ClusterType clusterType : clusterTypes) {
+ if (Objects.isNull(clusterType.getEventmeshNodeType())) {
+ break;
+ }
+ for (ClusterType relationshipType : clusterTypes) {
+ if (Objects.isNull(clusterType.getEventmeshNodeType())) {
+ break;
+ }
+ }
+ if (Objects.equals(clusterType.getEventmeshNodeType(), ClusterType.STORAGE)
+ && Objects.equals(clusterType.getAssemblyNodeType(), ClusterType.CLUSTER)) {
+ storageClusterTypeList.add(clusterType);
+ }
+ if (Objects.equals(clusterType.getEventmeshNodeType(), ClusterType.STORAGE)
+ && Objects.equals(clusterType.getAssemblyNodeType(), ClusterType.CLUSTER)) {
+ storageClusterTypeList.add(clusterType);
+ }
+ }
+ }
+
+ public ClusterTypeRelationship() {
+
+ }
+
+ public List<ClusterType> getStorageClusterTypeList() {
+ return storageClusterTypeList;
+ }
+}
diff --git a/eventmesh-dashboard-console/pom.xml b/eventmesh-dashboard-console/pom.xml
index cdac182..bfe4dc2 100644
--- a/eventmesh-dashboard-console/pom.xml
+++ b/eventmesh-dashboard-console/pom.xml
@@ -16,6 +16,7 @@
~ limitations under the License.
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -30,7 +31,7 @@
<artifactId>eventmesh-dashboard-console</artifactId>
<properties>
- <java.version>1.8</java.version>
+ <java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
@@ -66,10 +67,21 @@
<version>0.1.4</version>
</dependency>
<dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>druid-spring-boot-starter</artifactId>
+ <version>1.2.21</version>
+ </dependency>
+
+ <dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-validation</artifactId>
+ <version>2.6.7</version>
+ </dependency>
<!-- Swagger -->
<dependency>
@@ -85,12 +97,12 @@
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
- <version>1.5.2.Final</version>
+ <version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
- <version>1.5.2.Final</version>
+ <version>1.6.1</version>
</dependency>
<!-- GitHub laohu springmvc(contain spring boot starter)-->
@@ -110,7 +122,7 @@
<dependency>
<groupId>cn.lampup</groupId>
<artifactId>decoration-core</artifactId>
- <version>0.1.7</version>
+ <version>0.1.20</version>
</dependency>
<!-- Unit Test -->
@@ -125,6 +137,24 @@
<version>4.13.2</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-inline</artifactId>
+ <version>5.2.0</version> <!-- 根据项目要求选择版本 -->
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>2.3.232</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mybatis.spring.boot</groupId>
+ <artifactId>mybatis-spring-boot-starter-test</artifactId>
+ <version>2.3.2</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -134,8 +164,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
- <source>1.8</source>
- <target>1.8</target>
+ <source>15</source>
+ <target>15</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
@@ -169,5 +199,12 @@
</plugin>
</plugins>
</build>
+ <repositories>
+ <repository>
+ <id>maven_central</id>
+ <name>Maven Central</name>
+ <url>https://repo.maven.apache.org/maven2/</url>
+ </repository>
+ </repositories>
</project>
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/EventMeshDashboardApplication.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/EventMeshDashboardApplication.java
index 7103aad..d0d6a4f 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/EventMeshDashboardApplication.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/EventMeshDashboardApplication.java
@@ -15,11 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import lombok.extern.slf4j.Slf4j;
@@ -27,7 +27,6 @@
@Slf4j
@SpringBootApplication
@EnableTransactionManagement
-@EnableAspectJAutoProxy(exposeProxy = true)
public class EventMeshDashboardApplication {
public static void main(String[] args) {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/annotation/EmLog.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/annotation/EmLog.java
index efae3a5..46538d1 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/annotation/EmLog.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/annotation/EmLog.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.annotation;
import java.lang.annotation.ElementType;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/config/FunctionManagerConfigs.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/config/FunctionManagerConfigs.java
index 3b2eb77..fed7d4f 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/config/FunctionManagerConfigs.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/config/FunctionManagerConfigs.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/config/SpringDocConfig.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/config/SpringDocConfig.java
index 12d33c8..3101405 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/config/SpringDocConfig.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/config/SpringDocConfig.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.config;
import org.springframework.context.annotation.Bean;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ClusterAbitityService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ClusterAbitityService.java
new file mode 100644
index 0000000..112a889
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ClusterAbitityService.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.controller;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterFramework;
+import org.apache.eventmesh.dashboard.common.enums.ClusterSyncMetadataEnum;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseClusterIdEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.mapstruct.cluster.ClusterControllerMapper;
+import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import lombok.Getter;
+
+
+@Component
+public class ClusterAbitityService {
+
+
+ @Autowired
+ private ClusterService clusterService;
+
+
+ @Value("${console.controller.data.merge:false}")
+ @Getter
+ private boolean merge = false;
+
+
+ /**
+ *
+ * 可以对 topic, group, config ,sub 等做到强制性.offset 无法做到强制一致性
+ *
+ *
+ */
+ @Value("${console.data.forceConsistent:false}")
+ private boolean forceConsistent = false;
+
+
+ public boolean isCAP(ClusterIdDTO clusterIdDTO) {
+ ClusterEntity clusterEntity = this.clusterService.queryClusterById(ClusterControllerMapper.INSTANCE.toClusterEntity(clusterIdDTO));
+ return this.isCAP(clusterEntity);
+ }
+
+ public boolean isCAP(BaseClusterIdEntity baseClusterIdEntity) {
+ ClusterFramework clusterFramework = ClusterSyncMetadataEnum.getClusterFramework(baseClusterIdEntity.getClusterType());
+ return clusterFramework.isCAP();
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java
index 6a4eee1..7fe42b4 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java
@@ -15,13 +15,12 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.controller;
-
-import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectionEntity;
import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
-import org.apache.eventmesh.dashboard.console.mapstruct.connection.ConnectionControllerMapper;
+import org.apache.eventmesh.dashboard.console.modle.dto.connection.AddConnectionDTO;
import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO;
import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO;
import org.apache.eventmesh.dashboard.console.modle.vo.connection.ConnectionListVO;
@@ -29,19 +28,16 @@
import java.util.List;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
-@RequestMapping("/cluster/connection")
public class ConnectionController {
- @Autowired
+
private ConnectionDataService connectionDataService;
/**
@@ -50,27 +46,28 @@
* @param type
* @return
*/
- @GetMapping("/getConnectorBusinessType")
+ @GetMapping("/cluster/connection/getConnectorBusinessType")
public List<String> getConnectorBusinessType(String type) {
return connectionDataService.getConnectorBusinessType(type);
}
- @GetMapping("/getConnectorConfigs")
+ @GetMapping("/cluster/connection/getConnectorConfigs")
public List<ConfigEntity> getConnectorConfigsByClassAndVersion(String version, String classType) {
return connectionDataService.getConnectorConfigsByClassAndVersion(classType, version);
}
- @GetMapping("/showCreateConnectionMessage")
- public AddConnectionEntity showCreateConnectionMessage() {
- return new AddConnectionEntity();
+ @GetMapping("/cluster/connection/showCreateConnectionMessage")
+ public AddConnectionDTO showCreateConnectionMessage() {
+ return new AddConnectionDTO();
}
- @PostMapping("/createConnection")
+ @PostMapping("/cluster/connection/createConnection")
public String createConnection(@Validated @RequestBody CreateConnectionDTO createConnectionDTO) {
try {
- connectionDataService.createConnection(ConnectionControllerMapper.INSTANCE.queryCreateEntityByConnection(createConnectionDTO));
+ connectionDataService.createConnection(createConnectionDTO);
+
} catch (Exception e) {
return e.getMessage();
}
@@ -78,12 +75,12 @@
}
- @PostMapping("/getConnectionList")
+ @PostMapping("/cluster/connection/getConnectionList")
public List<ConnectionListVO> getConnectionList(@Validated @RequestBody GetConnectionListDTO getConnectionListDTO) {
- return connectionDataService.getConnectionToFrontByCluster(ConnectionControllerMapper.INSTANCE.queryEntityByConnection(getConnectionListDTO));
+ return connectionDataService.getConnectionToFrontByCluster(getConnectionListDTO.getClusterId(), getConnectionListDTO);
}
- @GetMapping("/getConnectorDetail")
+ @GetMapping("/cluster/connection/getConnectorDetail")
public ConnectorEntity getConnectorDetail(Long connectorId) {
return connectionDataService.getConnectorById(connectorId);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/MetricsController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/MetricsController.java
index bedbbdd..2bdc6fe 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/MetricsController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/MetricsController.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.controller;
-import org.apache.eventmesh.dashboard.common.dto.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.druid.stat.DruidStatManagerFacade;
+import com.alibaba.nacos.api.model.v2.Result;
@RestController
public class MetricsController {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/SubscriptionController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/SubscriptionController.java
deleted file mode 100644
index 871e0c5..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/SubscriptionController.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.controller;
-
-import org.apache.eventmesh.dashboard.common.dto.Result;
-import org.apache.eventmesh.dashboard.common.model.SubscriptionInfo;
-import org.apache.eventmesh.dashboard.service.meta.SubscriptionCore;
-
-import java.util.List;
-
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequestMapping("/api/v1")
-public class SubscriptionController {
-
- // the subscription dataId naming pattern of EventMesh clients: ip-protocol
- private static final String CLIENT_DATA_ID_PATTERN = "*.*.*.*-*";
- /**
- * TODO expose implement by FunctionManager
- */
- SubscriptionCore subscriptionCore;
-
- /**
- * Retrieve the config content of a specified config.
- *
- * @param dataId nacos config data id (Exact Matching)
- * @param group config group (Exact Matching)
- * @return config content
- */
- @GetMapping("/subscription")
- public Result<String> retrieveSubscription(@RequestParam("dataId") String dataId, @RequestParam("group") String group) {
- return Result.success(subscriptionCore.retrieveConfig(dataId, group));
- }
-
- /**
- * Retrieve a list of configs.
- *
- * @param page page number
- * @param size page size
- * @param dataId nacos config data id (Fuzzy Matching)
- * @param group config group (Fuzzy Matching)
- * @return config properties and base64 encoded config content
- */
- @GetMapping("/subscriptions")
- public Result<List<SubscriptionInfo>> listSubscriptions(
- @RequestParam(name = "page", defaultValue = "1") Integer page,
- @RequestParam(name = "size", defaultValue = "10") Integer size,
- @RequestParam(name = "dataId", defaultValue = CLIENT_DATA_ID_PATTERN) String dataId,
- @RequestParam(name = "group", defaultValue = "") String group) {
- return Result.success(subscriptionCore.retrieveConfigs(page, size, dataId, group));
- }
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/AclController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/AclController.java
index e4947c3..a336969 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/AclController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/AclController.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.controller.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.AclEntity;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClientDataController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClientDataController.java
index 258496c..dbfe803 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClientDataController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClientDataController.java
@@ -15,12 +15,12 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.controller.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.ClientEntity;
-import org.apache.eventmesh.dashboard.console.mapstruct.cluster.ClientDataControllerMapper;
-import org.apache.eventmesh.dashboard.console.modle.cluster.client.SelectByClusterIdDTO;
+import org.apache.eventmesh.dashboard.console.modle.cluster.client.QueryClientByUserFormDTO;
import org.apache.eventmesh.dashboard.console.service.cluster.ClientDataService;
import java.util.List;
@@ -41,8 +41,8 @@
private ClientDataService clientDataService;
- @PostMapping("selectByClusterId")
- public List<ClientEntity> selectByClusterId(@RequestBody @Validated SelectByClusterIdDTO selectByClusterIdDTO) {
- return clientDataService.selectByClusterId(ClientDataControllerMapper.INSTANCE.selectByClusterIdDTO(selectByClusterIdDTO));
+ @PostMapping("queryClientByUserForm")
+ public List<ClientEntity> queryClientByUserForm(@RequestBody @Validated QueryClientByUserFormDTO queryClientByUserFormDTO) {
+ return clientDataService.queryClientByUserForm(queryClientByUserFormDTO);
}
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterController.java
index 863655b..416d613 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterController.java
@@ -15,14 +15,26 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.controller.cluster;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClientEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
import org.apache.eventmesh.dashboard.console.mapstruct.cluster.ClusterControllerMapper;
import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
-import org.apache.eventmesh.dashboard.console.modle.cluster.CreateClusterDTO;
+import org.apache.eventmesh.dashboard.console.modle.cluster.client.QueryClientByUserFormDTO;
+import org.apache.eventmesh.dashboard.console.modle.cluster.cluster.ClusterDetailsVO;
+import org.apache.eventmesh.dashboard.console.modle.cluster.cluster.QueryClusterByOrganizationIdAndTypeDTO;
+import org.apache.eventmesh.dashboard.console.modle.cluster.cluster.QueryRelationClusterByClusterIdAndTypeDTO;
+import org.apache.eventmesh.dashboard.console.modle.deploy.ClusterAllMetadataDO;
import org.apache.eventmesh.dashboard.console.modle.vo.cluster.GetClusterBaseMessageVO;
import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
+import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService;
+
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
@@ -32,72 +44,75 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-/**
- * 1. 用户首页列表
- * 2. 集群首页概要
- */
+
@RestController
-@RequestMapping("cluster")
+@RequestMapping("user/cluster")
public class ClusterController {
@Autowired
- ClusterService clusterService;
+ private ClusterService clusterService;
+
+ @Autowired
+ public RuntimeService runtimeService;
+
@GetMapping("queryHomeClusterData")
public GetClusterBaseMessageVO queryHomeClusterData(@RequestBody @Validated ClusterIdDTO clusterIdDTO) {
- return clusterService.selectClusterBaseMessage(clusterIdDTO.getClusterId());
+ return clusterService.getClusterBaseMessage(clusterIdDTO);
+ }
+
+ @PostMapping("queryClusterDetails")
+ public ClusterDetailsVO queryClusterDetails(@RequestBody @Validated ClusterIdDTO clusterIdDTO) {
+ ClusterEntity clusterEntity = new ClusterEntity();
+ // eventmesh 集群详情
+ // 基本统计信息
+ // 部署信息,巡查信息
+ // meta 列表, runtime 列表 存储列表
+ RuntimeEntity runtimeEntity = new RuntimeEntity();
+ runtimeEntity.setClusterId(clusterIdDTO.getClusterId());
+ CompletableFuture<ClusterAllMetadataDO> completableFuture =
+ CompletableFuture.supplyAsync(() -> this.runtimeService.queryAllByClusterId(runtimeEntity, true, false));
+
+ // 存储集群详情
+ // meta 集群详情
+ // runtime集群详情
+ ClusterDetailsVO clusterDetailsVO = new ClusterDetailsVO();
+ return clusterDetailsVO;
}
- @PostMapping("createCluster")
- public void createCluster(@RequestBody CreateClusterDTO createClusterDTO) {
- this.clusterService.createCluster(ClusterControllerMapper.INSTANCE.createCluster(createClusterDTO));
- }
-
- /**
- * 那些集群可以暂停。被依赖的集群不允许暂停。暂停的含义是什么 暂停是否释放资源
- *
- * @return
- */
- public Integer pauseCluster() {
- // 查询集群
-
- // 判断集群类型
-
- // 查询依赖
+ @PostMapping("queryClusterByUserForm")
+ public List<ClientEntity> queryClusterByUserForm(QueryClientByUserFormDTO queryClientByUserFormDTO) {
return null;
}
/**
- * 重新开始集群
+ * 这个接口用户 cluster 对应业务的 首页,方便查询
*
+ * @param dto
* @return
*/
- public Integer resumeCluster() {
- // 查询集群
+ @PostMapping("queryVisualizationClusterByOrganizationIdAndType")
+ public List<ClusterEntity> queryVisualizationClusterByOrganizationIdAndType(@RequestBody @Validated QueryClusterByOrganizationIdAndTypeDTO dto) {
+ return this.clusterService.queryClusterByOrganizationIdAndType(ClusterControllerMapper.INSTANCE.queryClusterByOrganizationIdAndType(dto));
+ }
- // 判断集群类型
-
- // 查询依赖
- return null;
+ @PostMapping("queryClusterByOrganizationIdAndType")
+ public List<ClusterEntity> queryClusterByOrganizationIdAndType(@RequestBody @Validated QueryClusterByOrganizationIdAndTypeDTO dto) {
+ return this.clusterService.queryClusterByOrganizationIdAndType(ClusterControllerMapper.INSTANCE.queryClusterByOrganizationIdAndType(dto));
}
/**
- * 注销集群
+ * 查询 cluster 的关联集群列表
*
+ * @param dto
* @return
*/
- public Integer cancelCluster() {
- // 查询集群
-
- // 判断集群类型
-
- // 查询依赖
-
- // 如果是全程托管,释放k8s 集群
- return null;
+ @PostMapping("queryRelationClusterByClusterIdAndType")
+ public List<ClusterEntity> queryRelationClusterByClusterIdAndType(@RequestBody @Validated QueryRelationClusterByClusterIdAndTypeDTO dto) {
+ return this.clusterService.queryRelationClusterByClusterIdAndType(
+ ClusterControllerMapper.INSTANCE.queryRelationClusterByClusterIdAndType(dto));
}
-
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterRelationshipController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterRelationshipController.java
index 9dba50f..20734eb 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterRelationshipController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterRelationshipController.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.controller.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterAndRelationshipEntity;
@@ -37,13 +38,14 @@
@Autowired
private ClusterRelationshipService clusterRelationshipService;
-
+ @Deprecated
@PostMapping("addClusterRelationshipEntry")
public void addClusterRelationshipEntry(@RequestBody ClusterRelationshipEntity clusterRelationshipEntity) {
- this.clusterRelationshipService.insertClusterRelationshipEntry(clusterRelationshipEntity);
+ this.clusterRelationshipService.addClusterRelationshipEntry(clusterRelationshipEntity);
}
+ @Deprecated
@PostMapping("relieveRelationship")
public Integer relieveRelationship(@RequestBody ClusterRelationshipEntity clusterRelationshipEntity) {
return this.clusterRelationshipService.relieveRelationship(clusterRelationshipEntity);
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/DetailsController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/DetailsController.java
new file mode 100644
index 0000000..ca84a3d
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/DetailsController.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.controller.cluster;
+
+import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
+
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/organization/")
+public class DetailsController {
+
+
+ @PostMapping("/details/eventMesh")
+ public void eventMeshDetails(ClusterIdDTO clusterIdDTO) {
+ // eventmesh 集群详情
+ // 基本统计信息
+ // 部署信息,巡查信息
+ // meta 列表, runtime 列表 存储列表
+ // 存储集群详情
+ // meta 集群详情
+ // runtime集群详情
+ }
+
+ @PostMapping("/details/meta")
+ public void metaDetails(ClusterIdDTO clusterIdDTO) {
+
+ }
+
+ @PostMapping("/details/storage")
+ public void storageDetails(ClusterIdDTO clusterIdDTO) {
+
+ }
+
+ @PostMapping("/details/storage/runtime")
+ public void storageRuntimeDetails(ClusterIdDTO clusterIdDTO) {
+
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/HomeController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/HomeController.java
new file mode 100644
index 0000000..11861dc
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/HomeController.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.controller.cluster;
+
+
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
+
+public class HomeController {
+
+
+ private ClusterService clusterService;
+
+
+
+ public void clusterHome(){
+ // 运维事件
+
+ // runtime 集群 以及
+
+ // meta 集群 以及
+
+ // 存储集群
+
+ // kubernetes 列表。 本集群 没有或则资源不够,找上级集群。如果有多个上级
+
+ // 下面的是否需要展示
+ // client
+
+ // group 列表 topic 列表。是否需要在 home 展示
+
+ // 连接
+ }
+
+ public void runtimeHome(){
+ // 在哪个 cluster
+
+ // 在哪一个 kubernetes
+
+ // message 统计
+
+ // in out 统计
+
+ // topic 统计数据
+
+ // group 统计数据
+
+ // client 统计数据
+
+ // 连接 统计数据
+
+ // 实例资源统计数据
+ }
+
+
+ public void groupHome(){
+ // cluster
+
+ // topic
+
+ // client
+
+ //
+ }
+
+ public void topicHome(){
+
+ }
+
+ public void clientHome(){
+
+ }
+
+
+ public void userHome(){
+
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/InstanceUserController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/InstanceUserController.java
deleted file mode 100644
index e95208e..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/InstanceUserController.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.controller.cluster;
-
-import org.apache.eventmesh.dashboard.console.entity.cluster.InstanceUserEntity;
-import org.apache.eventmesh.dashboard.console.service.cluster.InstanceUserService;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequestMapping("/instanceUser")
-public class InstanceUserController {
-
- @Autowired
- private InstanceUserService instanceUserService;
-
- @PostMapping("/insertInstanceUser")
- public void insertInstanceUser(@RequestBody InstanceUserEntity instanceUserEntity) {
- this.instanceUserService.insert(instanceUserEntity);
- }
-
- @PostMapping("/deleteInstanceUserByCluster")
- public void deleteInstanceUserByCluster(@RequestBody InstanceUserEntity instanceUserEntity) {
- this.instanceUserService.deleteInstanceUserByCluster(instanceUserEntity);
- }
-
- @PostMapping("/updateNameById")
- public void updateNameById(@RequestBody InstanceUserEntity instanceUserEntity) {
- this.instanceUserService.updatePasswordById(instanceUserEntity);
- }
-
- @PostMapping("/selectAll")
- public void selectAll() {
-
- }
-
- @PostMapping("/selectById")
- public void selectById(@RequestBody InstanceUserEntity instanceUserEntity) {
- this.instanceUserService.selectById(instanceUserEntity);
- }
-
- @PostMapping("/selectByName")
- public void selectByName(@RequestBody InstanceUserEntity instanceUserEntity) {
- this.instanceUserService.selectByName(instanceUserEntity);
- }
-
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/NetConnectionController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/NetConnectionController.java
index 38d3fe5..552d39c 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/NetConnectionController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/NetConnectionController.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.controller.cluster;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/RuntimeController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/RuntimeController.java
index fe6647d..6f7ba10 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/RuntimeController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/RuntimeController.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.controller.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
@@ -44,7 +45,7 @@
@PostMapping("/queryRuntimeListByClusterId")
public List<RuntimeEntity> queryRuntimeListByClusterId(@Validated @RequestBody ClusterIdDTO clusterIdDTO) {
List<RuntimeEntity> runtimeEntityList =
- runtimeService.selectRuntimeToFrontByClusterId(RuntimeControllerMapper.INSTANCE.queryRuntimeListByClusterId(clusterIdDTO));
+ runtimeService.queryRuntimeToFrontByClusterId(RuntimeControllerMapper.INSTANCE.queryRuntimeListByClusterId(clusterIdDTO));
runtimeEntityList.forEach(n -> {
n.setStatus(CheckResultCache.getINSTANCE().getLastHealthyCheckResult("runtime", n.getId()));
});
@@ -57,53 +58,5 @@
return this.runtimeService.queryRuntimeEntityById(RuntimeControllerMapper.INSTANCE.queryRuntimeListById(idDTO));
}
- @PostMapping("/createRuntime")
- public void crateRuntime(@Validated @RequestBody RuntimeEntity runtimeEntity) {
- runtimeService.insertRuntime(runtimeEntity);
- }
-
- /**
- * 那些集群可以暂停。被依赖的集群不允许暂停。暂停的含义是什么
- * 暂停是否释放资源
- * @return
- */
- public Integer pauseCluster() {
- // 查询集群
-
- // 判断集群类型
-
- // 查询依赖
- return null;
- }
-
- /**
- * 重新开始集群
- * @return
- */
- public Integer resumeCluster() {
- // 查询集群
-
- // 判断集群类型
-
- // 查询依赖
- return null;
- }
-
- /**
- * 注销集群
- * @return
- */
- public Integer cancelCluster() {
- // 查询集群
-
- // 判断集群类型
-
- // 查询依赖
-
- // 如果是全程托管,释放k8s 集群
- return null;
- }
-
-
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/CaseController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/CaseController.java
new file mode 100644
index 0000000..14b2818
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/CaseController.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.controller.deploy;
+
+
+import org.apache.eventmesh.dashboard.console.entity.cases.CaseEntity;
+import org.apache.eventmesh.dashboard.console.mapstruct.deploy.CaseControllerMapper;
+import org.apache.eventmesh.dashboard.console.modle.IdDTO;
+import org.apache.eventmesh.dashboard.console.modle.deploy.cases.QueryCaseByObjectTypeDTO;
+
+import java.util.List;
+
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("case")
+public class CaseController {
+
+
+ public List<CaseEntity> queryCaseByObjectType(@RequestBody QueryCaseByObjectTypeDTO queryCaseByObjectTypeDTO) {
+ CaseControllerMapper.INSTANCE.queryCaseByObjectType(queryCaseByObjectTypeDTO);
+ return null;
+ }
+
+ public Integer deleteCase(@RequestBody IdDTO idDTO) {
+ return 0;
+ }
+
+ public List<CaseEntity> queryCaseByOrganization() {
+ return null;
+ }
+
+
+ public void backups(){
+
+ }
+
+ public void createCase(@RequestBody CaseEntity caseEntity) {
+ // 新增,状态进行中信
+
+ try {
+ // clone object 数据
+
+ // 标记成功
+ } catch (Exception e) {
+ // 回滚 标记失败
+ throw new RuntimeException(e);
+ }
+
+
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/ClusterCycleController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/ClusterCycleController.java
new file mode 100644
index 0000000..c805861
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/ClusterCycleController.java
@@ -0,0 +1,192 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.controller.deploy;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterOwnType;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType.FirstToWhom;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.DeployStatusType;
+import org.apache.eventmesh.dashboard.console.controller.deploy.create.CreateClusterByDeployScriptHandler;
+import org.apache.eventmesh.dashboard.console.controller.deploy.create.CreateRuntimeByDeployScriptHandler;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.mapstruct.deploy.ClusterCycleControllerMapper;
+import org.apache.eventmesh.dashboard.console.modle.cluster.VerifyNameDTO;
+import org.apache.eventmesh.dashboard.console.modle.deploy.create.CreateClusterByDeployScriptDO;
+import org.apache.eventmesh.dashboard.console.modle.deploy.create.CreateClusterByEventMesh;
+import org.apache.eventmesh.dashboard.console.modle.deploy.create.CreateRuntimeByDeployScriptDTO;
+import org.apache.eventmesh.dashboard.console.modle.deploy.create.CreateRuntimeByOnlyDataDO;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
+import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * 1. 用户首页列表
+ * <p>
+ * 2. 集群首页概要 kubernetes 集群在 eventmesh 集群里面创建的 只属于这个集群 kubernetes在创建的时候可以设为独立集群 如果创建集群
+ * <p>
+ * 1. 全托管创建 因为全托管创建,不需要用户管理任何东西。
+ * <p>
+ * 2. 全托管共享集群 创建时绑定集群流程
+ * <p>
+ * 1.创建 kubernetes 集群
+ * <p>
+ * 2. 创建 storage 集群
+ * <p>
+ * 3. 创建 meta 集群
+ * <p>
+ * 4. 创建 runtime 集群
+ * <p>
+ * 5. 创建时 进行绑定 3. 已经 deploy config 创建,比较麻烦。这种 kubernetes 资源不会共享
+ * <p>
+ * 1. 提供 kubernetes集群配置,多个
+ * <p>
+ * 2. 选择 storage deploy config or storage id or name
+ * <p>
+ * 3. 选择 meta deploy config or meta id or name
+ * <p>
+ * 4. 选择 runtime deploy config or runtime idor name
+ * <p>
+ * 5. 点击 创建,提供部署流程 4. 先创建,后绑定
+ * <p>
+ * 1. 直接创建
+ * <p>
+ * 2. 在内部进行绑定 5. 配置一个kubernetes集群,可以定时校验 deploy config 的效果。校验的目的是什么 创建节点的时候,先看自己生是否有 kubernetes。 然后检查上级cluster 是否有 可用的 kubernetes
+ */
+@RestController
+@RequestMapping("organization/clusterCycleDeploy")
+public class ClusterCycleController {
+
+ @Autowired
+ private RuntimeService runtimeService;
+
+ @Autowired
+ private ClusterService clusterService;
+
+ @Autowired
+ private CreateRuntimeByDeployScriptHandler createRuntimeByDeployScriptHandler;
+
+
+ @Autowired
+ private CreateClusterByDeployScriptHandler createClusterByDeployScriptHandler;
+
+
+ /**
+ * @param verifyNameDTO
+ * @return
+ */
+ public String verifyName(VerifyNameDTO verifyNameDTO) {
+
+ return "";
+ }
+
+ @PostMapping("createRuntimeByOnlyDataHandler")
+ public void createRuntimeByOnlyDataHandler(@RequestBody @Validated CreateRuntimeByOnlyDataDO createRuntimeByOnlyDataDO) {
+ RuntimeEntity runtimeEntity = ClusterCycleControllerMapper.INSTANCE.createRuntimeByOnlyDataHandler(createRuntimeByOnlyDataDO);
+ runtimeService.insertRuntime(runtimeEntity);
+ }
+
+ @PostMapping("createRuntimeByDeployScript")
+ public void createRuntimeByDeployScript(@RequestBody @Validated CreateRuntimeByDeployScriptDTO createRuntimeByDeployScriptDTO) {
+ this.createRuntimeByDeployScriptHandler.handler(createRuntimeByDeployScriptDTO);
+ }
+
+ @PostMapping("createClusterByDeployScript")
+ public void createClusterByDeployScript(@RequestBody @Validated CreateClusterByDeployScriptDO createClusterByDeployScriptDO) {
+ this.createClusterByDeployScriptHandler.handler(createClusterByDeployScriptDO);
+ }
+
+ /**
+ * 分 eventmesh 集群创建
+ *
+ * @param createClusterByEventMesh
+ */
+ @PostMapping("createEventMeshClusterByOnlyData")
+ public Long createEventMeshClusterByOnlyData(@RequestBody @Validated CreateClusterByEventMesh createClusterByEventMesh) {
+ ClusterEntity clusterEntity = ClusterCycleControllerMapper.INSTANCE.createClusterByEventMesh(createClusterByEventMesh);
+ clusterEntity.setClusterType(ClusterType.EVENTMESH_CLUSTER);
+ clusterEntity.setClusterOwnType(ClusterOwnType.NOT);
+ clusterEntity.setAuthType("");
+ clusterEntity.setVersion("");
+ clusterEntity.setRuntimeIndex(0);
+ clusterEntity.setTrusteeshipType(ClusterTrusteeshipType.NOT);
+ clusterEntity.setFirstToWhom(FirstToWhom.NOT);
+ clusterEntity.setDeployStatusType(DeployStatusType.CREATE_SUCCESS);
+ clusterEntity.setResourcesConfigId(0L);
+ clusterEntity.setDeployScriptId(0L);
+ clusterEntity.setDeployScriptName("");
+ clusterEntity.setDeployScriptVersion("");
+ clusterService.insertCluster(clusterEntity);
+ return clusterEntity.getId();
+ }
+
+ @PostMapping("createClusterByEventMesh")
+ public Long createClusterByEventMesh(@RequestBody @Validated CreateClusterByEventMesh createClusterByEventMesh) {
+ ClusterEntity clusterEntity = ClusterCycleControllerMapper.INSTANCE.createClusterByEventMesh(createClusterByEventMesh);
+ clusterEntity.setClusterType(ClusterType.EVENTMESH_CLUSTER);
+ clusterEntity.setClusterOwnType(ClusterOwnType.INDEPENDENCE);
+ clusterEntity.setAuthType("");
+ clusterEntity.setVersion("");
+ clusterEntity.setRuntimeIndex(0);
+ clusterEntity.setDeployStatusType(DeployStatusType.CREATE_SUCCESS);
+ clusterEntity.setResourcesConfigId(0L);
+ clusterEntity.setDeployScriptId(0L);
+ clusterEntity.setDeployScriptName("");
+ clusterEntity.setDeployScriptVersion("");
+ ClusterRelationshipEntity relationshipEntity = new ClusterRelationshipEntity();
+ clusterService.insertClusterAndRelationship(clusterEntity, relationshipEntity);
+ return clusterEntity.getId();
+
+ }
+
+
+ @PostMapping("pauseCluster")
+ public void pauseCluster(@RequestBody @Validated CreateClusterByEventMesh createClusterByEventMesh) {
+ }
+
+ @PostMapping("pauseRuntime")
+ public void pauseRuntime(@RequestBody @Validated CreateClusterByEventMesh createClusterByEventMesh) {
+ }
+
+ @PostMapping("relationship")
+ public void relationship(@RequestBody @Validated CreateClusterByEventMesh createClusterByEventMesh) {
+ }
+
+ @PostMapping("unrelationship")
+ public void unrelationship(@RequestBody @Validated CreateClusterByEventMesh createClusterByEventMesh) {
+ }
+
+ @PostMapping("uninstallCluster")
+ public void uninstallCluster(@RequestBody @Validated CreateClusterByEventMesh createClusterByEventMesh) {
+ }
+
+ @PostMapping("uninstallRuntime")
+ public void uninstallRuntime(@RequestBody @Validated CreateClusterByEventMesh createClusterByEventMesh) {
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/CreateCycleService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/CreateCycleService.java
new file mode 100644
index 0000000..6345dc8
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/CreateCycleService.java
@@ -0,0 +1,272 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.controller.deploy;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterFramework;
+import org.apache.eventmesh.dashboard.common.enums.ClusterSyncMetadataEnum;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType.FirstToWhom;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.ReplicationType;
+import org.apache.eventmesh.dashboard.common.enums.SyncErrorType;
+import org.apache.eventmesh.dashboard.console.domain.metadata.ClusterMetadataDomain;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.mapstruct.cluster.ClusterControllerMapper;
+import org.apache.eventmesh.dashboard.console.modle.cluster.CreateClusterByCompleteDataDTO;
+import org.apache.eventmesh.dashboard.console.modle.cluster.CreateClusterBySimpleDataDTO;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterRelationshipService;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
+import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService;
+import org.apache.eventmesh.dashboard.console.service.connector.ResourcesConfigService;
+import org.apache.eventmesh.dashboard.console.service.deploy.DeployScriptService;
+import org.apache.eventmesh.dashboard.console.service.function.ConfigService;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+@Component
+@Slf4j
+public class CreateCycleService {
+
+ @Autowired
+ private ConfigService configService;
+
+ @Autowired
+ private ClusterService clusterService;
+
+ @Autowired
+ private RuntimeService runtimeService;
+
+ @Autowired
+ private ClusterRelationshipService clusterRelationshipService;
+
+ @Autowired
+ private ResourcesConfigService resourcesConfigService;
+
+ @Autowired
+ private DeployScriptService deployScriptService;
+
+
+ @Autowired
+ private ClusterMetadataDomain clusterMetadataDomain;
+
+ private ClusterEntity clusterEntity;
+
+
+ private void verifyName() {
+ if (!this.clusterService.nameExist(this.clusterEntity)) {
+ //
+ }
+ }
+
+ private void createDevOps() {
+
+ }
+
+ private void createCLusterEntity() {
+
+ }
+
+ private void createRuntimeEntity() {
+
+ }
+
+ private void createRuntimeConfig() {
+
+ }
+
+ private void persistenceData() {
+
+ }
+
+ private void lockPost() {
+ // 获得端口
+
+ //
+ }
+
+ private void checkResource() {
+
+ }
+
+ private void lockResource() {
+
+ }
+
+
+ private void createInstance() {
+ // 然后通知,检查
+ }
+
+
+ private void createCluster(Long configGatherId) {
+ this.verifyName();
+ this.clusterService.createCluster(clusterEntity);
+ if (Objects.nonNull(configGatherId)) {
+ this.configService.copyConfig(configGatherId, clusterEntity.getId());
+ }
+ }
+
+ public ClusterEntity createClusterBySimpleData(CreateClusterBySimpleDataDTO createClusterBySimpleDataDTO) {
+ clusterEntity = ClusterControllerMapper.INSTANCE.createCluster(createClusterBySimpleDataDTO);
+ this.createCluster(createClusterBySimpleDataDTO.getConfigGatherId());
+ return clusterEntity;
+ }
+
+ public void createClusterByCompleteData(CreateClusterByCompleteDataDTO createClusterByCompleteDataDTO) {
+ // 对进群进行判断,kafka broker 集群,只能有一个
+ // eventmesh 集群,目前只支持一个 meta, 一个runtime, 一个存储。
+
+ // 创建 部署流程
+ // 集群名字是否存在
+ ClusterEntity clusterEntity = this.createClusterBySimpleData(createClusterByCompleteDataDTO);
+ ClusterFramework clusterFramework = ClusterSyncMetadataEnum.getClusterFramework(createClusterByCompleteDataDTO.getClusterType());
+ if (clusterFramework.isMainSlave()) {
+ this.createMainSlave(createClusterByCompleteDataDTO);
+ } else {
+ this.createNotMainSlave(createClusterByCompleteDataDTO);
+ }
+ }
+
+ public void createClusterByConfigData(CreateClusterBySimpleDataDTO createClusterBySimpleDataDTO) {
+ // 创建 部署流程
+ // 集群名字是否存在
+ // 创建 config 里面所有数据
+ // 检查资源
+ // 锁定资源
+ // 锁定 端口
+ // 组个调用 kubernetes 创建资源
+ // 检查
+ // 失败,释放资源,端口,删除 kubernetes内容
+ }
+
+ private void createNotMainSlave(CreateClusterByCompleteDataDTO createClusterByCompleteDataDTO) {
+ ClusterEntity clusterEntity = this.createClusterBySimpleData(createClusterByCompleteDataDTO);
+ List<RuntimeEntity> runtimeEntityList = new ArrayList<>();
+ for (int i = 0; i < createClusterByCompleteDataDTO.getCreateNum(); i++) {
+ RuntimeEntity runtimeEntity = new RuntimeEntity();
+ runtimeEntity.setClusterId(clusterEntity.getId());
+ runtimeEntity.setClusterType(clusterEntity.getClusterType());
+ runtimeEntity.setTrusteeshipType(ClusterTrusteeshipType.SELF);
+ runtimeEntity.setFirstToWhom(clusterEntity.getFirstToWhom());
+ runtimeEntity.setFirstSyncState(clusterEntity.getFirstSyncState());
+ runtimeEntity.setSyncErrorType(clusterEntity.getSyncErrorType());
+ runtimeEntity.setReplicationType(ReplicationType.NOT);
+ runtimeEntityList.add(runtimeEntity);
+ }
+ }
+
+ public void createMainSlave(CreateClusterByCompleteDataDTO createClusterByCompleteDataDTO) {
+ List<ClusterEntity> clusterEntityList = new ArrayList<>();
+ for (int i = 0; i < createClusterByCompleteDataDTO.getCreateNum(); i++) {
+ ClusterEntity newCluster = ClusterControllerMapper.INSTANCE.createCluster(createClusterByCompleteDataDTO);
+ newCluster.setTrusteeshipType(ClusterTrusteeshipType.SELF);
+ newCluster.setFirstToWhom(FirstToWhom.COMPLETE);
+ newCluster.setFirstSyncState(FirstToWhom.COMPLETE);
+ newCluster.setSyncErrorType(SyncErrorType.NOT);
+ newCluster.setReplicationType(ReplicationType.NOT);
+ clusterEntityList.add(newCluster);
+ }
+ List<RuntimeEntity> runtimeEntityList = new ArrayList<>();
+ clusterEntityList.forEach(entity -> {
+ RuntimeEntity runtimeEntity = new RuntimeEntity();
+ runtimeEntity.setClusterId(entity.getId());
+ runtimeEntity.setClusterType(entity.getClusterType());
+ runtimeEntity.setTrusteeshipType(ClusterTrusteeshipType.SELF);
+ runtimeEntity.setFirstToWhom(entity.getFirstToWhom());
+ runtimeEntity.setFirstSyncState(entity.getFirstSyncState());
+ runtimeEntity.setSyncErrorType(entity.getSyncErrorType());
+ runtimeEntity.setReplicationType(ReplicationType.MAIN);
+
+ runtimeEntityList.add(runtimeEntity);
+ if (Objects.equals(createClusterByCompleteDataDTO.getReplicationType(), ReplicationType.MAIN_SLAVE)) {
+ runtimeEntity = new RuntimeEntity();
+ runtimeEntity.setClusterId(entity.getId());
+ runtimeEntity.setClusterType(entity.getClusterType());
+ runtimeEntity.setTrusteeshipType(entity.getTrusteeshipType());
+ runtimeEntity.setFirstToWhom(entity.getFirstToWhom());
+ runtimeEntity.setFirstSyncState(entity.getFirstSyncState());
+ runtimeEntity.setSyncErrorType(entity.getSyncErrorType());
+ runtimeEntity.setReplicationType(ReplicationType.SLAVE);
+ runtimeEntityList.add(runtimeEntity);
+ }
+ });
+ runtimeEntityList.forEach(entity -> {
+ ClusterType clusterType = entity.getClusterType();
+ Map<String, Object> portMap = new HashMap<>();
+
+ portMap.forEach((key, value) -> {
+
+ });
+ });
+
+
+ }
+
+ public void registerRuntime(RuntimeEntity runtimeEntity) {
+ this.runtimeService.insertRuntime(runtimeEntity);
+ }
+
+ public void createRuntime() {
+ // 创建 部署流程
+
+ // 创建 runtime
+
+ // 判断是否 有模板
+
+ // 获得 cluster 默认模板
+
+ // 创建 config 里面所有数据
+ // 持久化数据
+ // 检查资源
+ // 锁定资源
+ // 需要一个被 console 管理的端口,所以要 锁定 端口
+ //
+ }
+
+
+ // TODO 添加修改绑定解绑 meta 集群,都需要 所有的 runtime集群。是通过事件方式处理还是立即处理?
+ // IP 管理
+ // 配置写入,
+ // 可动态修改配置(可以在线修改),
+ // 不可能动态修改配置,修改 yaml 重新启动容器,是否支持灰度修改
+ // 配置末班, a 配置 1, 变成2
+ // meta deployment
+ // 存储 StatefulSet 暴露端口 hostIP
+ // 是否直接暴露端口, 是否使用 service。 每次只能穿件一个 实例
+ // 1. jmx
+ // 2. nameservice 负载不太均匀问题
+ // 3. eventmesh runtime admin
+ // broker + queue
+ // 磁盘,
+
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/ResourcesConfigController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/ResourcesConfigController.java
new file mode 100644
index 0000000..5fd7996
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/ResourcesConfigController.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.controller.deploy;
+
+import org.apache.eventmesh.dashboard.console.entity.cases.ResourcesConfigEntity;
+import org.apache.eventmesh.dashboard.console.mapstruct.deploy.ResourceConfigControllerMapper;
+import org.apache.eventmesh.dashboard.console.modle.IdDTO;
+import org.apache.eventmesh.dashboard.console.modle.OrganizationIdDTO;
+import org.apache.eventmesh.dashboard.console.modle.deploy.resouce.QueryResourceByObjectTypeDTO;
+
+import java.util.List;
+
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("resourcesConfig")
+public class ResourcesConfigController {
+
+
+ public List<ResourcesConfigEntity> queryResourcesConfigByObjectType(
+ @RequestBody QueryResourceByObjectTypeDTO queryResourcesConfigByObjectTypeDTO) {
+ ResourcesConfigEntity resourcesConfigEntity =
+ ResourceConfigControllerMapper.INSTANCE.queryResourcesConfigByObjectType(queryResourcesConfigByObjectTypeDTO);
+ return null;
+ }
+
+ public Integer deleteResourcesConfig(@RequestBody IdDTO idDTO) {
+ // 作废之前检查,是否使用过
+ return 0;
+ }
+
+ public List<ResourcesConfigEntity> queryResourcesConfigByOrganization(OrganizationIdDTO organizationIdDTO) {
+ return null;
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/create/CreateClusterByDeployScriptHandler.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/create/CreateClusterByDeployScriptHandler.java
new file mode 100644
index 0000000..95ef6d0
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/create/CreateClusterByDeployScriptHandler.java
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.controller.deploy.create;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterFramework;
+import org.apache.eventmesh.dashboard.common.enums.ClusterSyncMetadataEnum;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType.FirstToWhom;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.DeployStatusType;
+import org.apache.eventmesh.dashboard.common.enums.ReplicationType;
+import org.apache.eventmesh.dashboard.console.controller.deploy.handler.UpdateHandler;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.mapstruct.deploy.ClusterCycleControllerMapper;
+import org.apache.eventmesh.dashboard.console.modle.deploy.create.CreateClusterByDeployScriptDO;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterRelationshipService;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
+import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService;
+import org.apache.eventmesh.dashboard.console.service.function.ConfigService;
+
+import java.util.ArrayList;
+import java.util.Deque;
+import java.util.List;
+import java.util.Objects;
+
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+
+@Component
+@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+public class CreateClusterByDeployScriptHandler implements UpdateHandler<CreateClusterByDeployScriptDO> {
+
+ private ClusterService clusterService;
+
+ private ConfigService configService;
+
+ private RuntimeService runtimeService;
+
+ private ClusterRelationshipService clusterRelationshipService;
+
+ private ClusterEntity clusterEntity;
+
+ private ClusterFramework clusterFramework;
+
+ private ClusterType clusterType;
+
+ private ReplicationType replicationType;
+
+
+ private final List<RuntimeEntity> runtimeEntityList = new ArrayList<>();
+
+ @Override
+ public void init() {
+
+ }
+
+ private void handlerMetadata(ClusterEntity clusterEntity) {
+ this.clusterType = clusterEntity.getClusterType();
+ this.replicationType = clusterEntity.getReplicationType();
+ this.clusterFramework = ClusterSyncMetadataEnum.getClusterFramework(clusterEntity.getClusterType());
+ }
+
+ @Override
+ public void handler(CreateClusterByDeployScriptDO createClusterByDeployScriptDO) {
+ this.clusterEntity = ClusterCycleControllerMapper.INSTANCE.createClusterByDeployScript(createClusterByDeployScriptDO);
+
+ this.clusterService.insertCluster(this.clusterEntity);
+ this.handlerMetadata(this.clusterEntity);
+ if (Objects.nonNull(createClusterByDeployScriptDO.getConfigGatherId())) {
+ configService.copyConfig(createClusterByDeployScriptDO.getConfigGatherId(), this.clusterEntity.getId());
+ }
+ if (this.clusterFramework.isMainSlave()) {
+ this.mainSlaveHandler(createClusterByDeployScriptDO, this.clusterEntity);
+ } else {
+ this.ordinaryRuntime(createClusterByDeployScriptDO);
+ }
+
+ this.runtimeService.batchInsert(this.runtimeEntityList);
+ }
+
+ private void ordinaryRuntime(CreateClusterByDeployScriptDO createClusterByDeployScriptDO) {
+ Deque<Integer> linkedList = null;
+ if (this.clusterType.isStorage()) {
+ clusterEntity.setRuntimeIndex(createClusterByDeployScriptDO.getCreateNum());
+ linkedList = this.clusterService.getIndex(this.clusterEntity);
+ }
+ for (int i = 0; i < createClusterByDeployScriptDO.getCreateNum(); i++) {
+ this.createRuntimeEntity(this.clusterEntity, replicationType,
+ Objects.isNull(linkedList) ? Integer.valueOf(0) : linkedList.pop());
+ }
+ }
+
+ private void mainSlaveHandler(CreateClusterByDeployScriptDO createClusterByDeployScriptDO, ClusterEntity clusterEntity) {
+ List<ClusterEntity> clusterEntityList = new ArrayList<>();
+ for (int i = 0; i < createClusterByDeployScriptDO.getCreateNum(); i++) {
+ ClusterEntity newClusterEntity = ClusterCycleControllerMapper.INSTANCE.createClusterByDeployScript(createClusterByDeployScriptDO);
+ clusterEntityList.add(newClusterEntity);
+ }
+ this.clusterService.batchInsert(clusterEntityList, clusterEntity);
+ clusterEntityList.forEach(entity -> {
+ this.createRuntimeEntity(clusterEntity, ReplicationType.MAIN, 0);
+ if (createClusterByDeployScriptDO.getReplicationType().isMainSlave()) {
+ this.createRuntimeEntity(clusterEntity, ReplicationType.SLAVE, 1);
+ }
+ });
+ }
+
+ private void createRuntimeEntity(ClusterEntity clusterEntity, ReplicationType replicationType, int index) {
+ RuntimeEntity runtimeEntity = new RuntimeEntity();
+ runtimeEntity.setClusterId(clusterEntity.getClusterId());
+ runtimeEntity.setClusterType(clusterEntity.getClusterType());
+ runtimeEntity.setDeployScriptId(clusterEntity.getDeployScriptId());
+ runtimeEntity.setResourcesConfigId(clusterEntity.getResourcesConfigId());
+ runtimeEntity.setFirstToWhom(FirstToWhom.NOT);
+ runtimeEntity.setTrusteeshipType(ClusterTrusteeshipType.SELF);
+ runtimeEntity.setName(clusterEntity.getName() + "_" + index);
+ runtimeEntity.setHost("127.0.0.1");
+ runtimeEntity.setPort(8080);
+ runtimeEntity.setReplicationType(replicationType);
+ runtimeEntity.setRuntimeIndex(index);
+ runtimeEntity.setDeployStatusType(DeployStatusType.CREATE_FULL_WAIT);
+ this.runtimeEntityList.add(runtimeEntity);
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/create/CreateRuntimeByDeployScriptHandler.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/create/CreateRuntimeByDeployScriptHandler.java
new file mode 100644
index 0000000..f069152
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/create/CreateRuntimeByDeployScriptHandler.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.controller.deploy.create;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+import org.apache.eventmesh.dashboard.common.enums.DeployStatusType;
+import org.apache.eventmesh.dashboard.common.enums.ReplicationType;
+import org.apache.eventmesh.dashboard.console.controller.deploy.handler.UpdateHandler;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.mapstruct.cluster.ClusterControllerMapper;
+import org.apache.eventmesh.dashboard.console.mapstruct.deploy.ClusterCycleControllerMapper;
+import org.apache.eventmesh.dashboard.console.modle.deploy.create.CreateRuntimeByDeployScriptDTO;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
+import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService;
+
+import java.util.ArrayDeque;
+import java.util.Deque;
+import java.util.Objects;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+@Component
+@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+public class CreateRuntimeByDeployScriptHandler implements UpdateHandler<CreateRuntimeByDeployScriptDTO> {
+
+
+ @Autowired
+ private ClusterService clusterService;
+
+ @Autowired
+ private RuntimeService runtimeService;
+
+ @Override
+ public void init() {
+
+ }
+
+ @Override
+ public void handler(CreateRuntimeByDeployScriptDTO createRuntimeByDeployScriptDTO) {
+ ClusterEntity clusterEntity = ClusterControllerMapper.INSTANCE.toClusterEntity(createRuntimeByDeployScriptDTO);
+ clusterEntity = this.clusterService.queryClusterById(clusterEntity);
+ RuntimeEntity runtimeEntity = ClusterCycleControllerMapper.INSTANCE.createRuntimeByDeployScript(createRuntimeByDeployScriptDTO);
+ if (Objects.isNull(runtimeEntity.getDeployScriptId()) && Objects.isNull(clusterEntity.getDeployScriptId())) {
+ return;
+ }
+
+ if (Objects.isNull(runtimeEntity.getResourcesConfigId()) && Objects.isNull(clusterEntity.getResourcesConfigId())) {
+ return;
+ }
+ if (Objects.nonNull(runtimeEntity.getDeployScriptId())) {
+ runtimeEntity.setDeployScriptId(createRuntimeByDeployScriptDTO.getDeployScriptId());
+ }
+
+ if (Objects.nonNull(runtimeEntity.getResourcesConfigId())) {
+ runtimeEntity.setResourcesConfigId(createRuntimeByDeployScriptDTO.getResourcesConfigId());
+ }
+ ReplicationType replicationType = createRuntimeByDeployScriptDTO.getReplicationType();
+ Deque<Integer> linkedList = new ArrayDeque<>();
+ if (!Objects.equals(replicationType, ReplicationType.SLAVE) && clusterEntity.getClusterType().isStorage()) {
+ clusterEntity.setRuntimeIndex(1);
+ linkedList = this.clusterService.getIndex(clusterEntity);
+ } else if (Objects.equals(replicationType, ReplicationType.SLAVE)) {
+ linkedList.add(1);
+ } else {
+ linkedList.add(0);
+ }
+
+ runtimeEntity.setClusterType(clusterEntity.getClusterType());
+ runtimeEntity.setTrusteeshipType(ClusterTrusteeshipType.SELF);
+ runtimeEntity.setReplicationType(replicationType);
+ runtimeEntity.setDeployStatusType(DeployStatusType.CREATE_WAIT);
+ runtimeEntity.setRuntimeIndex(linkedList.poll());
+ this.runtimeService.insertRuntime(runtimeEntity);
+
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/design.md b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/design.md
new file mode 100644
index 0000000..33a7903
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/design.md
@@ -0,0 +1,157 @@
+
+##
+1. 存储 remote 服务
+ 1. topic 创建在 cluster main runtime
+2. message
+ 1. 发送
+ 2. 查看消息
+ 3. 发布订阅
+ 4. console -> 抽象层 -> broker
+ 5. rocketmq 4.0 push(pull) 5.0 pull
+3. offset
+4. k8s
+ 1. 集群
+ 2. 创建
+ 3.
+ 2. 节点
+ 3. 创建
+ 4. 停用
+ 5. 删除
+ 2. console , docker 执行脚本
+ 2. console 与 操作分开
+ 3. 6c 16G
+ 4. eventmesh
+ 5. kafka
+ 1. 取舍问题
+ 6. rocketmq
+ 1. 简单
+ 2. 不做难得
+ 3. 两个集群
+ 1. 单节点
+ 2. 一主已从
+ 7. pulsuer
+ 1. 我有
+5. 数据采集快
+ 1. 存储已经支持的采集
+ 2. RocketMQ 实现
+6. 前端
+7. 认证与权限,介入
+ 1. rocketmq 的插件
+ 2. acl -> console 同步
+ 2. kafka 的 插件
+ 3. 修改
+8. 一键部署
+9. 巡检
+10. 告警
+
+
+## 部署业务模块
+>
+
+## 难点
+ 超级难点一:
+ 因消息中间件架构不一样,所以处理不一样。
+ Kafka是
+ 1. CAP 架构,操作一个节点就可以。
+ 2. 单注册中心,meta 集群决定 kafka 集群的 一致性架构
+ 3. 操作性行为
+ 4. 难点 复制:kafka 基于 topic 复制
+ RocketMQ 是
+ 1. 多子集群
+ 1. 子集群主从架构。且部分功能独立
+ 2. 有 raft 架构
+ 3. 难点 复制:RocketMQ 是 主从复制
+ 2. 多注册中心,使用 AP 架构。broker 集群架构由 broker 集群决定
+ pulsar(占时不支持) 是
+ 1. 多计算集群多存储集群的计算与存储分离架构
+ 2. 存储使用 BookKeeper,只能通过 pulsar broker 进行操作
+ 2. 多注册中心。meta 集群决定 pulsar 集群的 一致性架构
+ 3. 跨集群复制
+ 4. 难点 复制: 基于 BookKeeper 复制
+
+ 集群创建的时候,可以定义集群 一致性 架构
+ broker 集群决定一致性架构
+
+重置维度
+1. 最大
+2. 最小
+3. 指定 offset
+4. 指定 某个时间点
+PS: RocketMQ 的 queue 与 kafka 的 partition 是一个意思。
+超级难点一:
+ 因消息中间件架构不一样,所以处理不一样
+ kafka 的 offset 操作时 cluster行为
+ RocketMQ 操作时 broker 行为
+
+kafka 只需要 队列id 就行了
+ 1. 按照某个维度重置 topic 下面所有 队列
+ 2. 按照某个维度重置 topic 下某个队列
+RocketMQ 的重置场景
+ 1. 按照某个维度重置 topic 在集群里面所有的 队列
+ 2. 按照某个维度重置 topic 在集群里面某个主从节点的 队列
+ 3. 按照某个维度重置 topic 在集群里面所有的 下某个队列
+ 4. 按照某个维度重置 topic 在集群里面某个主从节点的 下某个队列
+ PS:以上 每次操作都需要同时操作主节点与从节点
+ 5. 按照某个维度重置 topic 在某个节点上的所有 队列
+ 6. 按照某个维度重置 topic 在某个节点上的所有 某个队列
+
+
+## 数据关联
+1. 所有对 eventmesh 的操作,需要再对应的存储集群进行操作
+2. 什么状态的集群进行操作【】。读取数据的时候,需要过滤掉,不正常得节点
+
+##
+
+## 数据创建
+1. 把导出的数据,导入
+ 1. 点击 eventmesh 集群导出 or 备份
+ 1. 如果 eventmesh 独立集群直接操作
+ 2. 不是,检查 依赖集群是否同时进行了备份
+ 1. 没有,提示某某集群
+ 2. 点击 runtime 集群
+ 3. 点击 meta 集群
+ 4. 点击 存储 集群
+ 1. 存储集群
+2. 直接点击 cluster 绑定
+ 1. 定时 保存 cluster 信息
+ 2. 绑定 集群架构
+ 1. eventmesh cluster
+ 1. meta cluster 列表
+ 1. runtime列表
+ 2. 一份 runtime config
+ 2. runtime cluster 列表
+ 1. runtime
+ 1. 每个 runtime config
+ 2. runtime 的 acl
+ 3. topic 列表
+ 4. group
+ 3. 存储 cluster 列表
+ 1. meta cluster 列表
+ 1. runtime列表
+ 2. 一份 runtime config
+ 2. runtime cluster 列表
+ 1. runtime
+ 1. 每个 runtime config
+ 2. user
+ 3. acl
+ 4. topic 列表
+ 5. group 列表
+ 2. 绑定 集群配置
+ 3. 绑定 runtime 配置
+ 4. 如果没有 resource 信息是不允许绑定的
+ 5. 是否可以绑定 topic信息
+ 6. 是否绑定 group 信息
+ 7. 是否绑定 acl 信息
+3. case 修改就是创建
+4. 在 runtime 点击编辑。TODO 不允许在在runtime编辑。
+ 1. 只能 添加 resource
+5. 在 deploy 模块,添加
+6. deploy
+ 1. 部署方案
+ 2. 资源配置
+ 3. 部署关系
+7. 部署信息
+ 1. 每个runtime 的部署 对应一个 资源信息
+ 2. cluster 第一次部署对应一个部署信息
+ 1. 这次
+8.
\ No newline at end of file
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/handler/UpdateHandler.java
similarity index 82%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/handler/UpdateHandler.java
index 82e6c7f..8d13773 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/handler/UpdateHandler.java
@@ -15,12 +15,16 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.console.controller.deploy.handler;
-@Data
-public class GlobalRequest {
+/**
+ *
+ */
+public interface UpdateHandler<T> {
- private Long clusterId;
+ void init();
+
+ void handler(T t);
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/pause/PauseCluster.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/pause/PauseCluster.java
new file mode 100644
index 0000000..cbcd273
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/pause/PauseCluster.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.controller.deploy.pause;
+
+import org.apache.eventmesh.dashboard.common.enums.DeployStatusType;
+import org.apache.eventmesh.dashboard.console.controller.deploy.handler.UpdateHandler;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterAndRelationshipEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.modle.deploy.ClusterAllMetadataDO;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterRelationshipService;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
+import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class PauseCluster implements UpdateHandler<ClusterEntity> {
+
+ @Autowired
+ private ClusterService clusterService;
+
+ @Autowired
+ private RuntimeService runtimeService;
+
+ @Autowired
+ private ClusterRelationshipService clusterRelationshipService;
+
+
+ private List<RuntimeEntity> selfRuntimeList = new ArrayList<>();
+
+ private List<RuntimeEntity> notSelfRuntimeList = new ArrayList<>();
+
+
+ @Override
+ public void init() {
+
+ }
+
+ /**
+ * 关系解除,如果
+ *
+ * @param clusterEntity
+ */
+ @Override
+ public void handler(ClusterEntity clusterEntity) {
+
+ clusterEntity = this.clusterService.queryClusterById(clusterEntity);
+
+ if (clusterEntity.getClusterType().isMeta()) {
+ // 检查 meta 集群 是否被关联,如何被关联,就禁止删除
+ ClusterRelationshipEntity clusterRelationshipEntity = new ClusterRelationshipEntity();
+ clusterRelationshipEntity.setClusterId(clusterEntity.getId());
+ List<ClusterAndRelationshipEntity> clusterRelationshipEntityList =
+ this.clusterRelationshipService.queryClusterAndRelationshipEntityListByClusterId(clusterRelationshipEntity);
+ if (!clusterRelationshipEntityList.isEmpty()) {
+ // 打印结果
+ return;
+ }
+ }
+
+ RuntimeEntity runtimeEntity = new RuntimeEntity();
+ runtimeEntity.setClusterId(clusterEntity.getId());
+ ClusterAllMetadataDO clusterAllMetadata = this.runtimeService.queryAllByClusterId(runtimeEntity, true, true);
+
+ clusterAllMetadata.getRuntimeEntityList().forEach(entity -> {
+ // TODO
+ if (entity.getTrusteeshipType().isSelf()) {
+ entity.setDeployStatusType(DeployStatusType.PAUSE_FULL_WAIT);
+ } else {
+ entity.setStatus(1L);
+ }
+ });
+
+ clusterAllMetadata.getClusterEntityList().forEach(entity -> {
+
+ });
+
+ if (clusterEntity.getClusterType().isMeta()) {
+ // 得到 所有关联项目
+
+ // 获得 所有关联项目的 存储 cluster
+
+ //
+ }
+
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/pause/PauseRuntime.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/pause/PauseRuntime.java
new file mode 100644
index 0000000..93189f9
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/pause/PauseRuntime.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.controller.deploy.pause;
+
+import org.apache.eventmesh.dashboard.common.enums.DeployStatusType;
+import org.apache.eventmesh.dashboard.console.controller.deploy.handler.UpdateHandler;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class PauseRuntime implements UpdateHandler<RuntimeEntity> {
+
+ @Autowired
+ private RuntimeService runtimeService;
+
+
+ @Override
+ public void init() {
+
+ }
+
+ @Override
+ public void handler(RuntimeEntity runtimeEntity) {
+ RuntimeEntity newRuntimeEntity = this.runtimeService.queryRuntimeEntityById(runtimeEntity);
+ if (newRuntimeEntity.getTrusteeshipType().isSelf()) {
+ newRuntimeEntity.setDeployStatusType(DeployStatusType.PAUSE_WAIT);
+ } else {
+ newRuntimeEntity.setStatus(0L);
+ }
+ this.runtimeService.deactivate(runtimeEntity);
+
+
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/relationship/RelationshipHandler.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/relationship/RelationshipHandler.java
new file mode 100644
index 0000000..82c66a8
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/relationship/RelationshipHandler.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.controller.deploy.relationship;
+
+import org.apache.eventmesh.dashboard.console.controller.deploy.handler.UpdateHandler;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterRelationshipService;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
+import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService;
+
+public class RelationshipHandler implements UpdateHandler<ClusterRelationshipEntity> {
+
+ private ClusterService clusterService;
+
+ private ClusterRelationshipService clusterRelationshipService;
+
+ private RuntimeService runtimeService;
+
+
+ @Override
+ public void init() {
+
+ }
+
+ @Override
+ public void handler(ClusterRelationshipEntity clusterRelationshipEntity) {
+ // 绑定 meta 集群, 那么下面所有的 runtime 集群,需要更新更新
+ // 绑定 runtime 集群, main cluster 依赖的
+ clusterRelationshipService.addClusterRelationshipEntry(clusterRelationshipEntity);
+
+ if (clusterRelationshipEntity.getRelationshipType().isMeta()) {
+ RuntimeEntity runtimeEntity = new RuntimeEntity();
+ runtimeEntity.setClusterId(clusterRelationshipEntity.getClusterId());
+ //runtimeService.queryOnlyRuntimeByClusterId(runtimeEntity);
+ }
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/relationship/UnRelationshipHandler.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/relationship/UnRelationshipHandler.java
new file mode 100644
index 0000000..485061c
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/relationship/UnRelationshipHandler.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.controller.deploy.relationship;
+
+import org.apache.eventmesh.dashboard.console.controller.deploy.handler.UpdateHandler;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterRelationshipService;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
+import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService;
+
+public class UnRelationshipHandler implements UpdateHandler<ClusterRelationshipEntity> {
+
+ private ClusterService clusterService;
+
+ private ClusterRelationshipService clusterRelationshipService;
+
+ private RuntimeService runtimeService;
+
+ @Override
+ public void init() {
+
+ }
+
+ @Override
+ public void handler(ClusterRelationshipEntity clusterRelationshipEntity) {
+ // 取消 runtime ,什么都不用管
+ // 接触 meta ,关联 集群下 runtime 都需要管理
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/uninstall/UninstallClusterHandler.java
similarity index 64%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/uninstall/UninstallClusterHandler.java
index bf167b1..c6e8f90 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/uninstall/UninstallClusterHandler.java
@@ -15,16 +15,21 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.console.controller.deploy.uninstall;
-@Data
-public class ChangeConfigEntity {
+import org.apache.eventmesh.dashboard.console.controller.deploy.handler.UpdateHandler;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
- private String configName;
+public class UninstallClusterHandler implements UpdateHandler<ClusterEntity> {
- private String configValue;
+ @Override
+ public void init() {
- private Integer alreadyUpdate;
+ }
+
+ @Override
+ public void handler(ClusterEntity clusterEntity) {
+
+ }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/uninstall/UninstallRuntimeHandler.java
similarity index 64%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/uninstall/UninstallRuntimeHandler.java
index bf167b1..987de5e 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/deploy/uninstall/UninstallRuntimeHandler.java
@@ -15,16 +15,21 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.console.controller.deploy.uninstall;
-@Data
-public class ChangeConfigEntity {
+import org.apache.eventmesh.dashboard.console.controller.deploy.handler.UpdateHandler;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
- private String configName;
+public class UninstallRuntimeHandler implements UpdateHandler<RuntimeEntity> {
- private String configValue;
+ @Override
+ public void init() {
- private Integer alreadyUpdate;
+ }
+
+ @Override
+ public void handler(RuntimeEntity runtimeEntity) {
+
+ }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/ConfigController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/ConfigController.java
index 31c36e3..ef38b02 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/ConfigController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/ConfigController.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.controller.function;
import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
-import org.apache.eventmesh.dashboard.console.mapstruct.config.ConfigControllerMapper;
import org.apache.eventmesh.dashboard.console.modle.dto.config.DetailConfigsVO;
import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO;
import org.apache.eventmesh.dashboard.console.modle.dto.config.UpdateConfigDTO;
@@ -32,32 +32,27 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
-@RequestMapping("/cluster/config")
public class ConfigController {
@Autowired
private ConfigService configService;
- @PostMapping("/updateConfigs")
+ @PostMapping("/cluster/config/updateConfigs")
public String updateConfigsByTypeAndId(@Validated @RequestBody UpdateConfigDTO updateConfigDTO) {
- try {
- configService.updateConfigsByInstanceId(updateConfigDTO.getUsername(), updateConfigDTO.getClusterId(), updateConfigDTO.getInstanceType(),
- updateConfigDTO.getInstanceId(), updateConfigDTO.getChangeConfigEntities());
- } catch (Exception e) {
- return e.getMessage();
- }
+
return "success";
}
- @PostMapping("/getInstanceDetailConfigs")
+ @PostMapping("/cluster/config/getInstanceDetailConfigs")
public List<DetailConfigsVO> getInstanceDetailConfigs(@Validated @RequestBody GetConfigsListDTO getConfigsListDTO) {
- List<ConfigEntity> configEntityList = configService.selectToFront(ConfigControllerMapper.INSTANCE.queryEntityByConfig(getConfigsListDTO));
- Map<String, String> stringStringConcurrentHashMap = configService.selectDefaultConfig(getConfigsListDTO.getBusinessType());
+ List<ConfigEntity> configEntityList = configService.selectToFront(getConfigsListDTO.getInstanceId(),
+ getConfigsListDTO.getInstanceType(), getConfigsListDTO);
+ Map<String, String> stringStringConcurrentHashMap = configService.selectDefaultConfig(getConfigsListDTO.getBusinessType(),
+ getConfigsListDTO.getInstanceId(), getConfigsListDTO.getInstanceType());
ArrayList<DetailConfigsVO> showDetailConfigsVOS = new ArrayList<>();
configEntityList.forEach(n -> {
DetailConfigsVO showDetailConfigsVO = new DetailConfigsVO();
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/HealthController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/HealthController.java
index 4a96974..f3d0b5a 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/HealthController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/HealthController.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.controller.function;
import org.apache.eventmesh.dashboard.console.entity.function.HealthCheckResultEntity;
@@ -26,23 +27,21 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
-@RequestMapping("/cluster/health")
public class HealthController {
@Autowired
HealthDataService healthDataService;
- @GetMapping("/getHistoryLiveStatus")
+ @GetMapping("/cluster/health/getHistoryLiveStatus")
public List<HealthCheckResultEntity> getHistoryLiveStatusById(Integer type, Long instanceId, String startTime) {
- return healthDataService.selectInstanceLiveStatusHistory(type, instanceId, LocalDateTime.parse(startTime));
+ return healthDataService.getInstanceLiveStatusHistory(type, instanceId, LocalDateTime.parse(startTime));
}
- @GetMapping("/getInstanceLiveProportion")
+ @GetMapping("/cluster/health/getInstanceLiveProportion")
public InstanceLiveProportionVo getInstanceLiveProportion(Integer instanceType, Long theClusterId) {
- return healthDataService.selectInstanceLiveProportion(theClusterId, instanceType);
+ return healthDataService.getInstanceLiveProportion(theClusterId, instanceType);
}
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/LogController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/LogController.java
index 36ec3d0..525de4f 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/LogController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/LogController.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.controller.function;
import org.apache.eventmesh.dashboard.console.entity.function.LogEntity;
-import org.apache.eventmesh.dashboard.console.mapstruct.log.LogControllerMapper;
import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO;
import org.apache.eventmesh.dashboard.console.service.function.LogService;
@@ -28,19 +28,17 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
-@RequestMapping("/cluster/log")
public class LogController {
@Autowired
private LogService logService;
- @PostMapping("/getList")
+ @PostMapping("/cluster/log/getList")
public List<LogEntity> getLogLIstToFront(@Validated @RequestBody GetLogListDTO getLogListDTO) {
- return logService.selectLogListByCluster(LogControllerMapper.INSTANCE.queryEntityByLog(getLogListDTO));
+ return logService.getLogListByCluster(getLogListDTO);
}
-}
+}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/OverviewController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/OverviewController.java
index 4667fce..46e4920 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/OverviewController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/OverviewController.java
@@ -16,6 +16,7 @@
*/
+
package org.apache.eventmesh.dashboard.console.controller.function;
@@ -40,8 +41,9 @@
private Map<String, OverviewService> overviewServiceMap;
@PostMapping("overview")
- public Map<String, Integer> overview(@RequestBody @Validated OverviewDTO overviewDTO) {
+ public Object overview(@RequestBody @Validated OverviewDTO overviewDTO) {
+ OverviewService overviewService = overviewServiceMap.get(overviewDTO.getOverviewType().name());
- return null;
+ return overviewService.overview(overviewDTO);
}
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupController.java
index a2f8c7b..d1d5802 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupController.java
@@ -16,13 +16,14 @@
*/
+
package org.apache.eventmesh.dashboard.console.controller.message;
import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity;
import org.apache.eventmesh.dashboard.console.mapstruct.cluster.GroupControllerMapper;
-import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
import org.apache.eventmesh.dashboard.console.modle.IdDTO;
+import org.apache.eventmesh.dashboard.console.modle.vo.RuntimeIdDTO;
import org.apache.eventmesh.dashboard.console.service.message.GroupService;
import java.util.List;
@@ -46,8 +47,8 @@
private GroupService groupService;
@PostMapping("queryGroupListByClusterId")
- public List<GroupEntity> queryGroupListByClusterId(@RequestBody @Validated ClusterIdDTO clusterIdDTO) {
- return groupService.selectGroupByClusterId(GroupControllerMapper.INSTANCE.queryGroupListByClusterId(clusterIdDTO));
+ public List<GroupEntity> queryGroupListByClusterId(@RequestBody @Validated RuntimeIdDTO runtimeIdDTO) {
+ return groupService.getGroupByClusterId(GroupControllerMapper.INSTANCE.queryGroupListByClusterId(runtimeIdDTO));
}
@PostMapping("deleteGroupById")
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupRelationshipController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupRelationshipController.java
index f8f1944..a726dbc 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupRelationshipController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupRelationshipController.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.controller.message;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/OffsetOperateController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/OffsetOperateController.java
index 366c106..bfdddc4 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/OffsetOperateController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/OffsetOperateController.java
@@ -15,9 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.controller.message;
+import org.apache.eventmesh.dashboard.console.domain.OperationRangeDomain;
import org.apache.eventmesh.dashboard.console.modle.message.offset.QueryOffsetByMessageMetadataDTO;
import org.apache.eventmesh.dashboard.console.modle.message.offset.ResetOffsetDTO;
import org.apache.eventmesh.dashboard.service.remoting.OffsetRemotingService;
@@ -37,10 +39,13 @@
@RequestMapping("offset")
public class OffsetOperateController {
- @Autowired
private OffsetRemotingService offsetRemotingService;
+ @Autowired
+ private OperationRangeDomain operationRangeDomain;
+
+
public ResultObject<String> queryOffsetByMessageMetadataDTO(
@RequestBody @Validated QueryOffsetByMessageMetadataDTO queryOffsetByMessageMetadataDTO) {
@@ -49,6 +54,17 @@
public ResultObject<String> resetOffset(@RequestBody @Validated ResetOffsetDTO resetOffsetDTO) {
+ // 得到 订阅信息
+ // 获得 runtime
+
+ switch (resetOffsetDTO.getResetOffsetMode()) {
+ case CONSUME_FROM_LAST_OFFSET:
+ case CONSUME_FROM_FIRST_OFFSET:
+ case CONSUME_FROM_TIMESTAMP:
+ case CONSUME_FROM_DESIGNATED_OFFSET:
+ default:
+ break;
+ }
return null;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/TopicController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/TopicController.java
index 25353a2..5a63bd1 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/TopicController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/TopicController.java
@@ -15,17 +15,25 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.controller.message;
+import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
+import org.apache.eventmesh.dashboard.console.controller.ClusterAbitityService;
+import org.apache.eventmesh.dashboard.console.domain.metadata.ClusterMetadataDomain;
+import org.apache.eventmesh.dashboard.console.domain.metadata.ClusterOperationHandler;
import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity;
import org.apache.eventmesh.dashboard.console.mapstruct.message.TopicControllerMapper;
import org.apache.eventmesh.dashboard.console.modle.IdDTO;
import org.apache.eventmesh.dashboard.console.modle.dto.topic.CreateTopicDTO;
import org.apache.eventmesh.dashboard.console.modle.dto.topic.GetTopicListDTO;
+import org.apache.eventmesh.dashboard.console.modle.vo.RuntimeIdDTO;
import org.apache.eventmesh.dashboard.console.modle.vo.topic.TopicDetailGroupVO;
import org.apache.eventmesh.dashboard.console.service.message.TopicService;
+import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
@@ -44,24 +52,121 @@
private TopicService topicService;
+ @Autowired
+ private ClusterAbitityService clusterAbitityService;
+
+ @Autowired
+ private ClusterMetadataDomain clusterMetadataDomain;
+
+ /**
+ * @param getTopicListDTO
+ * @return
+ */
@PostMapping("/queryTopicListByClusterId")
public List<TopicEntity> queryTopicListByClusterId(@Validated @RequestBody GetTopicListDTO getTopicListDTO) {
- return topicService.selectTopicListToFront(TopicControllerMapper.INSTANCE.queryTopicListByClusterId(getTopicListDTO));
+ // cap 的直接查询
+ if (this.clusterAbitityService.isCAP(getTopicListDTO)) {
+ topicService.getTopicListToFront(TopicControllerMapper.INSTANCE.queryTopicListByClusterId(getTopicListDTO));
+ }
+ // 非 CAP 另外查询
+ return topicService.getTopicListToFront(TopicControllerMapper.INSTANCE.queryTopicListByClusterId(getTopicListDTO));
}
@PostMapping("queryTopicListById ")
- public TopicEntity queryTopicById(@Validated @RequestBody IdDTO idDTO) {
- return topicService.selectTopicById(TopicControllerMapper.INSTANCE.queryTopicListById(idDTO));
+ public TopicEntity queryTopicById(@Validated @RequestBody RuntimeIdDTO runtimeIdDTO) {
+ TopicEntity topicEntity = topicService.selectTopicById(TopicControllerMapper.INSTANCE.queryTopicListById(runtimeIdDTO));
+ if (this.clusterAbitityService.isCAP(topicEntity)) {
+ return topicEntity;
+ }
+ //
+ List<TopicEntity> queryList = new ArrayList<>();
+ // 如果 是 eventmesh 集群。 得到 eventmesh 所有 runtime , 所有存储
+ clusterMetadataDomain.operation(topicEntity.getClusterId(), new ClusterOperationHandler() {
+
+ @Override
+ public void handler(RuntimeMetadata baseSyncBase) {
+ TopicEntity topicEntity = new TopicEntity();
+ queryList.add(topicEntity);
+ topicEntity.setClusterId(baseSyncBase.getClusterId());
+ topicEntity.setClusterType(baseSyncBase.getClusterType());
+ topicEntity.setRuntimeId(baseSyncBase.getId());
+ topicEntity.setTopicName(topicEntity.getTopicName());
+ }
+
+ @Override
+ public void handler(ClusterMetadata clusterDO) {
+ TopicEntity topicEntity = new TopicEntity();
+ queryList.add(topicEntity);
+ topicEntity.setClusterId(clusterDO.getClusterId());
+ topicEntity.setClusterType(clusterDO.getClusterType());
+ topicEntity.setRuntimeId(clusterDO.getClusterId());
+ topicEntity.setTopicName(topicEntity.getTopicName());
+ }
+ });
+
+
+
+ topicService.queryRuntimeByBaseSyncEntity(queryList);
+ return null;
}
@GetMapping("deleteTopic")
public Integer deleteTopic(@Validated @RequestBody IdDTO idDTO) {
- return topicService.deleteTopic(TopicControllerMapper.INSTANCE.deleteTopic(idDTO));
+ TopicEntity topicEntity = this.topicService.selectTopicById(TopicControllerMapper.INSTANCE.deleteTopic(idDTO));
+ if (this.clusterAbitityService.isCAP(topicEntity)) {
+ return this.topicService.deleteTopicById(topicEntity);
+ }
+ // 通过 clusterId,runtime id, topic name 删除
+
+ List<TopicEntity> deleteList = new ArrayList<>();
+ // 如果 是 eventmesh 集群。 得到 eventmesh 所有 runtime , 所有存储
+ clusterMetadataDomain.operation(topicEntity.getClusterId(), new ClusterOperationHandler() {
+
+ @Override
+ public void handler(RuntimeMetadata baseSyncBase) {
+ TopicEntity topicEntity = new TopicEntity();
+ deleteList.add(topicEntity);
+ topicEntity.setClusterId(baseSyncBase.getClusterId());
+ topicEntity.setClusterType(baseSyncBase.getClusterType());
+ topicEntity.setRuntimeId(baseSyncBase.getId());
+ }
+
+ @Override
+ public void handler(ClusterMetadata clusterDO) {
+ TopicEntity topicEntity = new TopicEntity();
+ deleteList.add(topicEntity);
+ topicEntity.setClusterId(clusterDO.getClusterId());
+ topicEntity.setClusterType(clusterDO.getClusterType());
+ }
+ });
+ return topicService.deleteTopicByRuntimeIdAndTopicName(deleteList);
}
@PostMapping("createTopic")
public void createTopic(@Validated @RequestBody CreateTopicDTO createTopicDTO) {
- topicService.createTopic(TopicControllerMapper.INSTANCE.createTopic(createTopicDTO));
+ List<TopicEntity> createTopicList = new ArrayList<>();
+ // 如果 是 eventmesh 集群。 得到 eventmesh 所有 runtime , 所有存储
+ clusterMetadataDomain.operation(createTopicDTO.getClusterId(), new ClusterOperationHandler() {
+
+ @Override
+ public void handler(RuntimeMetadata baseSyncBase) {
+ TopicEntity topicEntity = TopicControllerMapper.INSTANCE.createTopic(createTopicDTO);
+ createTopicList.add(topicEntity);
+ topicEntity.setClusterId(baseSyncBase.getClusterId());
+ topicEntity.setClusterType(baseSyncBase.getClusterType());
+ topicEntity.setRuntimeId(baseSyncBase.getId());
+
+ }
+
+ @Override
+ public void handler(ClusterMetadata clusterDO) {
+ TopicEntity topicEntity = TopicControllerMapper.INSTANCE.createTopic(createTopicDTO);
+ createTopicList.add(topicEntity);
+ topicEntity.setClusterId(clusterDO.getClusterId());
+ topicEntity.setClusterType(clusterDO.getClusterType());
+ }
+ });
+ this.topicService.batchInsert(createTopicList);
}
/**
@@ -72,7 +177,7 @@
*/
@GetMapping("/cluster/topic/getTopicDetailGroups")
public List<TopicDetailGroupVO> getTopicDetailGroups(Long topicId) {
- return topicService.selectTopicDetailGroups(topicId);
+ return topicService.getTopicDetailGroups(topicId);
}
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/ClusterAndRuntimeDomain.java
similarity index 73%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/ClusterAndRuntimeDomain.java
index bf167b1..0aa1222 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/ClusterAndRuntimeDomain.java
@@ -15,16 +15,25 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.console.domain;
-@Data
-public class ChangeConfigEntity {
- private String configName;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
- private String configValue;
+import java.util.List;
- private Integer alreadyUpdate;
+/**
+ *
+ */
+public interface ClusterAndRuntimeDomain {
+
+
+
+ List<ClusterEntity> getClusterByCLusterId(ClusterEntity clusterEntity);
+
+
+
+
+
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/Impl/ClusterAndRuntimeDomainImpl.java
similarity index 63%
copy from eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/Impl/ClusterAndRuntimeDomainImpl.java
index 2e63772..67fa472 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/Impl/ClusterAndRuntimeDomainImpl.java
@@ -15,21 +15,19 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.service.store;
-import org.apache.eventmesh.dashboard.service.dto.TopicProperties;
+package org.apache.eventmesh.dashboard.console.domain.Impl;
+import org.apache.eventmesh.dashboard.console.domain.ClusterAndRuntimeDomain;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+
+import java.util.Collections;
import java.util.List;
-/**
- * Manage topics of eventmesh-storage-plugin (EventMesh Store).
- */
+public class ClusterAndRuntimeDomainImpl implements ClusterAndRuntimeDomain {
-public interface TopicCore {
-
- List<TopicProperties> getTopics();
-
- Boolean createTopic(String topicName);
-
- Boolean deleteTopic(String topicName);
+ @Override
+ public List<ClusterEntity> getClusterByCLusterId(ClusterEntity clusterEntity) {
+ return Collections.emptyList();
+ }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/OperationRangeDomain.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/OperationRangeDomain.java
new file mode 100644
index 0000000..e08c9fa
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/OperationRangeDomain.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.domain;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterFramework;
+import org.apache.eventmesh.dashboard.common.enums.ClusterSyncMetadataEnum;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.MetadataType;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseSyncEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.modle.deploy.ClusterAllMetadataDO;
+import org.apache.eventmesh.dashboard.console.modle.dto.operation.OperationBaseDTO;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
+import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+/**
+ * 可以得到返回的数据为两种: 1. 写入数据的 2. 直接请求其他组件
+ */
+@Component
+@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+public class OperationRangeDomain {
+
+ @Autowired
+ private ClusterService clusterService;
+
+ @Autowired
+ private RuntimeService runtimeService;
+
+
+ private OperationBaseDTO operationBaseDTO;
+
+ private OperationRangeDomainDataHandler rangeDomainDataHandler;
+
+ private final Set<ClusterType> clusterTypeSet = new HashSet<>();
+
+ private ClusterType rangeType;
+
+ private boolean currentType;
+
+
+ public OperationRangeDomain operationBaseDTO(OperationBaseDTO operationBaseDTO) {
+ this.operationBaseDTO = operationBaseDTO;
+ return this;
+ }
+
+
+ public OperationRangeDomain operationRangeDomainDataHandler(OperationRangeDomainDataHandler operationRangeDomainDataHandler) {
+ this.rangeDomainDataHandler = operationRangeDomainDataHandler;
+ return this;
+ }
+
+ public OperationRangeDomain clusterType(ClusterType clusterType) {
+ this.clusterTypeSet.add(clusterType);
+ return this;
+ }
+
+ public OperationRangeDomain rangeType(ClusterType rangeType) {
+ this.rangeType = rangeType;
+ return this;
+ }
+
+ public <T> T hander() {
+ List<T> operationList = new ArrayList<>();
+ if (Objects.equals(operationBaseDTO.getRangeType(), MetadataType.RUNTIME)) {
+ RuntimeEntity runtimeEntity = new RuntimeEntity();
+ runtimeEntity = runtimeService.queryRuntimeEntityById(runtimeEntity);
+ // 直接写入
+ operationList.add((T) this.rangeDomainDataHandler.handler(runtimeEntity));
+ return (T) operationList;
+ }
+ ClusterEntity clusterEntity = new ClusterEntity();
+ clusterEntity = this.clusterService.queryClusterById(clusterEntity);
+ ClusterFramework clusterFramework = ClusterSyncMetadataEnum.getClusterFramework(clusterEntity.getClusterType());
+ RuntimeEntity runtimeEntity = new RuntimeEntity();
+ ClusterAllMetadataDO clusterAllMetadataDO =
+ runtimeService.queryAllByClusterId(runtimeEntity, true, false);
+ clusterAllMetadataDO.getClusterEntityList().forEach((value) -> {
+ ClusterFramework clusterFramework1 = ClusterSyncMetadataEnum.getClusterFramework(value.getClusterType());
+ if (!clusterFramework1.isCAP()) {
+ return;
+ }
+
+ if (!clusterTypeSet.isEmpty() && !clusterTypeSet.contains(value.getClusterType())) {
+ return;
+ }
+ if (!Objects.equals(this.rangeType, value.getClusterType().getAssemblyNodeType())) {
+ return;
+ }
+
+ operationList.add((T) this.rangeDomainDataHandler.handler(value));
+ });
+ clusterAllMetadataDO.getRuntimeEntityList().forEach((value) -> {
+ ClusterFramework clusterFramework1 = ClusterSyncMetadataEnum.getClusterFramework(value.getClusterType());
+ if (clusterFramework1.isCAP()) {
+ return;
+ }
+ if (!clusterTypeSet.isEmpty() && !clusterTypeSet.contains(value.getClusterType())) {
+ return;
+ }
+ if (!Objects.equals(this.rangeType, value.getClusterType().getAssemblyNodeType())) {
+ return;
+ }
+ operationList.add((T) this.rangeDomainDataHandler.handler(value));
+ });
+
+ return (T) operationList;
+ }
+
+ /**
+ *
+ */
+ public static interface OperationRangeDomainDataHandler {
+
+
+ Object handler(BaseSyncEntity baseEntity);
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/metadata/ClusterMetadataDomain.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/metadata/ClusterMetadataDomain.java
new file mode 100644
index 0000000..85475d0
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/metadata/ClusterMetadataDomain.java
@@ -0,0 +1,447 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.domain.metadata;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterFramework;
+import org.apache.eventmesh.dashboard.common.enums.ClusterSyncMetadataEnum;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.modle.domain.ClusterEntityDO;
+import org.apache.eventmesh.dashboard.console.modle.domain.RuntimeEntityDO;
+import org.apache.eventmesh.dashboard.console.spring.support.metadata.convert.ClusterConvertMetaData;
+import org.apache.eventmesh.dashboard.console.spring.support.metadata.convert.RuntimeConvertMetaData;
+import org.apache.eventmesh.dashboard.core.cluster.ClusterBaseDO;
+import org.apache.eventmesh.dashboard.core.cluster.ClusterDO;
+import org.apache.eventmesh.dashboard.core.cluster.ColonyDO;
+import org.apache.eventmesh.dashboard.core.cluster.RuntimeBaseDO;
+import org.apache.eventmesh.dashboard.core.cluster.RuntimeDO;
+import org.apache.eventmesh.dashboard.core.function.SDK.ConfigManage;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.AbstractMultiCreateSDKConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.AbstractSimpleCreateSDKConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.NetAddress;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 直接序列化,或则 使用 mapper
+ */
+@SuppressWarnings({"unchecked", "rawtypes", "RedundantCast"})
+@Slf4j
+public class ClusterMetadataDomain {
+
+ private ColonyDO<ClusterDO> colonyDO;
+
+
+ private boolean coreModel = true;
+
+ private boolean buildConfig = false;
+
+ @Setter
+ private DataHandler handler;
+
+ public void isConsoleModel() {
+ this.coreModel = false;
+ }
+
+ public void useBuildConfig() {
+ this.buildConfig = true;
+ }
+
+
+ public ColonyDO<ClusterDO> getColonyDO(Long clusterId) {
+ return colonyDO.getAllColonyDO().get(clusterId);
+ }
+
+ public List<ColonyDO<ClusterDO>> getMetaColonyDO(Long clusterId) {
+ ColonyDO<ClusterDO> clusterDO = colonyDO.getAllColonyDO().get(clusterId);
+ if (Objects.isNull(clusterDO)) {
+ return null;
+ }
+
+ // TODO
+ if (colonyDO.getClusterType().isMetaAndRuntime()) {
+ return new ArrayList<>(clusterDO.getRuntimeColonyDOMap().values());
+ }
+ return new ArrayList<>(clusterDO.getMetaColonyDOList().values());
+ }
+
+ public void setMainCluster(ClusterEntity clusterEntity) {
+ this.colonyDO = ColonyDO.create(ClusterEntityDO.class, clusterEntity);
+ this.colonyDO.setClusterId(clusterEntity.getClusterId());
+ this.colonyDO.setClusterType(clusterEntity.getClusterType());
+ this.colonyDO.setSuperiorId(-0L);
+ }
+
+ public void rootClusterDHO() {
+ this.colonyDO = ColonyDO.create(ClusterEntityDO.class, null);
+ this.colonyDO.setSuperiorId(-0L);
+ }
+
+ public QueueCondition createQueueCondition() {
+ return new QueueCondition();
+ }
+
+
+ public void handlerMetadata(MetadataAllDO metadataAllDO) {
+ Map<Long, ColonyDO<ClusterDO>> colonyDOMap = new HashMap<>();
+
+ this.setClusterEntityAndDefinitionCluster(metadataAllDO.getClusterEntityList(), metadataAllDO.getClusterRelationshipEntityList(),
+ colonyDOMap);
+ this.setRuntimeEntity(metadataAllDO.getRuntimeEntityList(), colonyDOMap);
+
+ colonyDOMap.forEach((key, value) -> {
+ AbstractMultiCreateSDKConfig createSDKConfig = value.getClusterDO().getMultiCreateSDKConfig();
+ if (Objects.isNull(createSDKConfig) || createSDKConfig.isNullAddress()) {
+ return;
+ }
+ if (!ClusterSyncMetadataEnum.getClusterFramework(value.getClusterType()).isCAP()) {
+ return;
+ }
+ if (Objects.nonNull(this.handler)) {
+ // TODO
+ this.handler.registerCluster(null, value.getClusterDO(), value);
+ //this.handler.registerCluster(value.getClusterDO().getClusterInfo(), value.getClusterDO(), value);
+ }
+ });
+ }
+
+
+ public List<ClusterEntity> setClusterEntityAndDefinitionCluster(List<ClusterEntity> clusterEntityList,
+ List<ClusterRelationshipEntity> clusterRelationshipEntityList,
+ Map<Long, ColonyDO<ClusterDO>> colonyDOMap) {
+ List<ClusterEntity> definitionClusteList = new ArrayList<>();
+ if (CollectionUtils.isNotEmpty(clusterEntityList)) {
+ clusterEntityList.forEach(v -> {
+ if (v.getClusterType().isDefinition()) {
+ definitionClusteList.add(v);
+ }
+ if (Objects.equals(v.getStatus(), 0L)) {
+ ColonyDO<ClusterDO> colonyDO = this.colonyDO.remove(v.getId());
+ if (Objects.nonNull(this.handler)) {
+ this.handler.unRegisterCluster(v, colonyDO.getClusterDO(), colonyDO);
+ }
+ } else {
+ ClusterBaseDO clusterEntityDO = this.createClusterBaseDO(v);
+ ColonyDO<ClusterDO> colonyDO = this.colonyDO.register(v.getId(), v.getClusterType(), clusterEntityDO);
+ if (!v.getClusterType().isDefinition()) {
+ colonyDOMap.put(v.getId(), colonyDO);
+ }
+ }
+ });
+ }
+ if (CollectionUtils.isEmpty(clusterRelationshipEntityList)) {
+ return definitionClusteList;
+ }
+ clusterRelationshipEntityList.forEach(v -> {
+ try {
+ if (Objects.equals(v.getStatus(), 0L)) {
+ this.colonyDO.unRelationship(v.getClusterId(), v.getRelationshipId());
+ } else {
+ this.colonyDO.relationship(v.getClusterId(), v.getRelationshipId());
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ return definitionClusteList;
+ }
+
+ public void setRuntimeEntity(List<RuntimeEntity> runtimeEntityList, Map<Long, ColonyDO<ClusterDO>> colonyDOMap) {
+ if (Objects.isNull(runtimeEntityList)) {
+ return;
+ }
+ runtimeEntityList.forEach(value -> {
+ NetAddress netAddress = new NetAddress();
+ netAddress.setAddress(value.getHost());
+ netAddress.setPort(value.getPort());
+ ColonyDO<ClusterDO> colonyDO;
+ ClusterFramework clusterFramework = ClusterSyncMetadataEnum.getClusterFramework(value.getClusterType());
+ if (Objects.equals(value.getStatus(), 0L)) {
+ colonyDO = this.colonyDO.removeRuntime(value.getClusterId(), value.getId(), netAddress);
+ if (Objects.nonNull(colonyDO) && clusterFramework.isCAP()) {
+ colonyDOMap.put(value.getClusterId(), colonyDO);
+ } else {
+ if (Objects.nonNull(this.handler)) {
+ this.handler.unRegisterRuntime(value, null, colonyDO);
+ }
+ }
+ } else {
+ RuntimeBaseDO runtimeBaseDO = this.createRuntimeDO(value);
+ colonyDO = this.colonyDO.register(value.getClusterId(), value.getId(), runtimeBaseDO, netAddress);
+
+ if (Objects.isNull(colonyDO)) {
+ log.warn(" not queue colonyDO, runtime is {}", value);
+ return;
+ }
+ if (clusterFramework.isCAP()) {
+ colonyDOMap.put(value.getClusterId(), colonyDO);
+ } else {
+ if (Objects.nonNull(this.handler)) {
+ this.handler.registerRuntime(value, runtimeBaseDO, colonyDO);
+ }
+ }
+ }
+ });
+
+ }
+
+ private ClusterBaseDO createClusterBaseDO(ClusterEntity clusterEntity) {
+ ClusterBaseDO clusterBaseDO;
+ ClusterType clusterType = clusterEntity.getClusterType();
+ if (this.coreModel) {
+ clusterBaseDO = new ClusterDO();
+ ClusterMetadata clusterMetadata = ClusterConvertMetaData.INSTANCE.toMetaData(clusterEntity);
+ clusterBaseDO.setClusterInfo(clusterMetadata);
+ } else {
+ clusterBaseDO = new ClusterEntityDO();
+ clusterBaseDO.setClusterInfo(clusterEntity);
+ }
+ ClusterFramework clusterFramework = ClusterSyncMetadataEnum.getClusterFramework(clusterType);
+ if (this.buildConfig && !clusterType.isDefinition() && clusterFramework.isCAP()) {
+ AbstractMultiCreateSDKConfig config =
+ ConfigManage.getInstance().getMultiCreateSDKConfig(clusterEntity.getClusterType(), SDKTypeEnum.ADMIN);
+ config.setKey(clusterEntity.getId().toString());
+ clusterBaseDO.setMultiCreateSDKConfig(config);
+ }
+ return clusterBaseDO;
+ }
+
+ private RuntimeBaseDO createRuntimeDO(RuntimeEntity runtimeEntity) {
+ RuntimeBaseDO runtimeBaseDO;
+ if (this.coreModel) {
+ runtimeBaseDO = new RuntimeDO();
+ RuntimeMetadata runtimeMetadata = RuntimeConvertMetaData.INSTANCE.toMetaData(runtimeEntity);
+ runtimeBaseDO.setRuntimeMetadata(runtimeMetadata);
+ ClusterFramework clusterFramework = ClusterSyncMetadataEnum.getClusterFramework(runtimeEntity.getClusterType());
+ if (!clusterFramework.isCAP()) {
+ AbstractSimpleCreateSDKConfig config =
+ ConfigManage.getInstance().getSimpleCreateSDKConfig(runtimeEntity.getClusterType(), SDKTypeEnum.ADMIN);
+ config.setKey(runtimeEntity.getId().toString());
+ config.setNetAddress(this.createNetAddress(runtimeEntity));
+ runtimeBaseDO.setCreateSDKConfig(config);
+ }
+ } else {
+ runtimeBaseDO = new RuntimeEntityDO();
+ runtimeBaseDO.setRuntimeMetadata(runtimeEntity);
+ }
+ return runtimeBaseDO;
+ }
+
+ private NetAddress createNetAddress(RuntimeEntity runtimeEntity) {
+ NetAddress netAddress = new NetAddress();
+ netAddress.setAddress(runtimeEntity.getHost());
+ netAddress.setPort(runtimeEntity.getPort());
+ return netAddress;
+ }
+
+
+ public void setResource() {
+
+ }
+
+ public void setConfigEntity() {
+
+ }
+
+ /**
+ * TODO @see OperationRangeDomain.
+ * @param clusterId
+ * @param clusterOperationHandler
+ */
+ public void operation(Long clusterId, ClusterOperationHandler clusterOperationHandler) {
+
+ // 需要识别最小维度
+
+ ColonyDO<ClusterDO> colonyDO = this.colonyDO.getAllColonyDO().get(clusterId);
+ ClusterType clusterType = colonyDO.getClusterType();
+ if (Objects.equals(clusterType, ClusterType.EVENTMESH_RUNTIME)) {
+ colonyDO.getClusterDO().getRuntimeMap().forEach((key, value) -> {
+ clusterOperationHandler.handler(value.getRuntimeMetadata());
+ });
+ } else if (Objects.equals(clusterType, ClusterType.EVENTMESH_CLUSTER)) {
+ colonyDO.getRuntimeColonyDOMap().forEach((key, value) -> {
+ value.getClusterDO().getRuntimeMap().forEach((k, v) -> {
+ clusterOperationHandler.handler(v.getRuntimeMetadata());
+ });
+ });
+
+ } else if (clusterType.isStorage()) {
+ if (clusterType.isDefinition()) {
+ colonyDO.getStorageColonyDOMap().forEach((key, value) -> {
+ value.getRuntimeColonyDOMap().forEach((k, v) -> {
+ value.getClusterDO().getRuntimeMap().forEach((kk, vv) -> {
+ clusterOperationHandler.handler(vv.getRuntimeMetadata());
+ });
+ });
+ });
+ } else {
+ ClusterFramework clusterFramework = ClusterSyncMetadataEnum.getClusterFramework(clusterType);
+ if (clusterFramework.isCAP()) {
+ clusterOperationHandler.handler(colonyDO.getClusterDO().getClusterInfo());
+ } else {
+ colonyDO.getClusterDO().getRuntimeMap().forEach((k, v) -> {
+ clusterOperationHandler.handler(v.getRuntimeMetadata());
+ });
+ }
+ }
+ }
+ }
+
+
+ public <T> T queue(QueueCondition queueCondition) {
+ QueueConditionHandler queueConditionHandler = new QueueConditionHandler();
+ queueConditionHandler.colonyDO = this.colonyDO.getAllColonyDO().get(queueCondition.clusterId);
+ queueConditionHandler.queueCondition = queueCondition;
+ return (T) queueConditionHandler.handler();
+ }
+
+
+ /**
+ *
+ */
+ @SuppressWarnings("rawtypes")
+ public interface DataHandler<T extends RuntimeBaseDO, C extends ClusterBaseDO> {
+
+ /**
+ * TODO 只有 非 CAP 模式的 runtime调用此方法。 CAP 模式的 runtime 更新默认为 Cluster 更新
+ */
+ void registerRuntime(RuntimeEntity runtimeEntity, T t, ColonyDO<C> colonyDO);
+
+ /**
+ * TODO 只有 非 CAP 模式的 runtime调用此方法。 CAP 模式的 runtime 更新默认为 Cluster 更新
+ */
+ void unRegisterRuntime(RuntimeEntity runtimeEntity, T t, ColonyDO<C> colonyDO);
+
+ void registerCluster(ClusterEntity clusterEntity, C c, ColonyDO<C> colonyDO);
+
+ void unRegisterCluster(ClusterEntity clusterEntity, C c, ColonyDO<C> colonyDO);
+ }
+
+ @SuppressWarnings("rawtypes")
+ private static class QueueConditionHandler {
+
+ private QueueCondition queueCondition;
+
+ private ColonyDO<ClusterDO> colonyDO;
+
+ private Map<Long, ColonyDO<ClusterDO>> currentColonyDOMap;
+
+ private final List<Object> resultData = new ArrayList<>();
+
+ public <T> T handler() {
+ this.getColonyDOMap();
+ if (MapUtils.isEmpty(currentColonyDOMap)) {
+ return (T) resultData;
+ }
+ this.currentColonyDOMap.forEach((k, v) -> {
+ this.handlerData(v);
+ });
+ return (T) this.resultData;
+ }
+
+ public void getColonyDOMap() {
+ if (this.queueCondition.clusterType == ClusterType.META) {
+ this.currentColonyDOMap = this.colonyDO.getMetaColonyDOList();
+ } else if (this.queueCondition.clusterType == ClusterType.RUNTIME) {
+ this.currentColonyDOMap = this.colonyDO.getRuntimeColonyDOMap();
+ } else if (this.queueCondition.clusterType == ClusterType.STORAGE) {
+ this.currentColonyDOMap = this.colonyDO.getStorageColonyDOMap();
+ }
+ }
+
+ public void handlerData(ColonyDO colonyDO) {
+ if (this.queueCondition.resultType == ClusterType.CLUSTER) {
+ if (this.queueCondition.resultId) {
+ resultData.add(colonyDO.getClusterId());
+ } else {
+ resultData.add(colonyDO.getClusterDO().getClusterInfo());
+ }
+ } else {
+ Map<Long, Object> data = colonyDO.getClusterDO().getRuntimeMap();
+ resultData.add(this.queueCondition.resultId ? data.keySet() : data.values());
+ }
+ }
+
+
+ }
+
+
+ public static class QueueCondition {
+
+ private Long clusterId;
+
+ /**
+ *
+ */
+ private ClusterType clusterType;
+
+ private final ClusterType resultType = ClusterType.CLUSTER;
+
+ private boolean resultId = false;
+
+
+ public QueueCondition clusterId(Long clusterId) {
+ this.clusterId = clusterId;
+ return this;
+ }
+
+ public QueueCondition clusterType(ClusterType clusterType) {
+ this.clusterType = clusterType;
+ return this;
+ }
+
+ public QueueCondition meta() {
+ this.clusterType = ClusterType.META;
+ return this;
+ }
+
+ public QueueCondition storage() {
+ this.clusterType = ClusterType.STORAGE;
+ return this;
+ }
+
+ public QueueCondition runtime() {
+ this.clusterType = ClusterType.RUNTIME;
+ return this;
+ }
+
+ public QueueCondition() {
+ }
+
+ public QueueCondition resultId() {
+ this.resultId = true;
+ return this;
+ }
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/metadata/ClusterOperationHandler.java
similarity index 68%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/metadata/ClusterOperationHandler.java
index bf167b1..75e2bca 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/metadata/ClusterOperationHandler.java
@@ -15,16 +15,22 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.console.domain.metadata;
-@Data
-public class ChangeConfigEntity {
+import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
- private String configName;
+/**
+ *
+ */
+public interface ClusterOperationHandler {
- private String configValue;
- private Integer alreadyUpdate;
+ void handler(RuntimeMetadata baseSyncBase);
+
+
+ void handler(ClusterMetadata clusterDO);
+
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/metadata/MetadataAllDO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/metadata/MetadataAllDO.java
new file mode 100644
index 0000000..aa8fefa
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/domain/metadata/MetadataAllDO.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.domain.metadata;
+
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.AbstractMultiCreateSDKConfig;
+
+import java.util.List;
+
+import lombok.Builder;
+import lombok.Data;
+
+@Data
+@Builder
+public class MetadataAllDO {
+
+ private List<ClusterEntity> clusterEntityList;
+
+ private List<ClusterRelationshipEntity> clusterRelationshipEntityList;
+
+ private List<RuntimeEntity> runtimeEntityList;
+
+ private List<AbstractMultiCreateSDKConfig> abstractMultiCreateSDKConfigList;
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/BaseEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/BaseEntity.java
index 59c0a67..874a48f 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/BaseEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/BaseEntity.java
@@ -15,8 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+
import java.io.Serializable;
import java.time.LocalDateTime;
@@ -27,10 +30,13 @@
/**
* Base Entity provide some basic fields that every Eventmesh Dashboard Entity would have
+ * <p>
+ * 12 broker -> 12 queue , 11 queue , 1broker 没有 队列。 副本,随机出现在一个 broker
*/
@Data
-@EqualsAndHashCode(callSuper = false, exclude = {"createTime", "updateTime"})
+@EqualsAndHashCode(callSuper = false)
@Schema(name = "BaseEntity", description = "Base entity")
+@Deprecated
public class BaseEntity implements Serializable {
private static final long serialVersionUID = -2697805837923579585L;
@@ -40,9 +46,16 @@
@Schema(name = "id", description = "primary key")
protected Long id;
+ /**
+ * 集群id,不是 eventmesh集群id。
+ */
protected Long clusterId;
+ protected ClusterType clusterType;
+
protected LocalDateTime createTime;
protected LocalDateTime updateTime;
+
+ private Integer status;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/CreateConnectionEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/CreateConnectionEntity.java
deleted file mode 100644
index 1f453fe..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/CreateConnectionEntity.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.entity;
-
-import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectionEntity;
-import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectorConfigEntity;
-
-import lombok.Data;
-
-@Data
-public class CreateConnectionEntity {
-
- private Long clusterId;
-
- private AddConnectionEntity addConnectionEntity;
-
- private AddConnectorConfigEntity addConnectorConfigEntity;
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/DefaultConfigKey.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/DefaultConfigKey.java
index c4f2e8c..49d740e 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/DefaultConfigKey.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/DefaultConfigKey.java
@@ -15,12 +15,18 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor
+@AllArgsConstructor
@Data
+@Deprecated
public class DefaultConfigKey {
private String businessType;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/StoreEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/StoreEntity.java
index 78e28d4..a8046f8 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/StoreEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/StoreEntity.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity;
@@ -22,7 +23,8 @@
import lombok.EqualsAndHashCode;
@Data
-@EqualsAndHashCode(callSuper = true, exclude = "status")
+@EqualsAndHashCode(callSuper = true)
+@Deprecated
public class StoreEntity extends BaseEntity {
private Long clusterId;
@@ -44,8 +46,6 @@
private String rack;
- private Short status;
-
private String endpointMap;
private Long startTimestamp;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseClusterIdEntity.java
similarity index 73%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseClusterIdEntity.java
index 6dafeef..276089e 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseClusterIdEntity.java
@@ -15,20 +15,21 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+package org.apache.eventmesh.dashboard.console.entity.base;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+
@Data
-public class UpdateConfigsLog {
-
- private Long instanceId;
+@EqualsAndHashCode(callSuper = true)
+public abstract class BaseClusterIdEntity extends BaseOrganizationEntity {
private Long clusterId;
- private String name;
-
- private String configProperties;
+ private ClusterType clusterType;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseIdEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseIdEntity.java
new file mode 100644
index 0000000..a4897c2
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseIdEntity.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.entity.base;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+import lombok.Data;
+
+@Data
+public class BaseIdEntity implements Serializable {
+
+ private Long id;
+
+ private LocalDateTime createTime;
+
+ private Long createUserId;
+
+ private LocalDateTime updateTime;
+
+ private Long updateUserId;
+
+ /**
+ * 数据展示过程,操作必须是具体的行为 过程有:等待,完成,中 具体操作是一个有动词+名词的行为:停止扩容, 一个操作允许有多个过程。是否可以在过程中取消行为 集群创建中 关闭集群:停止集群的运行,可以让重启集群 删除集群: 关闭集群之后,可以备份数据,删除集群数据 扩容中, 缩容中
+ * 重启前检查: 检查 集群依赖情况 检查 资源(最低集群) -> 资源上锁
+ * <p>
+ * 重启: 检查 集群依赖情况 申请资源 -> 申请失败 -> 申请成功 -> 部署A集群 -> 部署B集群 -> 部署成功 -> 测试 -> 开始心跳测试 -> 心跳测试中 -> 心跳测试成功 -> 开始数据测试 -> 数据测试中 -> 数据测试成功 等待资源释放 -> 资源释放中 ->
+ * 资源释放失败 -> 完成资源释放 -> 重启集群 -> -> 删除集群数据 -> 删除集群数据中 -> 完成集群数据删除 ->
+ * <p>
+ * 数据状态: 集群状态: 是否与集群状态共享 启动中 运行 停运中 已停运 卸载中 完成卸载 作废 运维状态:
+ * <p>
+ * 检查状态,独立一个字段。用 二进制方式 1. 心跳失败 2. 配置异常 3.
+ */
+ private Long status;
+
+ private Integer isDelete;
+
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseOrganizationEntity.java
similarity index 78%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseOrganizationEntity.java
index bf167b1..622fe75 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseOrganizationEntity.java
@@ -15,16 +15,19 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+
+package org.apache.eventmesh.dashboard.console.entity.base;
+
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class ChangeConfigEntity {
+@EqualsAndHashCode(callSuper = true)
+public class BaseOrganizationEntity extends BaseIdEntity {
- private String configName;
- private String configValue;
+ private Long organizationId;
- private Integer alreadyUpdate;
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseRuntimeIdEntity.java
similarity index 78%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseRuntimeIdEntity.java
index bf167b1..0c89a9d 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseRuntimeIdEntity.java
@@ -15,16 +15,17 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+
+package org.apache.eventmesh.dashboard.console.entity.base;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class ChangeConfigEntity {
+@EqualsAndHashCode(callSuper = true)
+public class BaseRuntimeIdEntity extends BaseClusterIdEntity {
- private String configName;
+ private Long runtimeId;
- private String configValue;
- private Integer alreadyUpdate;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseSyncEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseSyncEntity.java
new file mode 100644
index 0000000..cf12538
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseSyncEntity.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.entity.base;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType.FirstToWhom;
+import org.apache.eventmesh.dashboard.common.enums.DeployStatusType;
+import org.apache.eventmesh.dashboard.common.enums.ReplicationType;
+import org.apache.eventmesh.dashboard.common.enums.SyncErrorType;
+
+import java.time.LocalDateTime;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 此类 runtime 与 cluster 共用
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public abstract class BaseSyncEntity extends BaseClusterIdEntity {
+
+ private String name;
+
+ private String version;
+
+ private ClusterTrusteeshipType trusteeshipType;
+
+ private FirstToWhom firstToWhom;
+
+ private FirstToWhom firstSyncState;
+
+ private ReplicationType replicationType;
+
+ private SyncErrorType syncErrorType;
+
+ private DeployStatusType deployStatusType;
+
+ private Long resourcesConfigId;
+
+ private Long deployScriptId;
+
+ private String deployScriptName;
+
+ private String deployScriptVersion;
+
+ /**
+ * 不想加字段,这个字段作为 port 的索引,目前只支持范围获得
+ */
+ private Integer runtimeIndex;
+
+ /**
+ * 上线时间
+ */
+ private LocalDateTime onlineTimestamp;
+
+ /**
+ * 下线时间
+ */
+ private LocalDateTime offlineTimestamp;
+
+
+ private LocalDateTime startTimestamp;
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cases/CaseEntity.java
similarity index 66%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cases/CaseEntity.java
index 6dafeef..6b6a233 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cases/CaseEntity.java
@@ -15,20 +15,29 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+package org.apache.eventmesh.dashboard.console.entity.cases;
+
+import org.apache.eventmesh.dashboard.console.entity.base.BaseOrganizationEntity;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class UpdateConfigsLog {
+@EqualsAndHashCode(callSuper = true)
+public class CaseEntity extends BaseOrganizationEntity {
- private Long instanceId;
- private Long clusterId;
+ private String caseType;
- private String name;
+ /**
+ * cluster , runtime
+ */
+ private String objectType;
- private String configProperties;
+ /**
+ *
+ */
+ private String objectId;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cases/DeployScriptEntity.java
similarity index 69%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cases/DeployScriptEntity.java
index 2102c5c..cb1ebd3 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cases/DeployScriptEntity.java
@@ -15,36 +15,32 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.cluster;
-import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+package org.apache.eventmesh.dashboard.console.entity.cases;
+
import org.apache.eventmesh.dashboard.common.enums.ClusterType;
-
-import javax.validation.constraints.NotNull;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseOrganizationEntity;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class CreateClusterDTO {
+@EqualsAndHashCode(callSuper = true)
+public class DeployScriptEntity extends BaseOrganizationEntity {
- @NotNull
private String name;
- @NotNull
- private ClusterTrusteeshipType trusteeshipType;
-
- @NotNull
- private ClusterType clusterType;
-
- @NotNull
private String version;
+ private ClusterType clusterType;
- private String jmxProperties = "";
+ private String description;
- private String description = "";
+ private String startRuntimeVersion;
+ private String endRuntimeVersion;
- private Integer authType = 0;
+ private String content;
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cases/PortEntity.java
similarity index 73%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cases/PortEntity.java
index bf167b1..bedfe57 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cases/PortEntity.java
@@ -15,16 +15,18 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+
+package org.apache.eventmesh.dashboard.console.entity.cases;
+
+import org.apache.eventmesh.dashboard.console.entity.base.BaseClusterIdEntity;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class ChangeConfigEntity {
+@EqualsAndHashCode(callSuper = true)
+public class PortEntity extends BaseClusterIdEntity {
- private String configName;
+ private Integer currentPort;
- private String configValue;
-
- private Integer alreadyUpdate;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cases/ResouceEntity.java
similarity index 74%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cases/ResouceEntity.java
index bf167b1..b5d6b3d 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cases/ResouceEntity.java
@@ -15,16 +15,18 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+
+package org.apache.eventmesh.dashboard.console.entity.cases;
+
+import org.apache.eventmesh.dashboard.console.entity.base.BaseOrganizationEntity;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class ChangeConfigEntity {
+@EqualsAndHashCode(callSuper = true)
+public class ResouceEntity extends BaseOrganizationEntity {
- private String configName;
- private String configValue;
- private Integer alreadyUpdate;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cases/ResourcesConfigEntity.java
similarity index 73%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cases/ResourcesConfigEntity.java
index bf167b1..f1606fa 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cases/ResourcesConfigEntity.java
@@ -15,16 +15,24 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+
+package org.apache.eventmesh.dashboard.console.entity.cases;
+
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class ChangeConfigEntity {
+@EqualsAndHashCode(callSuper = true)
+public class ResourcesConfigEntity extends CaseEntity {
- private String configName;
+ private Float cpuNum;
- private String configValue;
+ private Float memNum;
- private Integer alreadyUpdate;
+ private Float diskNum;
+
+ private Float gpuNum;
+
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/AclEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/AclEntity.java
index b19bbb6..b300b6d 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/AclEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/AclEntity.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity.cluster;
import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClientEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClientEntity.java
index 452805f..823e2d1 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClientEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClientEntity.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity.cluster;
-import org.apache.eventmesh.dashboard.common.enums.RecordStatus;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseRuntimeIdEntity;
import java.sql.Timestamp;
@@ -28,17 +28,11 @@
import lombok.EqualsAndHashCode;
@Data
-@EqualsAndHashCode(callSuper = true, exclude = "status")
-public class ClientEntity extends BaseEntity {
+@EqualsAndHashCode(callSuper = true)
+public class ClientEntity extends BaseRuntimeIdEntity {
private static final long serialVersionUID = 8204133370609215856L;
- /**
- * Primary key
- */
- @Schema(name = "id", description = "primary key")
- private Long id;
-
private String name;
private String platform;
@@ -65,13 +59,6 @@
@Schema(name = "protocol", example = "http", allowableValues = {"http", "grpc", "tcp"})
private String protocol;
- /**
- * 0: not active, 1: active
- *
- * @see RecordStatus
- */
- @Schema(name = "status", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:not active, 1:active")
- private Integer status;
/**
* csv format config id list.<br> Example value: 1,2,7<br> This field is updated when the configuration is modified via the web API, but is not
@@ -87,8 +74,5 @@
private Timestamp endTime;
- public void setStatusEntity(RecordStatus status) {
- this.status = status.getNumber();
- }
}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterAndRelationshipEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterAndRelationshipEntity.java
index 78b008c..c200814 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterAndRelationshipEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterAndRelationshipEntity.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity.cluster;
import org.apache.eventmesh.dashboard.common.enums.ClusterType;
@@ -22,8 +23,10 @@
import java.time.LocalDateTime;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
+@EqualsAndHashCode(callSuper = true)
public class ClusterAndRelationshipEntity extends ClusterEntity {
private LocalDateTime relationshipTime;
@@ -32,6 +35,6 @@
private ClusterType relationshipType;
- private Integer status;
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterEntity.java
index 121fe8e..76000b3 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterEntity.java
@@ -15,36 +15,35 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity.cluster;
-import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
-import org.apache.eventmesh.dashboard.common.enums.ClusterType;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
-
+import org.apache.eventmesh.dashboard.common.enums.ClusterOwnType;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseSyncEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
+/**
+ *
+ */
@Data
-@EqualsAndHashCode(callSuper = true, exclude = "status")
-public class ClusterEntity extends BaseEntity {
+@EqualsAndHashCode(callSuper = true)
+public class ClusterEntity extends BaseSyncEntity {
- private String name;
-
- private ClusterTrusteeshipType trusteeshipType;
-
- private ClusterType clusterType;
-
- private String version;
private String jmxProperties;
+ private String config;
+
private String description;
- private Integer authType;
+ private String authType;
- private Integer runState;
- private Integer status;
+ /**
+ * 如何解除共享
+ */
+ private ClusterOwnType clusterOwnType;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterRelationshipEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterRelationshipEntity.java
index c930ed1..2b1baae 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterRelationshipEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterRelationshipEntity.java
@@ -15,22 +15,32 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity.cluster;
import org.apache.eventmesh.dashboard.common.enums.ClusterType;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseClusterIdEntity;
+
+import java.time.LocalDateTime;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class ClusterRelationshipEntity extends BaseEntity {
+@EqualsAndHashCode(callSuper = true)
+public class ClusterRelationshipEntity extends BaseClusterIdEntity {
- private ClusterType clusterType;
+ /**
+ *
+ */
private Long relationshipId;
private ClusterType relationshipType;
- private Integer status;
+ private LocalDateTime relationshipTime;
+
+ private LocalDateTime unRelationshipTime;
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ConnectionEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ConnectionEntity.java
index 9f8468a..1444cf3 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ConnectionEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ConnectionEntity.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity.cluster;
-import org.apache.eventmesh.dashboard.common.enums.RecordStatus;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseRuntimeIdEntity;
import java.sql.Timestamp;
@@ -32,8 +32,8 @@
* A Connection is a link from a source to a sink.
*/
@Data
-@EqualsAndHashCode(callSuper = true, exclude = {"status", "endTime"})
-public class ConnectionEntity extends BaseEntity {
+@EqualsAndHashCode(callSuper = true)
+public class ConnectionEntity extends BaseRuntimeIdEntity {
private static final long serialVersionUID = 6565578252656944905L;
@@ -69,9 +69,6 @@
private Long runtimeId;
- @Schema(name = "status", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:inactive, 1:active")
- private Integer status;
-
private String topic;
private Long groupId;
@@ -80,8 +77,4 @@
private String description;
-
- public void setStatusEnum(RecordStatus statusEnum) {
- this.status = statusEnum.getNumber();
- }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/InstanceUserEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/InstanceUserEntity.java
index 35c0fc5..89b2162 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/InstanceUserEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/InstanceUserEntity.java
@@ -15,17 +15,18 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity.cluster;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseRuntimeIdEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
-@EqualsAndHashCode(callSuper = true, exclude = "status")
-public class InstanceUserEntity extends BaseEntity {
+@EqualsAndHashCode(callSuper = true)
+public class InstanceUserEntity extends BaseRuntimeIdEntity {
private Integer instanceType;
@@ -37,6 +38,4 @@
private String token;
- private Integer status;
-
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/NetConnectionEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/NetConnectionEntity.java
index f9785fb..e4a27b6 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/NetConnectionEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/NetConnectionEntity.java
@@ -15,9 +15,10 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity.cluster;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseRuntimeIdEntity;
import java.time.LocalDateTime;
@@ -26,7 +27,7 @@
@Data
@EqualsAndHashCode(callSuper = true)
-public class NetConnectionEntity extends BaseEntity {
+public class NetConnectionEntity extends BaseRuntimeIdEntity {
private Long clusterId;
@@ -41,7 +42,6 @@
private Integer runtimePort;
- private int status;
private String description;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/RuntimeEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/RuntimeEntity.java
index 750f265..3850d0d 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/RuntimeEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/RuntimeEntity.java
@@ -15,11 +15,10 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity.cluster;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
-
-import java.time.LocalDateTime;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseSyncEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -28,23 +27,30 @@
*
*/
@Data
-@EqualsAndHashCode(callSuper = true, exclude = "status")
-public class RuntimeEntity extends BaseEntity {
-
- private String name;
+@EqualsAndHashCode(callSuper = true)
+public class RuntimeEntity extends BaseSyncEntity {
private String host;
+ /**
+ * 添加的时候只需要 host 与 post eventmesh runtime 是 admin port。通过 runtime admin 获得所有的配置。 meta 需要 host 与 post store host 与 post jmxPort
+ */
private Integer port;
private Integer jmxPort;
- private LocalDateTime startTimestamp;
+ private Integer adminPort;
private String rack;
- private Integer status;
-
private String endpointMap;
+ private String createScriptContent;
+
+ private Long kubernetesClusterId;
+
+ private String authType;
+
+
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connector/ConnectorEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connector/ConnectorEntity.java
index 5bab3fc..416df43 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connector/ConnectorEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connector/ConnectorEntity.java
@@ -15,11 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity.connector;
import org.apache.eventmesh.dashboard.common.enums.KubernetesPodStatus;
-import org.apache.eventmesh.dashboard.common.enums.RecordStatus;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseRuntimeIdEntity;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -27,8 +27,8 @@
import lombok.EqualsAndHashCode;
@Data
-@EqualsAndHashCode(callSuper = true, exclude = "status")
-public class ConnectorEntity extends BaseEntity {
+@EqualsAndHashCode(callSuper = true)
+public class ConnectorEntity extends BaseRuntimeIdEntity {
private static final long serialVersionUID = -8226303660232951326L;
@@ -40,14 +40,6 @@
private String type;
- /**
- * 0: not active, 1: active
- *
- * @see RecordStatus
- */
- @Schema(name = "status", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:inactive, 1:active")
- private Integer status;
-
private String host;
private Integer port;
@@ -65,9 +57,6 @@
*/
private String configIds;
- public void setStatusEnum(RecordStatus statusEnum) {
- this.status = statusEnum.getNumber();
- }
public void setKubernetesPodStatusEnum(KubernetesPodStatus kubernetesPodStatusEnum) {
this.podState = kubernetesPodStatusEnum.getNumber();
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/ConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/ConfigEntity.java
index cdf3140..e1c23d2 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/ConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/ConfigEntity.java
@@ -15,30 +15,33 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity.function;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+import org.apache.eventmesh.dashboard.common.enums.MetadataType;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseClusterIdEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
-public class ConfigEntity extends BaseEntity {
+public class ConfigEntity extends BaseClusterIdEntity {
- private Long id;
-
- private Long clusterId;
private String businessType;
+ private Long retrospectId;
+
/**
* config type 0:runtime,1:storage,2:connector,3:topic
*/
- private Integer instanceType;
+ private MetadataType instanceType;
private Long instanceId;
+ private String configType;
+
private String configName;
private String configValue;
@@ -47,8 +50,6 @@
private String eventmeshVersion;
- private Integer status;
-
private String endVersion;
private Integer diffType;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/ConfigGatherEntity.java
similarity index 79%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/ConfigGatherEntity.java
index 6dafeef..3b05028 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/ConfigGatherEntity.java
@@ -15,20 +15,16 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+package org.apache.eventmesh.dashboard.console.entity.function;
-import lombok.Data;
+import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
-@Data
-public class UpdateConfigsLog {
+public class ConfigGatherEntity extends BaseEntity {
- private Long instanceId;
-
- private Long clusterId;
private String name;
- private String configProperties;
+ private String description;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/HealthCheckResultEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/HealthCheckResultEntity.java
index 657d217..4e22de6 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/HealthCheckResultEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/HealthCheckResultEntity.java
@@ -15,25 +15,47 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity.function;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckStatus;
+import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckTypeEnum;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseRuntimeIdEntity;
+
+import java.time.LocalDateTime;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
-
+// state of a health check, 0: failed, 1: passed, 2: doing check, 3: out of time, 4: not connected
@Data
@EqualsAndHashCode(callSuper = true, exclude = "resultDesc")
@Schema(name = "HealthCheckResultEntity", description = "Health check result entity")
-public class HealthCheckResultEntity extends BaseEntity {
+public class HealthCheckResultEntity extends BaseRuntimeIdEntity {
private static final long serialVersionUID = -7350585209577598040L;
- private Long clusterId;
+ private ClusterType clusterType;
+
+ private String protocol;
+
+ private String interfaces;
+
+ private HealthCheckTypeEnum healthCheckTypeEnum;
+
+ private HealthCheckStatus result;
+
+ private String resultDesc;
+
+ private LocalDateTime beginTime;
+
+ private LocalDateTime finishTime;
+
+
@Schema(description = "Type of Health Check;0:Unknown, 1:Cluster, 2:Runtime, 3:Topic, 4:Storage", defaultValue = "0", allowableValues = {"0",
"1", "2", "3", "4"})
@@ -42,9 +64,5 @@
@Schema(description = "Instance id(database schema) of the health check object")
private Long typeId;
- private String resultDesc;
-
- @Schema(description = "state of a health check, 0: failed, 1: passed, 2: doing check, 3: out of time, 4: not connected")
- private Integer state;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/LogEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/LogEntity.java
index 7a07089..e7d855e 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/LogEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/LogEntity.java
@@ -15,19 +15,24 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity.function;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseRuntimeIdEntity;
import java.sql.Timestamp;
+import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
@Data
-@EqualsAndHashCode(callSuper = true, exclude = {"endTime", "operationUser", "result"})
-public class LogEntity extends BaseEntity {
+@NoArgsConstructor
+@AllArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+public class LogEntity extends BaseRuntimeIdEntity {
private Long id;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/MetadataSyncResultEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/MetadataSyncResultEntity.java
new file mode 100644
index 0000000..3baa566
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/MetadataSyncResultEntity.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.entity.function;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+import org.apache.eventmesh.dashboard.common.enums.MetadataType;
+import org.apache.eventmesh.dashboard.common.enums.SyncErrorType;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseRuntimeIdEntity;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class MetadataSyncResultEntity extends BaseRuntimeIdEntity {
+
+
+ private Long syncId;
+
+ private MetadataType metadataType;
+
+ private String errorType;
+
+ private ClusterTrusteeshipType clusterTrusteeshipType;
+
+ private boolean isFast = false;
+
+ private SyncErrorType syncErrorType;
+
+ private String resultData;
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/ConsumeOffsetEntity.java
similarity index 73%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/ConsumeOffsetEntity.java
index 344d02d..e7f3dda 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/ConsumeOffsetEntity.java
@@ -17,26 +17,23 @@
package org.apache.eventmesh.dashboard.console.entity.message;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
-
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
-@EqualsAndHashCode(callSuper = true, exclude = "status")
-public class GroupMemberEntity extends BaseEntity {
+@EqualsAndHashCode(callSuper = true)
+public class ConsumeOffsetEntity extends TopicOffsetEntity {
- private Long id;
+ private Long subscribeId;
- private Long clusterId;
-
- private String topicName;
+ private Long groupId;
private String groupName;
- private String eventMeshUser;
+ private Long consumeOffset;
- private String state;
+ private Integer consumeRate;
- private Integer status;
+ private Long delayNum;
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupEntity.java
index b081d44..d4ce306 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupEntity.java
@@ -15,20 +15,17 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity.message;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseRuntimeIdEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
-@EqualsAndHashCode(callSuper = true, exclude = "status")
-public class GroupEntity extends BaseEntity {
-
- private Long id;
-
- private Long clusterId;
+@EqualsAndHashCode(callSuper = true)
+public class GroupEntity extends BaseRuntimeIdEntity {
private String name;
@@ -38,8 +35,4 @@
private Integer type;
- private String state;
-
- private Integer status;
-
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/SubscriptionEntity.java
similarity index 78%
rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java
rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/SubscriptionEntity.java
index 344d02d..cfd36cf 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/SubscriptionEntity.java
@@ -15,20 +15,17 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity.message;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseRuntimeIdEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
-@EqualsAndHashCode(callSuper = true, exclude = "status")
-public class GroupMemberEntity extends BaseEntity {
-
- private Long id;
-
- private Long clusterId;
+@EqualsAndHashCode(callSuper = true)
+public class SubscriptionEntity extends BaseRuntimeIdEntity {
private String topicName;
@@ -36,7 +33,4 @@
private String eventMeshUser;
- private String state;
-
- private Integer status;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/TopicEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/TopicEntity.java
index 9b70bf8..699a970 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/TopicEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/TopicEntity.java
@@ -15,9 +15,10 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.entity.message;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseRuntimeIdEntity;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -25,30 +26,44 @@
import lombok.EqualsAndHashCode;
@Data
-@EqualsAndHashCode(callSuper = true, exclude = "status")
-public class TopicEntity extends BaseEntity {
+@EqualsAndHashCode(callSuper = true)
+public class TopicEntity extends BaseRuntimeIdEntity {
- private Long id;
- private Long clusterId;
+ private String topicType;
private String topicName;
- private Long storageId;
+
+ /**
+ *
+ */
+ private Long numQueue;
+
+ /**
+ * 副本个数
+ */
+ private Integer replicationFactor;
+
+ /**
+ * topic 拦截器类型
+ */
+ private String topicFilterType;
+
+ /**
+ * 不确定参数
+ */
+ private String attributes;
+
+ private String order;
@Schema(description = "time to live in milliseconds, -2 unknown, -1 no limit;", example = "1000")
private Long retentionMs;
- /**
- * topic type, 0: normal, 1: EventMesh internal;
- */
- @Schema(description = "topic type, 0: normal, 1: EventMesh internal;", example = "0")
- private Integer type;
private String description;
- private Integer status;
private Integer createProgress;
-
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/TopicOffsetEntity.java
similarity index 73%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/TopicOffsetEntity.java
index 344d02d..04d3845 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/TopicOffsetEntity.java
@@ -17,26 +17,24 @@
package org.apache.eventmesh.dashboard.console.entity.message;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseRuntimeIdEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
-@EqualsAndHashCode(callSuper = true, exclude = "status")
-public class GroupMemberEntity extends BaseEntity {
+@EqualsAndHashCode(callSuper = true)
+public class TopicOffsetEntity extends BaseRuntimeIdEntity {
- private Long id;
+ private String offsetRecordType;
- private Long clusterId;
+ private Long topicId;
private String topicName;
- private String groupName;
+ private Long topicOffset;
- private String eventMeshUser;
+ private Integer increaseRate;
- private String state;
- private Integer status;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/exception/GlobalExceptionHandler.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/exception/GlobalExceptionHandler.java
deleted file mode 100644
index f61431f..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/exception/GlobalExceptionHandler.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.exception;
-
-import org.apache.eventmesh.dashboard.common.dto.Result;
-import org.apache.eventmesh.dashboard.common.dto.Result.StatusMessage;
-import org.apache.eventmesh.dashboard.common.enums.Status;
-import org.apache.eventmesh.dashboard.common.exception.BaseException;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.RestControllerAdvice;
-
-import lombok.extern.slf4j.Slf4j;
-
-/**
- * This class, in conjunction with {@linkplain Status Status} and {@link BaseException}, collectively implements customized error reporting.
- */
-
-@Slf4j
-@RestControllerAdvice
-public class GlobalExceptionHandler {
-
- @ExceptionHandler(BaseException.class)
- public ResponseEntity<Result<Object>> baseHandler(BaseException e, HttpServletRequest request) {
- String uri = request.getRequestURI();
- log.error("RESTful API {} service error occurred, name: {}, category: {}",
- uri, e.getStatus().name(), e.getStatus().getCategory().name(), e);
- return ResponseEntity.status(e.getStatus().getCode()).body(new Result<>(new StatusMessage(e)));
- }
-
- @ExceptionHandler(RuntimeException.class)
- public ResponseEntity<Result<Object>> runtimeHandler(RuntimeException e, HttpServletRequest request) {
- String uri = request.getRequestURI();
- log.error("RESTful API {} runtime error occurred.", uri, e);
- return Result.internalError(e.getMessage());
- }
-
- @ExceptionHandler(Exception.class)
- public ResponseEntity<Result<Object>> exceptionHandler(Exception e, HttpServletRequest request) {
- String uri = request.getRequestURI();
- log.error("RESTful API {} unknown error occurred.", uri, e);
- return Result.internalError(e.getMessage());
- }
-
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/CheckResultCache.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/CheckResultCache.java
index 512ea12..90e63ba 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/CheckResultCache.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/CheckResultCache.java
@@ -15,11 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.function.health;
import org.apache.eventmesh.dashboard.common.constant.health.HealthConstant;
import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckStatus;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
import java.time.LocalDateTime;
import java.util.Collections;
@@ -41,7 +41,7 @@
private CheckResultCache() {
}
- public Integer getLastHealthyCheckResult(String type, Long typeId) {
+ public Long getLastHealthyCheckResult(String type, Long typeId) {
if (!Objects.isNull(cacheMap.get(type)) && !Objects.isNull(cacheMap.get(type).get(typeId))) {
return cacheMap.get(type).get(typeId).getStatus().getNumber();
}
@@ -61,17 +61,17 @@
}
description += " Latency: " + latency.toString() + "ms";
CheckResult result = new CheckResult(status, description, LocalDateTime.now(),
- latency, oldResult.getConfig());
+ latency);
subMap.put(typeId, result);
}
- public void update(String type, Long typeId, HealthCheckStatus status, String resultDesc, Long latency, HealthCheckObjectConfig config) {
+ public void update1(String type, Long typeId, HealthCheckStatus status, String resultDesc, Long latency) {
HashMap<Long, CheckResult> subMap = cacheMap.get(type);
if (Objects.isNull(subMap)) {
subMap = new HashMap<>();
cacheMap.put(type, subMap);
}
- subMap.put(typeId, new CheckResult(status, resultDesc, LocalDateTime.now(), latency, config));
+ subMap.put(typeId, new CheckResult(status, resultDesc, LocalDateTime.now(), latency));
}
public Map<String, HashMap<Long, CheckResult>> getCacheMap() {
@@ -101,7 +101,5 @@
* latency of a health check, for example ping latency.
*/
private Long latencyMilliSeconds;
-
- private HealthCheckObjectConfig config;
}
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/Health2Service.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/Health2Service.java
new file mode 100644
index 0000000..5c938fc
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/Health2Service.java
@@ -0,0 +1,272 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.function.health;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckStatus;
+import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckTypeEnum;
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
+import org.apache.eventmesh.dashboard.common.util.ClasspathScanner;
+import org.apache.eventmesh.dashboard.console.entity.function.HealthCheckResultEntity;
+import org.apache.eventmesh.dashboard.console.function.health.annotation.HealthCheckType;
+import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
+import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService;
+import org.apache.eventmesh.dashboard.console.function.health.check.ClusterHealthCheckService;
+import org.apache.eventmesh.dashboard.console.function.health.check.HealthCheckService;
+import org.apache.eventmesh.dashboard.console.service.function.HealthDataService;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKManage;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import lombok.Data;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class Health2Service {
+
+ private static final Map<ClusterType, Class<?>> HEALTH_PING_CHECK_CLASS_CACHE = new HashMap<>();
+
+ private static final Map<ClusterType, Class<?>> HEALTH_TOPIC_CHECK_CLASS_CACHE = new HashMap<>();
+
+ static {
+ Set<Class<?>> interfaceSet = new HashSet<>();
+ interfaceSet.add(HealthCheckService.class);
+ ClasspathScanner classpathScanner =
+ ClasspathScanner.builder().base(Health2Service.class).subPath("/check/impl/**").interfaceSet(interfaceSet).build();
+ try {
+ List<Class<?>> classList = classpathScanner.getClazz();
+ classList.forEach(Health2Service::setClassCache);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+ private static void setClassCache(Class<?> clazz) {
+ HealthCheckType checkType = clazz.getAnnotation(HealthCheckType.class);
+ if (Objects.isNull(checkType)) {
+ return;
+ }
+ Map<ClusterType, Class<?>> map =
+ Objects.equals(checkType.healthType(), HealthCheckTypeEnum.PING) ? HEALTH_PING_CHECK_CLASS_CACHE : HEALTH_TOPIC_CHECK_CLASS_CACHE;
+
+ for (ClusterType clusterType : checkType.clusterType()) {
+ map.put(clusterType, clazz);
+ }
+ }
+
+
+ private final Map<String, HealthCheckWrapper> checkServiceMap = new ConcurrentHashMap<>();
+
+ @Deprecated
+ private final Map<Long, ClusterHealthCheckService> clusterHealthCheckServiceMap = new ConcurrentHashMap<>();
+
+
+ private final ThreadPoolExecutor threadPoolExecutor =
+ new ThreadPoolExecutor(32, 32, 5, TimeUnit.SECONDS, new LinkedBlockingDeque<>(), new ThreadFactory() {
+ final AtomicInteger counter = new AtomicInteger(0);
+
+ @Override
+ public Thread newThread(Runnable r) {
+ return new Thread(r, "health-manager-" + counter.incrementAndGet());
+ }
+ });
+
+ @Setter
+ private HealthDataService dataService;
+
+
+ public void register(BaseSyncBase baseSyncBase) {
+ try {
+ this.createHealthCheckWrapper(baseSyncBase, HealthCheckTypeEnum.PING);
+ if (baseSyncBase.getClusterType().isHealthTopic()) {
+ this.createHealthCheckWrapper(baseSyncBase, HealthCheckTypeEnum.TOPIC);
+ }
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+ }
+ }
+
+
+ public void unRegister(BaseSyncBase baseSyncBase) {
+ ClusterHealthCheckService clusterHealthCheckService = this.clusterHealthCheckServiceMap.remove(baseSyncBase.getClusterId());
+ if (Objects.nonNull(clusterHealthCheckService)) {
+ clusterHealthCheckService.unRegister(baseSyncBase);
+ }
+ this.checkServiceMap.remove(getKey(baseSyncBase, HealthCheckTypeEnum.PING));
+ this.checkServiceMap.remove(getKey(baseSyncBase, HealthCheckTypeEnum.TOPIC));
+ }
+
+ @Deprecated
+ public void unRegisterCluster(Long clusterId) {
+ this.clusterHealthCheckServiceMap.remove(clusterId);
+ }
+
+
+ void createHealthCheckWrapper(BaseSyncBase baseSyncBase, HealthCheckTypeEnum healthCheckTypeEnum) {
+ Map<ClusterType, Class<?>> map =
+ Objects.equals(healthCheckTypeEnum, HealthCheckTypeEnum.PING) ? HEALTH_PING_CHECK_CLASS_CACHE : HEALTH_TOPIC_CHECK_CLASS_CACHE;
+ Class<?> clazz = map.get(baseSyncBase.getClusterType());
+ AbstractHealthCheckService<Object> abstractHealthCheckService = SDKManage.getInstance().createAbstractClientInfo(clazz, baseSyncBase);
+ HealthCheckWrapper healthCheckWrapper =
+ this.createHealthCheckWrapper(baseSyncBase, abstractHealthCheckService, healthCheckTypeEnum);
+ this.checkServiceMap.put(healthCheckWrapper.getKey(), healthCheckWrapper);
+ }
+
+ private HealthCheckWrapper createHealthCheckWrapper(BaseSyncBase baseSyncBase,
+ AbstractHealthCheckService<Object> healthCheckService, HealthCheckTypeEnum healthCheckTypeEnum) {
+ HealthCheckWrapper healthCheckWrapper = new HealthCheckWrapper();
+ healthCheckWrapper.setHealthCheckTypeEnum(healthCheckTypeEnum);
+ healthCheckWrapper.setBaseSyncBase(baseSyncBase);
+ healthCheckWrapper.setCheckService(healthCheckService);
+
+ HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity();
+
+ healthCheckWrapper.setHealthCheckResultEntity(healthCheckResultEntity);
+ return healthCheckWrapper;
+ }
+
+ public void executeAll() {
+ long startTime = System.currentTimeMillis();
+ List<HealthCheckResultEntity> healthCheckResultEntityList = new ArrayList<>();
+ CountDownLatch countDownLatch = new CountDownLatch(this.checkServiceMap.size());
+ this.checkServiceMap.forEach((k, wrapper) -> {
+ healthCheckResultEntityList.add(wrapper.createHealthCheckResultEntity());
+ DefaultHealthCheckCallback healthExecutor = new DefaultHealthCheckCallback();
+ healthExecutor.healthCheckWrapper = wrapper;
+ healthExecutor.countDownLatch = countDownLatch;
+ healthExecutor.healthCheckResultEntity = wrapper.getHealthCheckResultEntity();
+
+ threadPoolExecutor.execute(() -> {
+ try {
+ wrapper.checkService.check(healthExecutor);
+ } catch (Exception e) {
+ healthExecutor.onFail(e);
+ }
+ });
+ });
+ try {
+ dataService.batchInsertHealthCheckResult(healthCheckResultEntityList);
+ } catch (Exception e) {
+ log.error("batchInsertHealthCheckResult failed", e);
+ }
+ try {
+ boolean await = countDownLatch.await(3, TimeUnit.SECONDS);
+ log.info("await ia {} downLatch count {}", await, countDownLatch.getCount());
+ log.info(" startup cost {} ms", System.currentTimeMillis() - startTime);
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+ } finally {
+ try {
+ dataService.batchUpdateCheckResultByClusterIdAndTypeAndTypeId(healthCheckResultEntityList);
+ } catch (Exception e) {
+ log.error("batchUpdateCheckResultByClusterIdAndTypeAndTypeId failed", e);
+ }
+ }
+ }
+
+
+ public String getKey(BaseSyncBase baseSyncBase, HealthCheckTypeEnum healthCheckTypeEnum) {
+ return healthCheckTypeEnum.toString() + "-" + baseSyncBase.getId();
+ }
+
+ static class DefaultHealthCheckCallback implements HealthCheckCallback {
+
+ private HealthCheckWrapper healthCheckWrapper;
+
+ private CountDownLatch countDownLatch;
+
+ private HealthCheckResultEntity healthCheckResultEntity;
+
+ @Override
+ public void onSuccess() {
+ healthCheckResultEntity.setResult(HealthCheckStatus.SUCCESS);
+ healthCheckResultEntity.setFinishTime(LocalDateTime.now());
+ countDownLatch.countDown();
+ }
+
+ @Override
+ public void onFail(Exception e) {
+ healthCheckResultEntity.setResult(HealthCheckStatus.FAILED);
+ healthCheckResultEntity.setResultDesc(e.getMessage());
+ healthCheckResultEntity.setFinishTime(LocalDateTime.now());
+ countDownLatch.countDown();
+ log.error("healthCheckCallback onFail Id: ", e);
+ }
+ }
+
+ @Data
+ class HealthCheckWrapper {
+
+ private BaseSyncBase baseSyncBase;
+
+ private AbstractHealthCheckService<Object> checkService;
+
+
+ private HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity();
+
+
+ private HealthCheckTypeEnum healthCheckTypeEnum;
+
+
+ private HealthCheckResultEntity createHealthCheckResultEntity() {
+ HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity();
+ healthCheckResultEntity.setClusterId(this.baseSyncBase.getClusterId());
+ healthCheckResultEntity.setInterfaces(this.baseSyncBase.getId().toString());
+ healthCheckResultEntity.setHealthCheckTypeEnum(this.healthCheckTypeEnum);
+ healthCheckResultEntity.setClusterType(this.baseSyncBase.getClusterType());
+ healthCheckResultEntity.setBeginTime(LocalDateTime.now());
+ this.healthCheckResultEntity = healthCheckResultEntity;
+ return healthCheckResultEntity;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (object instanceof HealthCheckWrapper) {
+ HealthCheckWrapper wrapper = (HealthCheckWrapper) object;
+ return this.baseSyncBase.getId().equals(wrapper.getBaseSyncBase().getId()) && this.baseSyncBase.getClusterType()
+ .equals(wrapper.getBaseSyncBase().getClusterType());
+ }
+ return false;
+ }
+
+
+ public String getKey() {
+ return Health2Service.this.getKey(this.baseSyncBase, this.healthCheckTypeEnum);
+ }
+
+ }
+
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutor.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutor.java
deleted file mode 100644
index 267bf8b..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutor.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.health;
-
-import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckStatus;
-import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckType;
-import org.apache.eventmesh.dashboard.console.entity.function.HealthCheckResultEntity;
-import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache.CheckResult;
-import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
-import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService;
-import org.apache.eventmesh.dashboard.console.service.function.HealthDataService;
-
-import java.util.ArrayList;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import lombok.Getter;
-import lombok.Setter;
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class HealthExecutor {
-
- private final ExecutorService executorService = Executors.newCachedThreadPool();
- @Setter
- private HealthDataService dataService;
- /**
- * memory cache is used to store real-time health check result.
- */
- @Getter
- @Setter
- private CheckResultCache memoryCache;
-
- /**
- * execute function is where health check services work.
- *
- * @param service The health check service to be executed.
- */
-
- public void execute(AbstractHealthCheckService service) {
- final long startTime = System.currentTimeMillis();
- //TODO: execute is called by a ScheduledThreadPoolExecutor,
- // when called, it should check if current service should doCheck(check service check rate can be dynamically configured).
- try {
- memoryCache.update(service.getConfig().getHealthCheckResourceType(), service.getConfig().getInstanceId(), HealthCheckStatus.CHECKING, "",
- null, service.getConfig());
- //The callback interface is used to pass the processing methods for checking success and failure.
- executorService.submit(() -> service.doCheck(new HealthCheckCallback() {
- @Override
- public void onSuccess() {
- //when the health check is successful, the result is updated to the memory cache.
- Long latency = System.currentTimeMillis() - startTime;
- HealthCheckStatus status =
- latency > service.getConfig().getRequestTimeoutMillis() ? HealthCheckStatus.TIMEOUT : HealthCheckStatus.PASSED;
- memoryCache.update(service.getConfig().getHealthCheckResourceType(), service.getConfig().getInstanceId(),
- status, "Health check succeed.", latency
- );
- }
-
- @Override
- public void onFail(Exception e) {
- //when the health check fails, the result is updated to the memory cache, passing in the exception message.
- log.error("Health check failed for reason: {}. Service config is {}", e, service.getConfig());
- memoryCache.update(service.getConfig().getHealthCheckResourceType(), service.getConfig().getInstanceId(),
- HealthCheckStatus.FAILED, e.getMessage(),
- System.currentTimeMillis() - startTime);
- }
- }));
-
- } catch (Exception e) {
- log.error("Health check failed for reason: {}. Service config is {}", e, service.getConfig());
- memoryCache.update(service.getConfig().getHealthCheckResourceType(), service.getConfig().getInstanceId(), HealthCheckStatus.FAILED,
- e.getMessage(),
- System.currentTimeMillis() - startTime);
- }
- }
-
- /**
- * this function should be called before any actual execute behaviour.<p> It will check the execution result of the last check cycle in the memory
- * cache, set tasks that haven't finished status to time out and update the database.
- */
- public void startExecute() {
- ArrayList<HealthCheckResultEntity> resultList = new ArrayList<>();
- memoryCache.getCacheMap().forEach((type, subMap) -> {
- subMap.forEach((instanceId, result) -> {
- if (result.getStatus() == HealthCheckStatus.CHECKING) {
- result.setStatus(HealthCheckStatus.TIMEOUT);
- }
- addToResultList(result, resultList);
- });
- });
- if (!resultList.isEmpty()) {
- dataService.batchUpdateCheckResultByClusterIdAndTypeAndTypeId(resultList);
- }
- }
-
- /**
- * this function should be called after all actual execute behaviour.<p> It will insert the result of this check cycle into the database. At this
- * point the status of the tasks may be CHECKING, they will be updated on the next startExecute.
- */
- public void endExecute() {
- ArrayList<HealthCheckResultEntity> resultList = new ArrayList<>();
- memoryCache.getCacheMap().forEach((type, subMap) -> {
- subMap.forEach((instanceId, result) -> {
- addToResultList(result, resultList);
- });
- });
- dataService.batchInsertHealthCheckResult(resultList);
- }
-
- /**
- * Helper function to add a CheckResult to the resultList.
- *
- * @param result memory cached result object.
- * @param resultList entity list to be inserted into the database.
- */
- private void addToResultList(CheckResult result, ArrayList<HealthCheckResultEntity> resultList) {
- HealthCheckResultEntity newEntity = new HealthCheckResultEntity();
-
- newEntity.setClusterId(result.getConfig().getClusterId());
- newEntity.setType(HealthCheckType.toNumber(result.getConfig().getHealthCheckResourceType()));
- newEntity.setTypeId(result.getConfig().getInstanceId());
- newEntity.setResultDesc(result.getResultDesc());
- newEntity.setState(result.getStatus().getNumber());
-
- resultList.add(newEntity);
- }
-
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthService.java
deleted file mode 100644
index a28b0e3..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthService.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.health;
-
-import org.apache.eventmesh.dashboard.common.constant.health.HealthCheckTypeConstant;
-import org.apache.eventmesh.dashboard.common.enums.StoreType;
-import org.apache.eventmesh.dashboard.console.entity.StoreEntity;
-import org.apache.eventmesh.dashboard.console.entity.function.HealthCheckResultEntity;
-import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache.CheckResult;
-import org.apache.eventmesh.dashboard.console.function.health.annotation.HealthCheckType;
-import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
-import org.apache.eventmesh.dashboard.console.function.health.check.impl.storage.RedisCheck;
-import org.apache.eventmesh.dashboard.console.function.health.check.impl.storage.rocketmq4.Rocketmq4BrokerCheck;
-import org.apache.eventmesh.dashboard.console.function.health.check.impl.storage.rocketmq4.Rocketmq4NameServerCheck;
-import org.apache.eventmesh.dashboard.console.service.DataServiceWrapper;
-import org.apache.eventmesh.dashboard.console.service.function.HealthDataService;
-
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Objects;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-import javax.validation.constraints.NotNull;
-
-import lombok.extern.slf4j.Slf4j;
-
-/**
- * HealthService is the manager of all health check services. It is responsible for creating, deleting and executing health check services.<p> In this
- * class there is a {@link HealthExecutor} which is used to execute health check services, and also a map to store all health check services. when the
- * function executeAll is called, health check service will be executed by {@link HealthExecutor}.
- */
-@Slf4j
-public class HealthService {
-
- /**
- * class cache used to build healthCheckService instance.<p> key: HealthCheckObjectConfig.SimpleClassName value: HealthCheckService
- *
- * @see HealthCheckObjectConfig
- */
- private static final Map<String, Class<?>> HEALTH_CHECK_CLASS_CACHE = new HashMap<>();
-
- static {
- setClassCache(RedisCheck.class);
- setClassCache(Rocketmq4BrokerCheck.class);
- setClassCache(Rocketmq4NameServerCheck.class);
- }
-
- /**
- * This map is used to store HealthExecutor.<p> Outside key is Type(runtime, storage etc.), inside key is the id of type instance(runtimeId,
- * storageId etc.).
- *
- * @see AbstractHealthCheckService
- */
- private final Map<String, Map<Long, AbstractHealthCheckService>> checkServiceMap = new ConcurrentHashMap<>();
- private HealthExecutor healthExecutor;
- private ScheduledThreadPoolExecutor scheduledExecutor;
-
- private static void setClassCache(Class<?> clazz) {
- HEALTH_CHECK_CLASS_CACHE.put(clazz.getSimpleName(), clazz);
- }
-
- public Map<String, HashMap<Long, CheckResult>> getCheckResultCacheMap() {
- return healthExecutor.getMemoryCache().getCacheMap();
- }
-
- public void insertCheckService(List<HealthCheckObjectConfig> configList) {
- configList.forEach(this::insertCheckService);
- }
-
- public void insertCheckService(HealthCheckObjectConfig config) {
- AbstractHealthCheckService healthCheckService = null;
-
- try {
- if (Objects.nonNull(config.getSimpleClassName())) {
- Class<?> clazz = HEALTH_CHECK_CLASS_CACHE.get(config.getSimpleClassName());
- healthCheckService = createCheckService(clazz, config);
- // you can pass an object to create a HealthCheckService(not commonly used)
- } else if (Objects.nonNull(config.getCheckClass())) {
- healthCheckService = createCheckService(config.getCheckClass(), config);
- //if simpleClassName and CheckClass are both null, use type(storage) and subType(redis) to create healthCheckService
- //This is the default create method.
- //healthCheckService is annotated with @HealthCheckType(type = "storage", subType = "redis")
- } else if (Objects.nonNull(config.getHealthCheckResourceType()) && Objects.nonNull(
- config.getHealthCheckResourceSubType())) {
- for (Entry<String, Class<?>> entry : HEALTH_CHECK_CLASS_CACHE.entrySet()) {
- Class<?> clazz = entry.getValue();
- HealthCheckType annotation = clazz.getAnnotation(HealthCheckType.class);
- if (Objects.isNull(annotation)) {
- continue;
- }
- if (annotation.type().equals(config.getHealthCheckResourceType()) && annotation.subType()
- .equals(config.getHealthCheckResourceSubType())) {
- healthCheckService = createCheckService(clazz, config);
- }
- }
- }
- // if all above creation method failed
- if (Objects.isNull(healthCheckService)) {
- throw new RuntimeException("No construct method of Health Check Service is found, config is {}" + config);
- }
- insertCheckService(healthCheckService);
- } catch (Exception e) {
- log.error("create healthCheckService failed, healthCheckObjectConfig:{}", config, e);
- }
- }
-
- public void insertCheckService(AbstractHealthCheckService checkService) {
- Map<Long, AbstractHealthCheckService> subMap = checkServiceMap.computeIfAbsent(checkService.getConfig().getHealthCheckResourceType(),
- k -> new ConcurrentHashMap<>());
- subMap.put(checkService.getConfig().getInstanceId(), checkService);
- }
-
- public void deleteCheckService(String resourceType, Long resourceId) {
- Map<Long, AbstractHealthCheckService> subMap = checkServiceMap.get(resourceType);
- if (Objects.isNull(subMap)) {
- return;
- }
- subMap.get(resourceId).destroy();
- subMap.remove(resourceId);
- if (subMap.isEmpty()) {
- checkServiceMap.remove(resourceType);
- }
- }
-
- public void replaceCheckService(List<HealthCheckObjectConfig> configList) {
- checkServiceMap.clear();
- insertCheckService(configList);
- }
-
- public void createExecutor(HealthDataService dataService, CheckResultCache cache) {
- healthExecutor = new HealthExecutor();
- healthExecutor.setDataService(dataService);
- healthExecutor.setMemoryCache(cache);
- }
-
- public void executeAll() {
- try {
-
- healthExecutor.startExecute();
-
- checkServiceMap.forEach((type, subMap) -> {
- subMap.forEach((typeId, healthCheckService) -> {
- healthExecutor.execute(healthCheckService);
- });
- });
- } catch (Exception e) {
- log.error("execute health check failed", e);
- }
-
- healthExecutor.endExecute();
- }
-
- @NotNull
- private AbstractHealthCheckService createCheckService(Class<?> clazz, HealthCheckObjectConfig config) {
- try {
- Constructor<?> constructor = clazz.getConstructor(HealthCheckObjectConfig.class);
- return (AbstractHealthCheckService) constructor.newInstance(config);
- } catch (Exception e) {
- throw new RuntimeException("createCheckService failed", e);
- }
- }
-
- /**
- * start scheduled execution of health check services
- *
- * @param initialDelay unit is second
- * @param period unit is second
- */
- public void startScheduledExecution(long initialDelay, int period) {
- if (scheduledExecutor == null) {
- scheduledExecutor = new ScheduledThreadPoolExecutor(2);
- }
- scheduledExecutor.scheduleAtFixedRate(this::executeAll, initialDelay, period, TimeUnit.SECONDS);
- }
-
- public void startScheduledUpdateConfig(int initialDelay, int period, DataServiceWrapper dataServiceWrapper) {
- if (scheduledExecutor == null) {
- scheduledExecutor = new ScheduledThreadPoolExecutor(2);
- }
- scheduledExecutor.scheduleAtFixedRate(() -> this.updateHealthCheckConfigs(dataServiceWrapper), initialDelay,
- period, TimeUnit.SECONDS);
- }
-
- public void stopScheduledExecution() {
- if (scheduledExecutor != null) {
- scheduledExecutor.shutdown();
- }
- }
-
- public void updateHealthCheckConfigs(DataServiceWrapper dataServiceWrapper) {
- try {
- List<HealthCheckObjectConfig> checkConfigs = new ArrayList<>();
- List<HealthCheckResultEntity> checkResultEntities = new ArrayList<>();
- //TODO add health check service, only storage check is usable for now
-
- // List<ClusterEntity> clusters = properties.getDataServiceContainer().getClusterDataService().selectAll();
- // for (ClusterEntity cluster : clusters) {
- // checkConfigs.add(HealthCheckObjectConfig.builder()
- // .instanceId(cluster.getId())
- // .healthCheckResourceType(HealthCheckTypeConstant.HEALTH_CHECK_TYPE_CLUSTER)
- // .connectUrl(cluster.getRegistryAddress())
- // .build());
- // checkResultEntities.add(HealthCheckResultEntity.builder()
- // .clusterId(cluster.getId())
- // .type(1)
- // .typeId(cluster.getId())
- // .state(4)
- // .resultDesc("initializing check client")
- // .build());
- // }
- //
- // List<RuntimeEntity> runtimes = properties.getDataServiceContainer().getRuntimeDataService().selectAll();
- // for (RuntimeEntity runtime : runtimes) {
- // checkConfigs.add(HealthCheckObjectConfig.builder()
- // .instanceId(runtime.getId())
- // .healthCheckResourceType(HealthCheckTypeConstant.HEALTH_CHECK_TYPE_RUNTIME)
- // .connectUrl(runtime.getHost() + ":" + runtime.getPort())
- // .build());
- // checkResultEntities.add(HealthCheckResultEntity.builder()
- // .clusterId(runtime.getClusterId())
- // .type(2)
- // .typeId(runtime.getId())
- // .state(4)
- // .resultDesc("initializing check client")
- // .build());
- // }
- //
- // List<TopicEntity> topics = properties.getDataServiceContainer().getTopicDataService().selectAll();
- // for (TopicEntity topic : topics) {
- // checkConfigs.add(HealthCheckObjectConfig.builder()
- // .instanceId(topic.getId())
- // .healthCheckResourceType(HealthCheckTypeConstant.HEALTH_CHECK_TYPE_TOPIC)
- // .build());
- // checkResultEntities.add(HealthCheckResultEntity.builder()
- // .clusterId(topic.getClusterId())
- // .type(3)
- // .typeId(topic.getId())
- // .state(4)
- // .resultDesc("initializing check client")
- // .build());
- // }
-
- List<StoreEntity> stores = dataServiceWrapper.getStoreDataService().selectAll();
- for (StoreEntity store : stores) {
- checkConfigs.add(HealthCheckObjectConfig.builder()
- .instanceId(store.getId())
- .clusterId(store.getClusterId())
- .healthCheckResourceType(HealthCheckTypeConstant.HEALTH_CHECK_TYPE_STORAGE)
- .healthCheckResourceSubType(
- StoreType.fromNumber(store.getStoreType()).toString())
- .host(store.getHost())
- .port(store.getPort())
- .build());
- HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity();
- healthCheckResultEntity.setClusterId(store.getClusterId());
- healthCheckResultEntity.setType(4);
- healthCheckResultEntity.setTypeId(store.getId());
- healthCheckResultEntity.setState(4);
- healthCheckResultEntity.setResultDesc("initializing check client");
- checkResultEntities.add(healthCheckResultEntity);
- }
-
- dataServiceWrapper.getHealthDataService().batchInsertNewCheckResult(checkResultEntities);
- this.replaceCheckService(checkConfigs);
- } catch (Exception e) {
- log.error("updateHealthCheckConfigs error", e);
- }
- }
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/annotation/HealthCheckType.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/annotation/HealthCheckType.java
index 43de45c..6e29360 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/annotation/HealthCheckType.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/annotation/HealthCheckType.java
@@ -15,8 +15,12 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.function.health.annotation;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckTypeEnum;
+
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -25,19 +29,15 @@
/**
* This annotation is used to mark the type of health check service implement.
*
- * @see org.apache.eventmesh.dashboard.common.enums.health.HealthCheckType
+ * @see HealthCheckTypeEnum
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface HealthCheckType {
- /**
- * type of resource. runtime, topic etc.
- */
- String type();
- /**
- * subtype of resource. For resource storage, it can be redis, rocketmq etc.
- */
- String subType() default "";
+ ClusterType[] clusterType();
+
+
+ HealthCheckTypeEnum healthType() default HealthCheckTypeEnum.PING;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/callback/HealthCheckCallback.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/callback/HealthCheckCallback.java
index 1229b23..5d4b8c0 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/callback/HealthCheckCallback.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/callback/HealthCheckCallback.java
@@ -15,14 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.function.health.callback;
-import org.apache.eventmesh.dashboard.console.function.health.HealthExecutor;
-
/**
- * Callback used by HealthService.doCheck to notify the caller of the result of the health check.<p>
*
- * @see HealthExecutor
*/
public interface HealthCheckCallback {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/AbstractHealthCheckService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/AbstractHealthCheckService.java
index 3a3ab99..6123866 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/AbstractHealthCheckService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/AbstractHealthCheckService.java
@@ -15,9 +15,12 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.function.health.check;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
+import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
+import org.apache.eventmesh.dashboard.core.function.SDK.AbstractClientInfo;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
import lombok.Getter;
@@ -25,13 +28,43 @@
* extends
*/
@Getter
-public abstract class AbstractHealthCheckService implements HealthCheckService {
+public abstract class AbstractHealthCheckService<T> extends AbstractClientInfo<T> implements HealthCheckService {
- private final HealthCheckObjectConfig config;
- public AbstractHealthCheckService(HealthCheckObjectConfig healthCheckObjectConfig) {
- this.config = healthCheckObjectConfig;
- this.init();
+ private volatile boolean endCheck = true;
+
+
+ public SDKTypeEnum getSDKTypeEnum() {
+ return SDKTypeEnum.PING;
}
+ public void check(HealthCheckCallback callback) throws Exception {
+ this.endCheck = false;
+ try {
+ this.doCheck(callback);
+ } catch (Exception e) {
+ this.endCheck = true;
+ callback.onFail(e);
+ }
+
+ }
+
+ public abstract void doCheck(HealthCheckCallback callback) throws Exception;
+
+ public void setEndCheck() {
+ this.endCheck = true;
+ }
+
+ protected boolean isEndCheck() {
+ return this.endCheck;
+ }
+
+ @Override
+ public void init() throws Exception {
+ }
+
+ @Override
+ public void destroy() throws Exception{
+
+ }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/AbstractTopicHealthCheckService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/AbstractTopicHealthCheckService.java
new file mode 100644
index 0000000..0d93191
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/AbstractTopicHealthCheckService.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.function.health.check;
+
+import java.util.Objects;
+import java.util.concurrent.atomic.AtomicLong;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+
+import lombok.Getter;
+import lombok.Setter;
+
+public abstract class AbstractTopicHealthCheckService<T> extends AbstractHealthCheckService<T> {
+
+ @Setter
+ @Getter
+ private Integer offset = 0;
+
+ @Setter
+ @Getter
+ private Integer queue = 0;
+
+ private AtomicLong atomicLong = new AtomicLong();
+
+ protected byte[] messageContext() {
+ return ("{ 'uid': " + atomicLong.incrementAndGet() + "}").getBytes();
+ }
+
+ protected boolean isCurrentValue(String context) {
+ if (Objects.isNull(context)) {
+ return false;
+ }
+ JSONObject json = JSON.parseObject(context);
+ if (Objects.isNull(json.get("uid"))) {
+ return false;
+ }
+ return Objects.equals(Integer.valueOf(json.get("uid").toString()), atomicLong.get());
+ }
+
+ protected boolean isCurrentValue(byte[] context) {
+ if (Objects.isNull(context)) {
+ return false;
+ }
+ return this.isCurrentValue(new String(context));
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/config/RocketmqConfig.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/ClusterHealthCheckService.java
similarity index 76%
rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/config/RocketmqConfig.java
rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/ClusterHealthCheckService.java
index e49d515..4ce938d 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/config/RocketmqConfig.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/ClusterHealthCheckService.java
@@ -15,18 +15,22 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.function.health.check.config;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
+package org.apache.eventmesh.dashboard.console.function.health.check;
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-public class RocketmqConfig {
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
- private String brokerUrl;
- private String nameServerUrl;
- private String endPoint;
+/**
+ *
+ */
+public interface ClusterHealthCheckService {
+
+
+
+
+ AbstractTopicHealthCheckService register(BaseSyncBase baseSyncBase);
+
+
+ void unRegister(BaseSyncBase baseSyncBase);
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/HealthCheckService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/HealthCheckService.java
index 98f666f..185b539 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/HealthCheckService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/HealthCheckService.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.function.health.check;
-import org.apache.eventmesh.dashboard.console.function.health.HealthExecutor;
import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
/**
@@ -27,15 +27,11 @@
*/
public interface HealthCheckService {
- /**
- * Do the health check.<p> To implement a new check service, add the necessary logic to call the success and fail functions of the callback.
- *
- * @param callback The behaviour of the callback is defined as a lambda function when used. Please refer to {@link HealthExecutor} for usage.
- */
- public void doCheck(HealthCheckCallback callback);
- public void init();
+ void check(HealthCheckCallback callback) throws Exception;
- public void destroy();
+ void init() throws Exception;
+
+ void destroy() throws Exception;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/config/HealthCheckObjectConfig.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/config/HealthCheckObjectConfig.java
deleted file mode 100644
index 5ca9309..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/config/HealthCheckObjectConfig.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.health.check.config;
-
-import java.util.Properties;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder.Default;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@SuperBuilder
-public class HealthCheckObjectConfig {
-
- private Long instanceId;
-
- private String healthCheckResourceType;
-
- @Default
- private String healthCheckResourceSubType = "";
-
- private String simpleClassName;
-
- private Class<?> checkClass;
-
- private Properties eventmeshProperties;
-
- private Long clusterId;
-
- //Prioritize passing in this field for a url.
- //redis, nacos
- private String connectUrl;
-
- //redis
- private String host;
-
- private Integer port;
-
- private String username;
-
- private String password;
-
- //mysql, redis
- private String database;
-
- @Default
- private Long requestTimeoutMillis = 100000L;
-
- @Default
- private RocketmqConfig rocketmqConfig = new RocketmqConfig();
-
-}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/config/RocketmqConfig.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/HealthRegister.java
similarity index 75%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/config/RocketmqConfig.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/HealthRegister.java
index e49d515..5575796 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/config/RocketmqConfig.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/HealthRegister.java
@@ -15,18 +15,16 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.function.health.check.config;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
+package org.apache.eventmesh.dashboard.console.function.health.check.impl;
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-public class RocketmqConfig {
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.console.function.health.annotation.HealthCheckType;
- private String brokerUrl;
- private String nameServerUrl;
- private String endPoint;
+public @interface HealthRegister {
+
+ ClusterType clusterType();
+
+ HealthCheckType healthCheckType();
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/jvm/JVMCapCheck.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/jvm/JVMCapCheck.java
new file mode 100644
index 0000000..71ce0e4
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/jvm/JVMCapCheck.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.function.health.check.impl.jvm;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckTypeEnum;
+import org.apache.eventmesh.dashboard.console.function.health.annotation.HealthCheckType;
+import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
+import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService;
+import org.apache.eventmesh.dashboard.core.function.SDK.wrapper.NacosSDKWrapper;
+
+@HealthCheckType(clusterType = {ClusterType.STORAGE_JVM_CAP_BROKER}, healthType = HealthCheckTypeEnum.PING)
+public class JVMCapCheck extends AbstractHealthCheckService<NacosSDKWrapper> {
+
+ @Override
+ public void doCheck(HealthCheckCallback callback) throws Exception {
+
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/jvm/JVMCapTopicCheck.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/jvm/JVMCapTopicCheck.java
new file mode 100644
index 0000000..e4ba2ad
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/jvm/JVMCapTopicCheck.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.function.health.check.impl.jvm;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckTypeEnum;
+import org.apache.eventmesh.dashboard.console.function.health.annotation.HealthCheckType;
+import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
+import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService;
+import org.apache.eventmesh.dashboard.core.function.SDK.wrapper.NacosSDKWrapper;
+
+@HealthCheckType(clusterType = {ClusterType.STORAGE_JVM_CAP_BROKER}, healthType = HealthCheckTypeEnum.TOPIC)
+public class JVMCapTopicCheck extends AbstractHealthCheckService<NacosSDKWrapper> {
+
+ @Override
+ public void doCheck(HealthCheckCallback callback) throws Exception {
+
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/jvm/JVMCheck.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/jvm/JVMCheck.java
new file mode 100644
index 0000000..acaf847
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/jvm/JVMCheck.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.function.health.check.impl.jvm;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckTypeEnum;
+import org.apache.eventmesh.dashboard.console.function.health.annotation.HealthCheckType;
+import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
+import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService;
+import org.apache.eventmesh.dashboard.core.function.SDK.wrapper.NacosSDKWrapper;
+
+@HealthCheckType(clusterType = {ClusterType.STORAGE_JVM_BROKER}, healthType = HealthCheckTypeEnum.PING)
+public class JVMCheck extends AbstractHealthCheckService<NacosSDKWrapper> {
+
+ @Override
+ public void doCheck(HealthCheckCallback callback) throws Exception {
+ Thread.sleep(2000);
+ callback.onSuccess();
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/jvm/JVMTopicCheck.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/jvm/JVMTopicCheck.java
new file mode 100644
index 0000000..cfe8c76
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/jvm/JVMTopicCheck.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.function.health.check.impl.jvm;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckTypeEnum;
+import org.apache.eventmesh.dashboard.console.function.health.annotation.HealthCheckType;
+import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
+import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService;
+import org.apache.eventmesh.dashboard.core.function.SDK.wrapper.NacosSDKWrapper;
+
+@HealthCheckType(clusterType = {ClusterType.STORAGE_JVM_BROKER}, healthType = HealthCheckTypeEnum.TOPIC)
+public class JVMTopicCheck extends AbstractHealthCheckService<NacosSDKWrapper> {
+
+ @Override
+ public void doCheck(HealthCheckCallback callback) throws Exception {
+ Thread.sleep(2000);
+ callback.onSuccess();
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosConfigCheck.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosConfigCheck.java
index 850738b..3761606 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosConfigCheck.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosConfigCheck.java
@@ -15,24 +15,21 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.function.health.check.impl.meta;
-import static org.apache.eventmesh.dashboard.common.constant.health.HealthCheckTypeConstant.HEALTH_CHECK_SUBTYPE_NACOS_CONFIG;
-import static org.apache.eventmesh.dashboard.common.constant.health.HealthCheckTypeConstant.HEALTH_CHECK_TYPE_META;
import static org.apache.eventmesh.dashboard.common.constant.health.HealthConstant.NACOS_CHECK_CONTENT;
import static org.apache.eventmesh.dashboard.common.constant.health.HealthConstant.NACOS_CHECK_DATA_ID;
import static org.apache.eventmesh.dashboard.common.constant.health.HealthConstant.NACOS_CHECK_GROUP;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
import org.apache.eventmesh.dashboard.console.function.health.annotation.HealthCheckType;
import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.wrapper.NacosSDKWrapper;
-import java.util.Properties;
import java.util.concurrent.CompletableFuture;
-import com.alibaba.nacos.api.NacosFactory;
-import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.exception.NacosException;
import lombok.extern.slf4j.Slf4j;
@@ -41,20 +38,15 @@
* Interface to check the state of nacos
*/
@Slf4j
-@HealthCheckType(type = HEALTH_CHECK_TYPE_META, subType = HEALTH_CHECK_SUBTYPE_NACOS_CONFIG)
-public class NacosConfigCheck extends AbstractHealthCheckService {
+@HealthCheckType(clusterType = {ClusterType.EVENTMESH_META_NACOS})
+public class NacosConfigCheck extends AbstractHealthCheckService<NacosSDKWrapper> {
- private ConfigService configService;
-
- public NacosConfigCheck(HealthCheckObjectConfig healthCheckObjectConfig) {
- super(healthCheckObjectConfig);
- }
@Override
public void doCheck(HealthCheckCallback callback) {
CompletableFuture.runAsync(() -> {
try {
- String content = configService.getConfig(NACOS_CHECK_DATA_ID, NACOS_CHECK_GROUP, getConfig().getRequestTimeoutMillis());
+ String content = this.getClient().getConfigService().getConfig(NACOS_CHECK_DATA_ID, NACOS_CHECK_GROUP, 3000);
if (NACOS_CHECK_CONTENT.equals(content)) {
callback.onSuccess();
} else {
@@ -66,40 +58,4 @@
});
}
- @Override
- public void init() {
- //create a config
- try {
- Properties properties = new Properties();
- properties.put("serverAddr", getConfig().getConnectUrl());
- ConfigService configService = NacosFactory.createConfigService(properties);
- boolean isPublishOk = configService.publishConfig(NACOS_CHECK_DATA_ID, NACOS_CHECK_GROUP,
- NACOS_CHECK_CONTENT);
- if (!isPublishOk) {
- log.error("NacosCheck init failed caused by crate config failed");
- }
- } catch (NacosException e) {
- log.error("NacosCheck init failed caused by {}", e.getErrMsg());
- }
-
- try {
- Properties properties = new Properties();
- properties.put("serverAddr", getConfig().getConnectUrl());
- configService = NacosFactory.createConfigService(properties);
- } catch (NacosException e) {
- log.error("NacosCheck init failed caused by {}", e.getErrMsg());
- }
- }
-
- @Override
- public void destroy() {
- if (configService != null) {
- try {
- configService.removeConfig(NACOS_CHECK_DATA_ID, NACOS_CHECK_GROUP);
- } catch (NacosException e) {
- log.error("NacosCheck destroy failed caused by {}", e.getErrMsg());
- }
-
- }
- }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosNamingServiceCheck.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosNamingServiceCheck.java
index 0313cee..39e198b 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosNamingServiceCheck.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosNamingServiceCheck.java
@@ -15,24 +15,19 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.function.health.check.impl.meta;
-import static org.apache.eventmesh.dashboard.common.constant.health.HealthCheckTypeConstant.HEALTH_CHECK_SUBTYPE_NACOS_REGISTRY;
-import static org.apache.eventmesh.dashboard.common.constant.health.HealthCheckTypeConstant.HEALTH_CHECK_TYPE_META;
-import static org.apache.eventmesh.dashboard.common.constant.health.HealthConstant.NACOS_CHECK_SERVICE_CLUSTER_NAME;
import static org.apache.eventmesh.dashboard.common.constant.health.HealthConstant.NACOS_CHECK_SERVICE_NAME;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckTypeEnum;
import org.apache.eventmesh.dashboard.console.function.health.annotation.HealthCheckType;
import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
-
-import java.util.Properties;
-import java.util.concurrent.CompletableFuture;
+import org.apache.eventmesh.dashboard.core.function.SDK.wrapper.NacosSDKWrapper;
import com.alibaba.nacos.api.exception.NacosException;
-import com.alibaba.nacos.api.naming.NamingFactory;
-import com.alibaba.nacos.api.naming.NamingService;
import com.alibaba.nacos.api.naming.pojo.Instance;
import lombok.extern.slf4j.Slf4j;
@@ -42,20 +37,15 @@
*/
@Slf4j
-@HealthCheckType(type = HEALTH_CHECK_TYPE_META, subType = HEALTH_CHECK_SUBTYPE_NACOS_REGISTRY)
-public class NacosNamingServiceCheck extends AbstractHealthCheckService {
+@HealthCheckType(clusterType = {ClusterType.EVENTMESH_META_NACOS}, healthType = HealthCheckTypeEnum.PING)
+public class NacosNamingServiceCheck extends AbstractHealthCheckService<NacosSDKWrapper> {
- private NamingService namingService;
-
- public NacosNamingServiceCheck(HealthCheckObjectConfig healthCheckObjectConfig) {
- super(healthCheckObjectConfig);
- }
@Override
public void doCheck(HealthCheckCallback callback) {
- CompletableFuture.runAsync(() -> {
+ this.completableFuture(() -> {
try {
- Instance result = namingService.selectOneHealthyInstance(NACOS_CHECK_SERVICE_NAME);
+ Instance result = this.getClient().getNamingService().selectOneHealthyInstance(NACOS_CHECK_SERVICE_NAME);
if (result.isHealthy()) {
callback.onSuccess();
} else {
@@ -63,30 +53,7 @@
}
} catch (NacosException e) {
callback.onFail(e);
- } finally {
- destroy();
}
});
}
-
- @Override
- public void init() {
- try {
- Properties properties = new Properties();
- properties.put("serverAddr", getConfig().getConnectUrl());
- namingService = NamingFactory.createNamingService(properties);
- namingService.registerInstance(NACOS_CHECK_SERVICE_NAME, "11.11.11.11", 8888, NACOS_CHECK_SERVICE_CLUSTER_NAME);
- } catch (NacosException e) {
- log.error("NacosRegistryCheck init failed", e);
- }
- }
-
- @Override
- public void destroy() {
- try {
- namingService.deregisterInstance(NACOS_CHECK_SERVICE_NAME, "11.11.11.11", 8888, NACOS_CHECK_SERVICE_CLUSTER_NAME);
- } catch (NacosException e) {
- log.error("NacosRegistryCheck destroy failed", e);
- }
- }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/RedisCheck.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/RedisCheck.java
index 3cad455..505583e 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/RedisCheck.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/RedisCheck.java
@@ -15,84 +15,37 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.function.health.check.impl.storage;
-import org.apache.eventmesh.dashboard.common.constant.health.HealthCheckTypeConstant;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckTypeEnum;
import org.apache.eventmesh.dashboard.console.function.health.annotation.HealthCheckType;
import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.SDKManager;
-import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRedisConfig;
-import java.time.Duration;
-import java.util.Objects;
-
-import io.lettuce.core.RedisURI;
-import io.lettuce.core.RedisURI.Builder;
import io.lettuce.core.api.StatefulRedisConnection;
import io.lettuce.core.api.async.RedisAsyncCommands;
import lombok.extern.slf4j.Slf4j;
@Slf4j
-@HealthCheckType(type = HealthCheckTypeConstant.HEALTH_CHECK_TYPE_STORAGE, subType = HealthCheckTypeConstant.HEALTH_CHECK_SUBTYPE_REDIS)
-public class RedisCheck extends AbstractHealthCheckService {
-
- private CreateRedisConfig sdkConfig;
-
- public RedisCheck(HealthCheckObjectConfig healthCheckObjectConfig) {
- super(healthCheckObjectConfig);
- }
+@HealthCheckType(clusterType = {ClusterType.STORAGE_REDIS_BROKER}, healthType = HealthCheckTypeEnum.PING)
+public class RedisCheck extends AbstractHealthCheckService<StatefulRedisConnection<String, String>> {
@Override
- public void doCheck(HealthCheckCallback callback) {
- try {
- StatefulRedisConnection<String, String> connection = (StatefulRedisConnection<String, String>) SDKManager.getInstance()
- .getClient(SDKTypeEnum.STORAGE_REDIS, sdkConfig.getUniqueKey());
- RedisAsyncCommands<String, String> commands = connection.async();
- commands.ping().thenAccept(result -> {
- callback.onSuccess();
- }).exceptionally(e -> {
- if (e instanceof Exception) {
- callback.onFail((Exception) e);
- } else {
- callback.onFail(new RuntimeException("RedisCheck failed."));
- }
- return null;
- });
- } catch (Exception e) {
- log.error(e.toString());
- callback.onFail(e);
- }
+ public void doCheck(HealthCheckCallback callback) throws Exception {
+ RedisAsyncCommands<String, String> commands = this.getClient().async();
+ commands.ping().thenAccept(result -> {
+ callback.onSuccess();
+ }).exceptionally(e -> {
+ if (e instanceof Exception) {
+ callback.onFail((Exception) e);
+ } else {
+ callback.onFail(new RuntimeException("RedisCheck failed."));
+ }
+ return null;
+ });
}
- @Override
- public void init() {
- String redisUrl;
- sdkConfig = new CreateRedisConfig();
- if (Objects.nonNull(getConfig().getConnectUrl()) && !getConfig().getConnectUrl().isEmpty()) {
- redisUrl = getConfig().getConnectUrl();
- } else {
- Builder builder = RedisURI.Builder.redis(getConfig().getHost(), getConfig().getPort());
- if (Objects.nonNull(getConfig().getUsername()) && Objects.nonNull(getConfig().getPassword())) {
- builder.withAuthentication(getConfig().getUsername(), getConfig().getPassword());
- }
- if (Objects.nonNull(getConfig().getRequestTimeoutMillis())) {
- builder.withTimeout(Duration.ofMillis(getConfig().getRequestTimeoutMillis()));
- }
- if (Objects.nonNull(getConfig().getDatabase())) {
- builder.withDatabase(Integer.parseInt(getConfig().getDatabase()));
- }
- redisUrl = builder.build().toString();
- }
- sdkConfig.setRedisUrl(redisUrl);
- SDKManager.getInstance().createClient(SDKTypeEnum.STORAGE_REDIS, sdkConfig);
- }
-
- @Override
- public void destroy() {
- SDKManager.getInstance().deleteClient(SDKTypeEnum.STORAGE_REDIS, sdkConfig.getUniqueKey());
- }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/RocketMQClusterHealthCheckService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/RocketMQClusterHealthCheckService.java
new file mode 100644
index 0000000..04909c2
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/RocketMQClusterHealthCheckService.java
@@ -0,0 +1,218 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.function.health.check.impl.storage.rocketmq4;
+
+import org.apache.eventmesh.dashboard.common.constant.health.HealthConstant;
+import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
+import org.apache.eventmesh.dashboard.console.function.health.check.AbstractTopicHealthCheckService;
+import org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq.RocketMQRemotingSDKOperation.DefaultRemotingClient;
+
+import org.apache.rocketmq.client.exception.MQBrokerException;
+import org.apache.rocketmq.client.exception.MQClientException;
+import org.apache.rocketmq.common.TopicFilterType;
+import org.apache.rocketmq.common.constant.PermName;
+import org.apache.rocketmq.common.message.Message;
+import org.apache.rocketmq.remoting.InvokeCallback;
+import org.apache.rocketmq.remoting.exception.RemotingConnectException;
+import org.apache.rocketmq.remoting.exception.RemotingException;
+import org.apache.rocketmq.remoting.exception.RemotingSendRequestException;
+import org.apache.rocketmq.remoting.exception.RemotingTimeoutException;
+import org.apache.rocketmq.remoting.netty.ResponseFuture;
+import org.apache.rocketmq.remoting.protocol.RemotingCommand;
+import org.apache.rocketmq.remoting.protocol.RemotingSerializable;
+import org.apache.rocketmq.remoting.protocol.RequestCode;
+import org.apache.rocketmq.remoting.protocol.ResponseCode;
+import org.apache.rocketmq.remoting.protocol.header.CreateTopicRequestHeader;
+import org.apache.rocketmq.remoting.protocol.header.GetTopicConfigRequestHeader;
+import org.apache.rocketmq.remoting.protocol.header.PullMessageRequestHeader;
+import org.apache.rocketmq.remoting.protocol.header.SendMessageRequestHeader;
+import org.apache.rocketmq.remoting.protocol.statictopic.TopicConfigAndQueueMapping;
+
+import java.util.Objects;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import lombok.extern.slf4j.Slf4j;
+
+
+@Slf4j
+public class RocketMQClusterHealthCheckService extends AbstractTopicHealthCheckService<DefaultRemotingClient> {
+
+
+ private volatile boolean checkTopic = false;
+
+
+ public void doCheck(HealthCheckCallback callback) throws Exception {
+ if (!RocketMQClusterHealthCheckService.this.checkTopic) {
+ this.getTopicConfig();
+ return;
+ }
+ try {
+ if (this.getBaseSyncBase().getReplicationType().isSlave()) {
+ this.sendMessage(callback);
+ } else {
+ this.consume(callback);
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void sendMessage(HealthCheckCallback callback) throws RemotingException, InterruptedException, MQClientException {
+ if (this.getBaseSyncBase().getReplicationType().isSlave()) {
+ return;
+ }
+ SendMessageRequestHeader requestHeader = new SendMessageRequestHeader();
+ requestHeader.setProducerGroup(HealthConstant.ROCKETMQ_CHECK_PRODUCER_GROUP);
+ requestHeader.setTopic(HealthConstant.ROCKETMQ_CHECK_TOPIC);
+ requestHeader.setDefaultTopic(HealthConstant.ROCKETMQ_CHECK_TOPIC);
+ requestHeader.setDefaultTopicQueueNums(1);
+ requestHeader.setQueueId(1);
+ //requestHeader.setSysFlag(1);
+ requestHeader.setBornTimestamp(System.currentTimeMillis());
+ //requestHeader.setFlag(msg.getFlag());
+ requestHeader.setReconsumeTimes(0);
+ requestHeader.setUnitMode(false);
+ requestHeader.setBatch(false);
+ requestHeader.setBrokerName("127.0.0.1:9876");
+ Message message = new Message();
+ message.setTags(HealthConstant.ROCKETMQ_CHECK_TOPIC);
+ message.setBody(this.messageContext());
+ RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.SEND_MESSAGE, requestHeader);
+ request.setBody(message.getBody());
+ this.getClient().invokeAsync(
+ request,
+ 1000,
+ new InvokeCallback() {
+
+ @Override
+ public void operationComplete(ResponseFuture responseFuture) {
+
+ }
+
+ public void operationSucceed(RemotingCommand response) {
+ if (Objects.equals(response.getCode(), ResponseCode.SUCCESS)) {
+ try {
+ consume(callback);
+ } catch (Exception e) {
+ callback.onFail(new RuntimeException(e));
+ }
+
+ } else {
+ callback.onFail(new RuntimeException(""));
+ }
+ }
+
+ public void operationFail(Throwable throwable) {
+ callback.onFail(new RuntimeException(throwable));
+ }
+ });
+
+ }
+
+ private void consume(HealthCheckCallback callback) throws Exception {
+ PullMessageRequestHeader requestHeader = new PullMessageRequestHeader();
+ requestHeader.setConsumerGroup(HealthConstant.GROUP);
+ requestHeader.setTopic(HealthConstant.ROCKETMQ_CHECK_TOPIC);
+ this.getClient().invokeAsync(null, 1000, new InvokeCallback() {
+ @Override
+ public void operationComplete(ResponseFuture responseFuture) {
+
+ }
+
+ @Override
+ public void operationSucceed(final RemotingCommand response) {
+ AtomicBoolean isSuccess = new AtomicBoolean(false);
+ if (isSuccess.get()) {
+ return;
+ }
+ try {
+ consume(callback);
+ } catch (Exception ex) {
+ callback.onFail(new RuntimeException(ex));
+ }
+ }
+
+ @Override
+ public void operationFail(final Throwable throwable) {
+ if (!isEndCheck()) {
+ try {
+ consume(callback);
+ } catch (Exception ex) {
+ callback.onFail(new RuntimeException(ex));
+ }
+ } else {
+ callback.onFail(new RuntimeException(throwable));
+ }
+ }
+ });
+ }
+
+ @Override
+ public void init() throws Exception {
+ this.getTopicConfig();
+ }
+
+ private void getTopicConfig() throws InterruptedException,
+ RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException, MQBrokerException {
+ GetTopicConfigRequestHeader header = new GetTopicConfigRequestHeader();
+ header.setTopic(HealthConstant.ROCKETMQ_CHECK_TOPIC);
+ header.setLo(true);
+ RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_TOPIC_CONFIG, header);
+ RemotingCommand response = this.getClient().invokeSync(request, 3000);
+ assert response != null;
+ if (Objects.equals(response.getCode(), ResponseCode.SUCCESS)) {
+ TopicConfigAndQueueMapping topicConfigAndQueueMapping =
+ RemotingSerializable.decode(response.getBody(), TopicConfigAndQueueMapping.class);
+ ConcurrentMap<Integer, Integer> queue = topicConfigAndQueueMapping.getMappingDetail().getCurrIdMap();
+ if (queue.size() == 1) {
+ queue.forEach((k, value) -> {
+ this.setOffset(value);
+ this.setQueue(k);
+ });
+ return;
+ }
+ RocketMQClusterHealthCheckService.this.checkTopic = true;
+ // 删除 topic
+ }
+ if (this.getBaseSyncBase().getReplicationType().isSlave()) {
+ return;
+ }
+ this.createTopic();
+ }
+
+ private void createTopic() throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException, InterruptedException {
+ CreateTopicRequestHeader requestHeader = new CreateTopicRequestHeader();
+ requestHeader.setTopic(HealthConstant.ROCKETMQ_CHECK_TOPIC);
+ requestHeader.setTopicFilterType(TopicFilterType.SINGLE_TAG.name());
+ requestHeader.setReadQueueNums(1);
+ requestHeader.setWriteQueueNums(1);
+ requestHeader.setPerm(PermName.PERM_READ | PermName.PERM_WRITE);
+ RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.UPDATE_AND_CREATE_TOPIC, requestHeader);
+ RemotingCommand response =
+ this.getClient().invokeSync(request, 1000);
+ if (!Objects.equals(response.getCode(), ResponseCode.SUCCESS)) {
+ RocketMQClusterHealthCheckService.this.checkTopic = true;
+ }
+ }
+
+
+ ;
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4BrokerCheck.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4BrokerCheck.java
index 58c144c..bb1a6a4 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4BrokerCheck.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4BrokerCheck.java
@@ -15,84 +15,40 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.function.health.check.impl.storage.rocketmq4;
import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.SDKManager;
-import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq.RocketMQRemotingSDKOperation.DefaultRemotingClient;
import org.apache.rocketmq.remoting.InvokeCallback;
-import org.apache.rocketmq.remoting.RemotingClient;
import org.apache.rocketmq.remoting.netty.ResponseFuture;
import org.apache.rocketmq.remoting.protocol.RemotingCommand;
import org.apache.rocketmq.remoting.protocol.RequestCode;
-import java.util.Objects;
-
import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class Rocketmq4BrokerCheck extends AbstractHealthCheckService {
+public class Rocketmq4BrokerCheck extends AbstractHealthCheckService<DefaultRemotingClient> {
private CreateRocketmqConfig config;
- public Rocketmq4BrokerCheck(HealthCheckObjectConfig healthCheckObjectConfig) {
- super(healthCheckObjectConfig);
- }
-
@Override
- public void doCheck(HealthCheckCallback callback) {
- try {
- RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_BROKER_RUNTIME_INFO, null);
- RemotingClient client = (RemotingClient) SDKManager.getInstance().getClient(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, config.getUniqueKey());
- client.invokeAsync(getConfig().getRocketmqConfig().getBrokerUrl(), request, getConfig().getRequestTimeoutMillis(),
- new InvokeCallback() {
- @Override
- public void operationComplete(ResponseFuture responseFuture) {
- if (responseFuture.isSendRequestOK()) {
- callback.onSuccess();
- } else {
- callback.onFail(new RuntimeException("RocketmqNameServerCheck failed caused by " + responseFuture.getCause()));
- }
- }
-
- });
- } catch (Exception e) {
- log.error("RocketmqCheck failed.", e);
- callback.onFail(e);
- }
+ public void doCheck(HealthCheckCallback callback) throws Exception {
+ RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_BROKER_RUNTIME_INFO, null);
+ this.getClient().invokeAsync(request, 3000, new InvokeCallback() {
+ @Override
+ public void operationComplete(ResponseFuture responseFuture) {
+ if (responseFuture.isSendRequestOK()) {
+ callback.onSuccess();
+ } else {
+ callback.onFail(new RuntimeException("RocketmqNameServerCheck failed caused by " + responseFuture.getCause()));
+ }
+ }
+ });
}
- @Override
- public void init() {
- setBrokerUrl();
-
- config = new CreateRocketmqConfig();
- config.setBrokerUrl(getConfig().getRocketmqConfig().getBrokerUrl());
- SDKManager.getInstance().createClient(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, config);
- }
-
- private void setBrokerUrl() {
- if (Objects.nonNull(getConfig().getRocketmqConfig()) && Objects.nonNull(getConfig().getRocketmqConfig().getBrokerUrl())) {
- return;
- }
- if (Objects.nonNull(getConfig().getConnectUrl()) && !getConfig().getConnectUrl().isEmpty()) {
- getConfig().getRocketmqConfig().setBrokerUrl(getConfig().getConnectUrl());
- return;
- }
- if (Objects.nonNull(getConfig().getHost()) && Objects.nonNull(getConfig().getPort())) {
- getConfig().getRocketmqConfig().setBrokerUrl(getConfig().getHost() + ":" + getConfig().getPort());
- return;
- }
- throw new RuntimeException("RocketmqNameServerCheck init failed, brokerUrl is empty");
- }
-
- @Override
- public void destroy() {
- SDKManager.getInstance().deleteClient(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, config.getUniqueKey());
- }
-}
+}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4NameServerCheck.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4NameServerCheck.java
index 3c26a06..ace3f0a 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4NameServerCheck.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4NameServerCheck.java
@@ -15,86 +15,43 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.function.health.check.impl.storage.rocketmq4;
-import org.apache.eventmesh.dashboard.common.constant.health.HealthCheckTypeConstant;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckTypeEnum;
import org.apache.eventmesh.dashboard.console.function.health.annotation.HealthCheckType;
import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.SDKManager;
-import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq.RocketMQRemotingSDKOperation.DefaultRemotingClient;
import org.apache.rocketmq.remoting.InvokeCallback;
-import org.apache.rocketmq.remoting.RemotingClient;
import org.apache.rocketmq.remoting.netty.ResponseFuture;
import org.apache.rocketmq.remoting.protocol.RemotingCommand;
import org.apache.rocketmq.remoting.protocol.RequestCode;
-import java.util.Objects;
-
import lombok.extern.slf4j.Slf4j;
@Slf4j
-@HealthCheckType(type = HealthCheckTypeConstant.HEALTH_CHECK_TYPE_STORAGE, subType = HealthCheckTypeConstant.HEALTH_CHECK_SUBTYPE_ROCKETMQ)
-public class Rocketmq4NameServerCheck extends AbstractHealthCheckService {
+@HealthCheckType(clusterType = {ClusterType.STORAGE_ROCKETMQ_NAMESERVER}, healthType = HealthCheckTypeEnum.PING)
+public class Rocketmq4NameServerCheck extends AbstractHealthCheckService<DefaultRemotingClient> {
- private CreateRocketmqConfig config;
-
- public Rocketmq4NameServerCheck(HealthCheckObjectConfig healthCheckObjectConfig) {
- super(healthCheckObjectConfig);
- }
@Override
- public void doCheck(HealthCheckCallback callback) {
- try {
- RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_NAMESRV_CONFIG, null);
- RemotingClient client = (RemotingClient) SDKManager.getInstance().getClient(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, config.getUniqueKey());
- client.invokeAsync(getConfig().getRocketmqConfig().getNameServerUrl(), request, getConfig().getRequestTimeoutMillis(),
- new InvokeCallback() {
- @Override
- public void operationComplete(ResponseFuture responseFuture) {
- if (responseFuture.isSendRequestOK()) {
- callback.onSuccess();
- } else {
- callback.onFail(new RuntimeException("RocketmqNameServerCheck failed caused by " + responseFuture.getCause()));
- }
+ public void doCheck(HealthCheckCallback callback) throws Exception {
+ RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_NAMESRV_CONFIG, null);
+ getClient().invokeAsync(request, 3000,
+ new InvokeCallback() {
+ @Override
+ public void operationComplete(ResponseFuture responseFuture) {
+ if (responseFuture.isSendRequestOK()) {
+ callback.onSuccess();
+ } else {
+ callback.onFail(new RuntimeException("RocketmqNameServerCheck failed caused by " + responseFuture.getCause()));
}
+ }
- });
- } catch (Exception e) {
- log.error("RocketmqCheck failed.", e);
- callback.onFail(e);
- }
+ });
}
- @Override
- public void init() {
- setNameServerUrl();
-
- config = new CreateRocketmqConfig();
- config.setNameServerUrl(getConfig().getRocketmqConfig().getNameServerUrl());
- SDKManager.getInstance().createClient(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, config);
- }
-
- private void setNameServerUrl() {
- if (Objects.nonNull(getConfig().getRocketmqConfig().getNameServerUrl())) {
- return;
- }
- if (Objects.nonNull(getConfig().getConnectUrl()) && !getConfig().getConnectUrl().isEmpty()) {
- getConfig().getRocketmqConfig().setNameServerUrl(getConfig().getConnectUrl());
- return;
- }
- if (Objects.nonNull(getConfig().getHost()) && Objects.nonNull(getConfig().getPort())) {
- getConfig().getRocketmqConfig().setNameServerUrl(getConfig().getHost() + ":" + getConfig().getPort());
- return;
- }
- throw new RuntimeException("RocketmqNameServerCheck init failed, NameServerUrl is empty");
- }
-
- @Override
- public void destroy() {
-
- }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4TopicCheck.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4TopicCheck.java
index 3e7c433..97d8e79 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4TopicCheck.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4TopicCheck.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.function.health.check.impl.storage.rocketmq4;
import static org.apache.rocketmq.client.producer.SendStatus.SEND_OK;
@@ -22,7 +23,7 @@
import org.apache.eventmesh.dashboard.common.constant.health.HealthConstant;
import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq.RocketMQRemotingSDKOperation.DefaultRemotingClient;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
@@ -55,7 +56,7 @@
import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class Rocketmq4TopicCheck extends AbstractHealthCheckService {
+public class Rocketmq4TopicCheck extends AbstractHealthCheckService<DefaultRemotingClient> {
private RemotingClient remotingClient;
@@ -67,9 +68,6 @@
private BlockingQueue<Message> consumedMessages = new LinkedBlockingQueue<>();
- public Rocketmq4TopicCheck(HealthCheckObjectConfig healthCheckObjectConfig) {
- super(healthCheckObjectConfig);
- }
@Override
public void doCheck(HealthCheckCallback callback) {
@@ -109,7 +107,7 @@
private synchronized void consume(HealthCheckCallback callback, String uuid) {
try {
- while (System.currentTimeMillis() - startTime < getConfig().getRequestTimeoutMillis()) {
+ while (System.currentTimeMillis() - startTime < 3000) {
Message message = consumedMessages.poll(System.currentTimeMillis() - startTime, TimeUnit.MILLISECONDS);
if (message != null) {
log.debug("RocketmqTopicCheck consume message:{}", new String(message.getBody()));
@@ -144,7 +142,7 @@
requestHeader.setWriteQueueNums(8);
requestHeader.setPerm(PermName.PERM_READ | PermName.PERM_WRITE);
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.UPDATE_AND_CREATE_TOPIC, requestHeader);
- Object result = remotingClient.invokeSync(getConfig().getRocketmqConfig().getBrokerUrl(), request, getConfig().getRequestTimeoutMillis());
+ Object result = this.getClient().invokeSync(request, 3000);
log.info(result.toString());
} catch (Exception e) {
log.error("RocketmqTopicCheck init failed when examining topic stats.", e);
@@ -153,13 +151,13 @@
try {
producer = new DefaultMQProducer(HealthConstant.ROCKETMQ_CHECK_PRODUCER_GROUP);
- producer.setNamesrvAddr(getConfig().getRocketmqConfig().getNameServerUrl());
+ //producer.setNamesrvAddr(getConfig().getRocketmqConfig().getNameServerUrl());
producer.setCompressMsgBodyOverHowmuch(16);
producer.start();
consumer = new DefaultMQPushConsumer(HealthConstant.ROCKETMQ_CHECK_CONSUMER_GROUP);
consumer.setMessageModel(MessageModel.CLUSTERING);
- consumer.setNamesrvAddr(getConfig().getRocketmqConfig().getNameServerUrl());
+ //consumer.setNamesrvAddr(getConfig().getRocketmqConfig().getNameServerUrl());
consumer.subscribe(HealthConstant.ROCKETMQ_CHECK_TOPIC, "*");
consumer.registerMessageListener(new MessageListenerConcurrently() {
@Override
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/design.md b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/design.md
new file mode 100644
index 0000000..29d331a
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/design.md
@@ -0,0 +1,19 @@
+
+## health
+> 心跳分为 服务(runtime)心跳,topic心跳
+
+
+
+## topic 心跳
+> 通过 topic 的读写,确认 存储节点的主功能正常。同时需要验证复制是否正常。验证复制是否监控的同时,可以验证 节点是否可以读写
+
+#### 问题是:每个 存储的topic 方式不一样 ,同时 同步方式也不一样
+1. RocketMQ 使用主从集群。同时使用 raft 集群
+2. Kafka 集群使用同样节点
+3. pulusr 使用 book 作为存储,只能检查book
+4. redis 会用主从集群。 raft 集群
+5. MySQL 主从
+6. eventmesh 是代理。需要每个 runtime 都发送,获得一次吗?
+ 1. 只需要从一个节点得到所有数据就行了。如果节点有问题。怎么办?
+ 2. 请求所有节点确认所有数据是正确的
+7.
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataServiceWrapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataServiceWrapper.java
deleted file mode 100644
index 0c8656e..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataServiceWrapper.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.metadata;
-
-import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Builder.Default;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@Data
-public class MetadataServiceWrapper {
-
- private SingleMetadataServiceWrapper dbToService;
-
- private SingleMetadataServiceWrapper serviceToDb;
-
- private Long cacheId;
-
- @Data
- @AllArgsConstructor
- @NoArgsConstructor
- @Builder
- public static class SingleMetadataServiceWrapper {
-
- /**
- * true -> incremental updates false -> full volume updates
- *
- * @See MetadataManager
- */
- @Default
- private Boolean cache = true;
-
-
- /**
- * handler is the target of metadata, it will process the metadata from syncService
- */
- private MetadataHandler<?> handler;
- }
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/SyncRelationshipConfig.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/SyncRelationshipConfig.java
deleted file mode 100644
index 018584a..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/SyncRelationshipConfig.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.metadata;
-
-
-public class SyncRelationshipConfig {
-
- private Class<?> metadataClass;
-
- private Class<?> entityClass;
-
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/MetadataHandlerWrapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/MetadataHandlerWrapper.java
deleted file mode 100644
index dce04d7..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/MetadataHandlerWrapper.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.metadata.handler;
-
-import org.apache.eventmesh.dashboard.console.function.metadata.handler.db.ClusterMetadataHandlerToDbImpl;
-import org.apache.eventmesh.dashboard.console.function.metadata.handler.db.ConfigMetadataHandlerToDbImpl;
-import org.apache.eventmesh.dashboard.console.function.metadata.handler.db.GroupMetadataHandlerToDbImpl;
-import org.apache.eventmesh.dashboard.console.function.metadata.handler.db.RuntimeMetadataHandlerToDbImpl;
-import org.apache.eventmesh.dashboard.console.function.metadata.handler.db.TopicMetadataHandlerToDbImpl;
-import org.apache.eventmesh.dashboard.console.spring.support.FunctionManagerLoader;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import lombok.Getter;
-
-/**
- * MetadataHandlerWrapper is a wrapper class for all metadata handlers. It is used to inject all metadata handlers.
- *
- * @see FunctionManagerLoader
- */
-@Getter
-@Component
-public class MetadataHandlerWrapper {
-
- @Autowired
- private ClusterMetadataHandlerToDbImpl clusterMetadataHandlerToDb;
-
- @Autowired
- private ConfigMetadataHandlerToDbImpl configMetadataHandlerToDb;
-
- @Autowired
- private GroupMetadataHandlerToDbImpl groupMetadataHandlerToDb;
-
-
- @Autowired
- private RuntimeMetadataHandlerToDbImpl runtimeMetadataHandlerToDb;
-
- @Autowired
- private TopicMetadataHandlerToDbImpl topicMetadataHandlerToDb;
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImpl.java
deleted file mode 100644
index f9a2743..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImpl.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.metadata.handler.db;
-
-import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
-import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
-import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler;
-
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-public class ClusterMetadataHandlerToDbImpl implements MetadataHandler<ClusterMetadata> {
-
- @Autowired
- private ClusterService clusterService;
-
- @Override
- public void addMetadata(ClusterMetadata meta) {
- //clusterService.addCluster(new ClusterEntity(meta));
- }
-
- @Override
- public void addMetadata(List<ClusterMetadata> metadataList) {
- /* List<ClusterEntity> entityList = metadataList.stream()
- .map(ClusterEntity::new)
- .collect(Collectors.toList());
- clusterService.batchInsert(entityList);*/
- }
-
- @Override
- public void deleteMetadata(ClusterMetadata meta) {
- }
-
- @Override
- public List<ClusterMetadata> getData() {
- return null;
- }
-
- @Override
- public List<ClusterMetadata> getData(GlobalRequest globalRequest) {
- return null;
- }
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImpl.java
deleted file mode 100644
index 7549483..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImpl.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.metadata.handler.db;
-
-import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
-import org.apache.eventmesh.dashboard.console.service.function.ConfigService;
-import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler;
-
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Service
-public class ConfigMetadataHandlerToDbImpl implements MetadataHandler<ConfigMetadata> {
-
- @Autowired
- private ConfigService configService;
-
-
- @Override
- public void addMetadata(ConfigMetadata meta) {
- //configService.addConfig(new ConfigEntity(meta));
- }
-
- @Override
- public void addMetadata(List<ConfigMetadata> meta) {
- /* List<ConfigEntity> entityList = meta.stream()
- .map(ConfigEntity::new)
- .collect(Collectors.toList());*/
- //configService.batchInsert(entityList);
- }
-
- @Override
- public void deleteMetadata(ConfigMetadata meta) {
- //configService.deleteConfig(new ConfigEntity(meta));
- }
-
- @Override
- public List<ConfigMetadata> getData() {
- return null;
- }
-
- @Override
- public List<ConfigMetadata> getData(GlobalRequest globalRequest) {
- return null;
- }
-}
-
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImpl.java
deleted file mode 100644
index 963c005..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImpl.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.metadata.handler.db;
-
-import org.apache.eventmesh.dashboard.common.model.metadata.GroupMetadata;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
-import org.apache.eventmesh.dashboard.console.service.message.GroupService;
-import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler;
-
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-public class GroupMetadataHandlerToDbImpl implements MetadataHandler<GroupMetadata> {
-
- @Autowired
- GroupService groupService;
-
- @Override
- public void addMetadata(GroupMetadata meta) {
- /* meta.setMemberCount(0);
- GroupEntity groupEntity = new GroupEntity(meta);
- groupService.addGroup(groupEntity);*/
- }
-
- @Override
- public void addMetadata(List<GroupMetadata> metadata) {
- /*List<GroupEntity> entityList = metadata.stream().map(GroupEntity::new).collect(Collectors.toList());
- groupService.batchInsert(entityList);*/
- }
-
- @Override
- public void deleteMetadata(GroupMetadata meta) {
-
- }
-
- @Override
- public List<GroupMetadata> getData() {
- return null;
- }
-
- @Override
- public List<GroupMetadata> getData(GlobalRequest globalRequest) {
- return null;
- }
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImpl.java
deleted file mode 100644
index c8c064e..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImpl.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.metadata.handler.db;
-
-import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
-import org.apache.eventmesh.dashboard.common.enums.ClusterType;
-import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
-import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
-import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
-import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService;
-import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler;
-
-import java.util.List;
-import java.util.Objects;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Service
-public class RuntimeMetadataHandlerToDbImpl implements MetadataHandler<RuntimeMetadata> {
-
- @Autowired
- RuntimeService runtimeService;
-
- @Autowired
- ClusterService clusterService;
-
- @Override
- public void addMetadata(RuntimeMetadata meta) {
- ClusterEntity cluster = null;
- if (Objects.isNull(cluster)) {
- log.info("new cluster detected syncing runtime, adding cluster to db, cluster:{}", meta.getClusterName());
- ClusterEntity clusterEntity = new ClusterEntity();
- clusterEntity.setId(0L);
- clusterEntity.setClusterType(ClusterType.EVENTMESH_CLUSTER);
- clusterEntity.setTrusteeshipType(ClusterTrusteeshipType.TRUSTEESHIP);
- clusterEntity.setName(meta.getClusterName());
- clusterEntity.setVersion("");
- clusterEntity.setJmxProperties("");
- clusterEntity.setDescription("");
- clusterEntity.setAuthType(0);
- clusterEntity.setRunState(0);
- clusterService.insertCluster(clusterEntity);
- } else {
- cluster.setName(meta.getClusterName());
- clusterService.insertCluster(cluster);
- }
- if (Objects.isNull(meta.getClusterId())) {
- //meta.setClusterId(ClusterCache.getINSTANCE().getClusterByName(meta.getClusterName()).getId());
- }
- //runtimeService.addRuntime(new RuntimeEntity(meta));
- //RuntimeCache.getInstance().addRuntime(new RuntimeEntity(meta));
-
- // 集群存在且不过时。 直接同步就可以。
-
- // 集群不存在 or 集群存在且过时。那么需要全部读出来,整理
-
- // 创建 cluster do cache
-
- // 在一个事务中,从 runtime 同步 元数据
-
- // 读取 config , topic , acl ,user , group,订阅关系,
-
- // 同步成功修改 状态,同步成功,修改状态
-
- //
- }
-
- @Override
- public void deleteMetadata(RuntimeMetadata meta) {
- //runtimeService.deactivate(new RuntimeEntity(meta));
-
- }
-
- @Override
- public List<RuntimeMetadata> getData() {
- return null;
- }
-
- @Override
- public List<RuntimeMetadata> getData(GlobalRequest globalRequest) {
- return null;
- }
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImpl.java
deleted file mode 100644
index ec86ca6..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImpl.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.metadata.handler.db;
-
-import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
-import org.apache.eventmesh.dashboard.console.entity.StoreEntity;
-import org.apache.eventmesh.dashboard.console.service.message.TopicService;
-import org.apache.eventmesh.dashboard.console.service.store.StoreService;
-import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler;
-
-import java.net.URI;
-import java.util.List;
-import java.util.Objects;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Service
-public class TopicMetadataHandlerToDbImpl implements MetadataHandler<TopicMetadata> {
-
- @Autowired
- private TopicService topicService;
-
- @Autowired
- private StoreService storeService;
-
- @Override
- public void addMetadata(TopicMetadata meta) {
- if (Objects.nonNull(meta.getConnectionUrl())) {
- URI uri = URI.create(meta.getConnectionUrl());
- if (Objects.nonNull(uri.getHost()) && uri.getPort() != -1) {
- StoreEntity store = storeService.selectByHostPort(uri.getHost(), uri.getPort());
- if (Objects.nonNull(store)) {
- meta.setStorageId(store.getId());
- }
- }
- }
-
- //topicService.addTopic(new TopicEntity(meta));
- }
-
- @Override
- public void deleteMetadata(TopicMetadata meta) {
- topicService.deleteTopic(null);
- }
-
- @Override
- public List<TopicMetadata> getData() {
- return null;
- }
-
- @Override
- public List<TopicMetadata> getData(GlobalRequest globalRequest) {
- return null;
- }
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/SyncDataServiceWrapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/SyncDataServiceWrapper.java
deleted file mode 100644
index 7b52922..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/SyncDataServiceWrapper.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.metadata.syncservice;
-
-import org.apache.eventmesh.dashboard.console.spring.support.FunctionManagerLoader;
-import org.apache.eventmesh.dashboard.core.metadata.cluster.AclSyncFromClusterService;
-import org.apache.eventmesh.dashboard.core.metadata.cluster.ConfigSyncFromClusterService;
-import org.apache.eventmesh.dashboard.core.metadata.cluster.GroupSyncFromClusterService;
-import org.apache.eventmesh.dashboard.core.metadata.cluster.InstanceUserFromClusterService;
-import org.apache.eventmesh.dashboard.core.metadata.cluster.RuntimeSyncFromClusterService;
-import org.apache.eventmesh.dashboard.core.metadata.cluster.TopicSyncFromClusterService;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import lombok.Getter;
-
-/**
- * SyncDataServiceWrapper is a wrapper class for all sync services. It is used to inject all sync services.
- *
- * @see FunctionManagerLoader
- */
-@Getter
-@Component
-public class SyncDataServiceWrapper {
-
- @Autowired
- private AclSyncFromClusterService aclSyncFromClusterService;
-
- @Autowired
- private ConfigSyncFromClusterService configSyncFromClusterService;
-
- @Autowired
- private GroupSyncFromClusterService groupSyncFromClusterService;
-
- @Autowired
- private RuntimeSyncFromClusterService runtimeSyncFromClusterService;
-
- @Autowired
- private InstanceUserFromClusterService instanceUserFromClusterService;
-
- @Autowired
- private TopicSyncFromClusterService topicSyncFromClusterService;
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java
index bd61b8d..dedbc2d 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.log;
import org.apache.eventmesh.dashboard.console.annotation.EmLog;
@@ -35,6 +36,7 @@
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Service;
import org.springframework.util.ClassUtils;
@@ -47,7 +49,7 @@
private LogService logService;
- private ApplicationContext applicationContext;
+ private AbstractApplicationContext applicationContext;
@Pointcut("within(org.apache.eventmesh.dashboard.console.service..*)")
@@ -57,16 +59,17 @@
@Around("pointCut()")
public Object logStart(ProceedingJoinPoint joinPoint) throws Throwable {
- if (Objects.isNull(this.logService)) {
- this.logService = applicationContext.getBean(LogService.class);
- }
+
EmLog declaredAnnotation = this.getTargetEmlog(joinPoint);
//Get the Emlog annotation on the method
if (Objects.isNull(declaredAnnotation)) {
return joinPoint.proceed();
}
+ if (Objects.isNull(this.logService) && applicationContext.isActive()) {
+ this.logService = applicationContext.getBean(LogService.class);
+ }
LogEntity logEntity = this.productLoEntity(declaredAnnotation, joinPoint);
- logService.insertLog(logEntity);
+ logService.addLog(logEntity);
logEntity.setEndTime(new Timestamp(System.currentTimeMillis()));
Object proceed = null;
try {
@@ -119,6 +122,6 @@
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
- this.applicationContext = applicationContext;
+ this.applicationContext = (AbstractApplicationContext) applicationContext;
}
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/SyncDataHandlerMapper.java
similarity index 73%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/SyncDataHandlerMapper.java
index 6dafeef..967afb2 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/SyncDataHandlerMapper.java
@@ -15,20 +15,22 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+package org.apache.eventmesh.dashboard.console.mapper;
-import lombok.Data;
+import java.util.List;
-@Data
-public class UpdateConfigsLog {
+/**
+ *
+ */
+public interface SyncDataHandlerMapper<T> {
- private Long instanceId;
+ void syncInsert(List<T> entityList);
- private Long clusterId;
+ void syncUpdate(List<T> entityList);
- private String name;
+ void syncDelete(List<T> entityList);
- private String configProperties;
+ List<T> syncGet(T topicEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/AclMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/AclMapper.java
index 92332df..2a4cc92 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/AclMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/AclMapper.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapper.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.AclEntity;
@@ -33,18 +34,6 @@
@Mapper
public interface AclMapper {
- @Select("SELECT * FROM acl WHERE id=#{id}")
- AclEntity selectById(AclEntity aclEntity);
-
- @Select("SELECT * FROM acl")
- List<AclEntity> selectAll();
-
- @Update("UPDATE acl SET resource_type=#{resourceType} WHERE id=#{id}")
- void updateResourceTypeById(AclEntity aclEntity);
-
- @Update("UPDATE acl SET status=0 WHERE id=#{id}")
- void deleteById(AclEntity aclEntity);
-
@Insert({
"<script>",
" INSERT INTO acl (cluster_Id, pattern, operation, permission_Type, host, resource_Type, resource_Name, pattern_Type) VALUES ",
@@ -55,12 +44,22 @@
" </foreach>",
"</script>"})
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- Integer batchInsert(List<AclEntity> aclEntities);
+ void batchInsert(List<AclEntity> aclEntities);
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@Insert("INSERT INTO acl (cluster_id, pattern, operation, permission_type, host, resource_type, resource_name, pattern_type)"
+ "VALUE (#{clusterId}, #{pattern}, #{operation}, #{permissionType}, #{host}, #{resourceType}, #{resourceName}, #{patternType})")
void insert(AclEntity aclEntity);
+ @Update("UPDATE acl SET status=0 WHERE id=#{id}")
+ void deleteById(AclEntity aclEntity);
+ @Update("UPDATE acl SET resource_type=#{resourceType} WHERE id=#{id}")
+ void updateResourceTypeById(AclEntity aclEntity);
+
+ @Select("SELECT * FROM acl")
+ List<AclEntity> selectAll();
+
+ @Select("SELECT * FROM acl WHERE id=#{id}")
+ AclEntity selectById(AclEntity aclEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClientMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClientMapper.java
index d75f78f..7011ba4 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClientMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClientMapper.java
@@ -15,9 +15,12 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapper.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.ClientEntity;
+import org.apache.eventmesh.dashboard.console.mapper.SyncDataHandlerMapper;
+import org.apache.eventmesh.dashboard.console.modle.cluster.client.QueryClientByUserFormDTO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
@@ -32,24 +35,9 @@
* Mybatis Mapper for the table of client.
*/
@Mapper
-public interface ClientMapper {
+public interface ClientMapper extends SyncDataHandlerMapper<ClientEntity> {
- @Select("SELECT * FROM `client` WHERE `host` = #{host} AND `port` = #{port} AND status = 1")
- List<ClientEntity> selectByHostPort(ClientEntity clientEntity);
-
- @Select("SELECT * FROM `client` WHERE `id` = #{id}")
- ClientEntity selectById(ClientEntity clientEntity);
-
- @Select("SELECT * FROM `client` WHERE `cluster_id` = #{clusterId}")
- List<ClientEntity> selectByClusterId(ClientEntity clientEntity);
-
- @Update("UPDATE `client` SET status = 0, end_time = NOW() WHERE id = #{id}")
- Integer deactivate(ClientEntity clientEntity);
-
- @Update("UPDATE `client` SET status = 0, end_time = NOW() WHERE `host` = #{host} AND `port` = #{port}")
- Integer deActiveByHostPort(ClientEntity clientEntity);
-
@Select({
"<script>",
" INSERT INTO client (cluster_id, name, platform, language, pid, host, port, protocol, status,",
@@ -60,18 +48,60 @@
" </foreach>",
"</script>"})
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- Integer batchInsert(List<ClientEntity> clientEntityList);
+ void batchInsert(List<ClientEntity> clientEntityList);
+
+
+ @Select({"""
+ <script>
+ select * from client where cluster_id = #{clusterId}
+ <where>
+ <if text="runtimeId != null and runtimeId != ''">
+ runtime_id = #{runtimeId}
+ </if>
+ <if text="userId != null and userId != ''">
+ user_id = #{userId}
+ </if>
+ <if text="host != null and host != ''">
+ `host` = #{host}
+ </if>
+ </where>
+ and status = #{status}
+ </script>
+ """})
+ List<ClientEntity> queryClientByUserForm(QueryClientByUserFormDTO queryClientByUserFormDTO);
+
+ @Select("SELECT * FROM `client` WHERE `host` = #{host} AND `port` = #{port} AND status = 1")
+ List<ClientEntity> selectByHostPort(ClientEntity clientEntity);
+
+ @Select("SELECT * FROM `client` WHERE `id` = #{id}")
+ ClientEntity selectById(ClientEntity clientEntity);
+
+ @Select("SELECT * FROM `client` WHERE `cluster_id` = #{clusterId}")
+ List<ClientEntity> selectByClusterId(ClientEntity clientEntity);
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@Insert(
"INSERT INTO `client` (`cluster_id`, `name`, `platform`,"
- + "`language`, `pid`, `host`, `port`, `protocol`,"
- + "`status`, `config_ids`, `description`) "
- + "VALUES (#{clusterId}, #{name}, #{platform},"
- + "#{language}, #{pid}, #{host}, #{port}, #{protocol},"
- + "#{status}, #{configIds}, #{description})"
- + "ON DUPLICATE KEY UPDATE `status` = 1, `pid` = #{pid}, `config_ids` = #{configIds}, `host` = #{host}, `port` = #{port}")
- void insert(ClientEntity clientEntity);
+ + "`language`, `pid`, `host`, `port`, `protocol`,"
+ + "`status`, `config_ids`, `description`) "
+ + "VALUES (#{clusterId}, #{name}, #{platform},"
+ + "#{language}, #{pid}, #{host}, #{port}, #{protocol},"
+ + "#{status}, #{configIds}, #{description})"
+ + "ON DUPLICATE KEY UPDATE `status` = 1, `pid` = #{pid}, `config_ids` = #{configIds}, `host` = #{host}, `port` = #{port}")
+ Long insert(ClientEntity clientEntity);
+
+ @Update("UPDATE `client` SET status = 0, end_time = NOW() WHERE id = #{id}")
+ void deactivate(ClientEntity clientEntity);
+
+ @Update("UPDATE `client` SET status = 0, end_time = NOW() WHERE `host` = #{host} AND `port` = #{port}")
+ void deActiveByHostPort(ClientEntity clientEntity);
+ void syncInsert(List<ClientEntity> entityList);
+
+ void syncUpdate(List<ClientEntity> entityList);
+
+ void syncDelete(List<ClientEntity> entityList);
+
+ List<ClientEntity> syncGet(ClientEntity topicEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java
index a59c1a7..76ee972 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapper.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
@@ -32,52 +33,115 @@
/**
* cluster table operation
- *
*/
-
@Mapper
public interface ClusterMapper {
@Select("select * from cluster where id=#{id} and status=1")
- ClusterEntity selectClusterById(ClusterEntity cluster);
+ ClusterEntity queryByClusterId(ClusterEntity cluster);
+
+
+ @Select("""
+ select * from cluster where organization_id =#{organizationId} and cluster_type=#{clusterType}
+ """)
+ List<ClusterEntity> queryClusterByOrganizationIdAndType(ClusterEntity clusterEntity);
+
+
+ @Select("""
+ <script>
+ select * from cluster where id in(
+ select relationship_id from cluster_relationship where cluster_id=#{clusterId}
+ <if test="clusterType != null and clusterType != ''">
+ and cluster_type = #{clusterType}
+ </if>
+ )
+ </script>
+ """)
+ List<ClusterEntity> queryRelationClusterByClusterIdAndType(ClusterEntity clusterEntity);
+
+
+ @Select("""
+ <script>
+ select * from cluster where id in(
+ select id from cluster_relationship where id in(
+ <foreach item='item' index='index' separator=','>
+ item.id
+ </foreach>
+ )
+ </script>
+ """)
+ List<ClusterEntity> queryRelationshipClusterByClusterIdAndType(List<ClusterEntity> clusterEntityList);
@Select("select * from cluster where status=1")
- List<ClusterEntity> selectAllCluster();
+ List<ClusterEntity> queryAllCluster();
@Select("SELECT * FROM cluster where update_time > #{updateTime}")
List<ClusterEntity> selectClusterByUpdate(@Param("updateTime") long updateTime);
- @Select({
- "<script>",
- "",
- "",
- "</script>"
- })
+
+
+
+ @Select("""
+ <script>
+ </script>
+ """)
Map<String, Integer> queryHomeClusterData(ClusterIdDTO clusterIdDTO);
- @Update({"update cluster set name=#{name},jmx_properties=#{jmxProperties},description=#{description},auth_type=#{authType},run_state=#{runState}",
- " where id=#{id}"
- })
+ @Insert("""
+ <script>
+ insert into cluster( organization_id, name ,cluster_type,version,trusteeship_type,first_to_whom,replication_type,
+ deploy_status_type,cluster_own_type,resources_config_id,deploy_script_id,description,
+ config,auth_type,jmx_properties)
+ values
+ <foreach collection='list' item='item' index='index' separator=','>
+ (
+ #{item.organizationId}, #{item.name},#{item.clusterType},#{item.version},#{item.trusteeshipType},
+ #{item.firstToWhom},#{item.replicationType},#{item.deployStatusType},#{item.clusterOwnType},
+ #{item.resourcesConfigId},#{item.deployScriptId},#{item.description},#{item.config},
+ #{item.authType},#{item.jmxProperties}
+ )
+ </foreach>
+
+ </script>
+ """)
+ @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
+ Integer batchInsert(List<ClusterEntity> clusterEntities);
+
+
+ @Insert("""
+ insert into cluster( organization_id, name ,cluster_type,version,trusteeship_type,first_to_whom,replication_type,
+ deploy_status_type,cluster_own_type,resources_config_id,deploy_script_id,description,
+ config,auth_type,jmx_properties)
+ values(#{organizationId}, #{name},#{clusterType},#{version},#{trusteeshipType},#{firstToWhom},#{replicationType},
+ #{deployStatusType},#{clusterOwnType},#{resourcesConfigId},#{deployScriptId},#{description},
+ #{config},#{authType},#{jmxProperties})
+ """)
+ @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
+ Integer insertCluster(ClusterEntity cluster);
+
+ @Update("""
+ <script>
+ update cluster
+ set name=#{name},jmx_properties=#{jmxProperties},description=#{description},auth_type=#{authType},
+ run_state=#{runState}
+ where id=#{id}
+ </script>
+ """)
Integer updateClusterById(ClusterEntity cluster);
@Update("UPDATE cluster SET status=0 WHERE id=#{id}")
Integer deactivate(ClusterEntity clusterEntity);
- @Insert({
- "<script>",
- " insert into cluster (name,trusteeship_type, cluster_type, version, jmx_properties, description, auth_type) values ",
- " <foreach collection='list' item='c' index='index' separator=','>",
- " (#{c.name}, #{c.trusteeshipType}, #{c.clusterType}, #{c.version}, , #{c.jmxProperties}, #{c.description}, #{c.authType})",
- " </foreach>",
- "</script>"})
- @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- Integer batchInsert(List<ClusterEntity> clusterEntities);
- @Insert({
- "insert into cluster(name,trusteeship_type,cluster_type,version,jmx_properties,description,auth_type)values",
- "(#{name},#{c.trusteeshipType},#{c.clusterType},#{c.version},#{jmxProperties},#{regProperties},#{description},#{authType})"
- })
- @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- void insertCluster(ClusterEntity cluster);
+ @Select("""
+ select * from cluster where id=#{id} for update
+ """)
+ ClusterEntity lockByClusterId(ClusterEntity clusterEntity);
+
+ @Update("""
+ update cluster set runtime_index= runtime_index + #{runtimeIndex} where id=#{id}
+ """)
+ Integer updateNumByClusterId(ClusterEntity clusterEntity);
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapper.java
index a0ea6c2..d5dac2f 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapper.java
@@ -15,13 +15,16 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapper.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterAndRelationshipEntity;
import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity;
+import org.apache.eventmesh.dashboard.console.modle.DO.clusterRelationship.QueryListByClusterIdAndTypeDO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
@@ -33,6 +36,43 @@
@Mapper
public interface ClusterRelationshipMapper {
+
+ @Select("""
+ <script>
+ select * from cluster_relationship where cluster_id = #{clusterId}
+ <if test = "clusterTypeList != null">
+ and relationship_type in
+ <foreach item='item' index='index' collection='relationshipTypeList' open="(" separator=',' close=")">
+ #{item}
+ </foreach>
+ </if>
+ union all
+ select * from cluster_relationship where relationship_id = #{clusterId}
+ <if test = "clusterTypeList != null">
+ and cluster_type in
+ <foreach item='item' index='index' collection='clusterTypeList' open="(" separator=',' close=")">
+ #{item}
+ </foreach>
+ </if>
+ )
+ </script>
+ """)
+ List<ClusterRelationshipEntity> queryClusterRelationshipEntityListByClusterId(QueryListByClusterIdAndTypeDO data);
+
+ @Select("""
+ <script>
+ select * from cluster_relationship where cluster_id = #{clusterId}
+ <if test = "clusterTypeList != null">
+ and relationship_type in
+ <foreach item='item' index='index' collection='relationshipTypeList' open="(" separator=',' close=")">
+ #{item}
+ </foreach>
+ </if>
+ </script>
+ """)
+ List<ClusterRelationshipEntity> queryListByClusterIdAndType(QueryListByClusterIdAndTypeDO data);
+
+
@Select({
"<script>",
" select * from cluster as c inner join cluster_relationship as cr on c.id = c where cr.cluster_id ",
@@ -46,21 +86,40 @@
})
List<ClusterAndRelationshipEntity> queryClusterAndRelationshipEntityListByClusterId(ClusterRelationshipEntity clusterRelationshipEntity);
- @Select(" select * from cluster_relationship where status = 3")
- List<ClusterRelationshipEntity> selectAll();
- @Select(" select * from cluster_relationship where update_time = #{updateTime} and status in( 2 ,3)")
- List<ClusterRelationshipEntity> selectNewlyIncreased();
+
+ @Select(" select * from cluster_relationship where update_time > #{updateTime} and status in(1, 2 ,3)")
+ List<ClusterRelationshipEntity> queryNewlyIncreased(ClusterRelationshipEntity clusterRelationshipEntity);
+
+
+ @Select(" select * from cluster_relationship where status = 1")
+ List<ClusterRelationshipEntity> queryAll(ClusterRelationshipEntity clusterRelationshipEntity);
+
+ @Select("""
+ select * from cluster_relationship where id = #{id}
+ """)
+ ClusterRelationshipEntity queryById(ClusterRelationshipEntity clusterRelationshipEntity);
+
@Update("update cluster_relationship set status = 3 where id = #{id} ")
Integer relieveRelationship(ClusterRelationshipEntity clusterRelationshipEntity);
- @Insert({
- " insert into cluster_relationship (cluster_type,cluster_id,relationship_type,relationship_id)values( #{clusterType},#{clusterId},",
- "#{relationshipType},#{relationshipId})"
- })
- void insertClusterRelationshipEntry(ClusterRelationshipEntity clusterRelationshipEntity);
+ @Insert("""
+ <script>
+ insert into cluster_relationship (organization_id , cluster_type,cluster_id,relationship_type,relationship_id)
+ values
+ <foreach collection='list' item='item' index='index' separator=','>
+ (#{item.organizationId}, #{item.clusterType},#{item.clusterId},#{item.relationshipType},#{item.relationshipId})
+ </foreach>
+ </script>
+ """)
+ Integer batchClusterRelationshipEntry(List<ClusterRelationshipEntity> clusterRelationshipEntity);
+ @Insert("""
+ insert into cluster_relationship (organization_id , cluster_type,cluster_id,relationship_type,relationship_id)
+ values(#{organizationId}, #{clusterType},#{clusterId},#{relationshipType},#{relationshipId})
+ """)
+ @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
+ Integer insertClusterRelationshipEntry(ClusterRelationshipEntity clusterRelationshipEntity);
}
-
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ConnectionMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ConnectionMapper.java
index c9bab4c..0cf2f3b 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ConnectionMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ConnectionMapper.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapper.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity;
@@ -73,24 +74,12 @@
public List<ConnectionEntity> selectByClusterIdSinkTypeAndSinkIdAndCreateTimeRange(ConnectionEntity connectionEntity,
@Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime);
- @Update("UPDATE connection SET status = 1, end_time = NOW() WHERE id = #{id}")
- Integer endConnectionById(ConnectionEntity connectionEntity);
-
- //batch end
- @Update({
- "<script>",
- " <foreach collection='list' item='connectionEntity' index='index' separator=';'>",
- " UPDATE connection SET status = 1, end_time = NOW() WHERE id = #{connectionEntity.id}",
- " </foreach>",
- "</script>"})
- Integer batchEndConnectionById(List<ConnectionEntity> connectionEntityList);
-
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@Insert("INSERT INTO connection (cluster_id, source_type, source_id," + " sink_type, sink_id, runtime_id, status, topic, group_id, description)"
+ " VALUES ( #{clusterId}, #{sourceType}, #{sourceId}, "
+ " #{sinkType}, #{sinkId}, #{runtimeId}, 1, #{topic}, #{groupId}, #{description})"
+ "ON DUPLICATE KEY UPDATE status = 1")
- void insert(ConnectionEntity connectionEntity);
+ Long insert(ConnectionEntity connectionEntity);
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@Insert({
@@ -104,7 +93,18 @@
" </foreach>",
"ON DUPLICATE KEY UPDATE status = 1",
"</script>"})
- Integer batchInsert(List<ConnectionEntity> connectionEntityList);
+ void batchInsert(List<ConnectionEntity> connectionEntityList);
+ @Update("UPDATE connection SET status = 1, end_time = NOW() WHERE id = #{id}")
+ void endConnectionById(ConnectionEntity connectionEntity);
-}
+ //batch end
+ @Update({
+ "<script>",
+ " <foreach collection='list' item='connectionEntity' index='index' separator=';'>",
+ " UPDATE connection SET status = 1, end_time = NOW() WHERE id = #{connectionEntity.id}",
+ " </foreach>",
+ "</script>"})
+ void batchEndConnectionById(List<ConnectionEntity> connectionEntityList);
+
+}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/InstanceUserMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/InstanceUserMapper.java
deleted file mode 100644
index f9d8ff8..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/InstanceUserMapper.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.mapper.cluster;
-
-import org.apache.eventmesh.dashboard.console.entity.cluster.InstanceUserEntity;
-
-import org.apache.ibatis.annotations.Insert;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Options;
-import org.apache.ibatis.annotations.Select;
-import org.apache.ibatis.annotations.Update;
-
-import java.util.List;
-
-/**
- * Mybatis Mapper for the table of instanceuser.
- */
-@Mapper
-public interface InstanceUserMapper {
-
- @Select("select * from instance_user where status=1")
- List<InstanceUserEntity> selectAll();
-
- @Select("SELECT * FROM instance_user WHERE id=#{id} AND status=1")
- InstanceUserEntity selectById(InstanceUserEntity instanceuserEntity);
-
- @Select("SELECT * FROM instance_user WHERE name=#{name} AND status=1")
- List<InstanceUserEntity> selectByName(InstanceUserEntity instanceuserEntity);
-
- @Update("UPDATE instance_user SET status=0 WHERE id=#{clusterId}")
- Integer deleteInstanceUserById(InstanceUserEntity instanceuserEntity);
-
- @Update("UPDATE instance_user SET password=#{password} WHERE id=#{id}")
- Integer updatePasswordById(InstanceUserEntity instanceuserentity);
-
- @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- @Insert("INSERT INTO instance_user (id, instance_type, password, cluster_id, name, token, status) "
- + "VALUES (#{id}, #{instanceType}, #{password}, #{clusterId}, #{name}, #{token},1)")
- void insert(InstanceUserEntity instanceuserEntity);
-
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/NetConnectionMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/NetConnectionMapper.java
index 865b895..ea1b06a 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/NetConnectionMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/NetConnectionMapper.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapper.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.NetConnectionEntity;
@@ -28,14 +29,13 @@
* 1. 添加 and 修改。没有控制层接口
* 2. 按照 cluster or runtime id and client(host and port) 查询
* 3. 按照时间进行统计
- *
*/
@Mapper
public interface NetConnectionMapper {
- List<NetConnectionEntity> queryNetConnectionEntityListByFrom(NetConnectionEntity netConnectionEntity);
Integer batchInsert(List<NetConnectionEntity> netConnectionEntityList);
+ List<NetConnectionEntity> queryNetConnectionEntityListByFrom(NetConnectionEntity netConnectionEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/RuntimeMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/RuntimeMapper.java
index ed45126..f2f7a3f 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/RuntimeMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/RuntimeMapper.java
@@ -15,9 +15,13 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapper.cluster;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.mapper.SyncDataHandlerMapper;
+import org.apache.eventmesh.dashboard.console.modle.DO.runtime.QueryRuntimeByBigExpandClusterDO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
@@ -32,59 +36,146 @@
* runtime table operation
*/
@Mapper
-public interface RuntimeMapper {
+public interface RuntimeMapper extends SyncDataHandlerMapper<RuntimeEntity> {
- @Select("SELECT COUNT(*) FROM runtime WHERE cluster_id=#{clusterId} AND status=1")
- Integer selectRuntimeNumByCluster(RuntimeEntity runtimeEntity);
+ @Select("""
+ <script>
+ select * from runtime where cluster_id =#{runtimeEntity.clusterId}
+ <if test='runtimeEntity.host!=null'>
+ and host like CONCAT('%',#{runtimeEntity.host},'%')
+ </if>
+ </script>
+ """)
+ List<RuntimeEntity> getRuntimesToFrontByCluster(@Param("runtimeEntity") RuntimeEntity runtimeEntity);
- @Select("SELECT * FROM runtime WHERE status=1")
- List<RuntimeEntity> selectAll();
+ @Select("""
+ <script>
+ select * from runtime where cluster_id in(
+ select relationship_id from cluster_relationship where cluster_id in (
+ select cluster_id from cluster_relationship where relationship_id = #{followClusterId}
+ )
+ <if test='queryClusterTypeList!=null'>
+ and relationship_type in
+ <foreach collection='queryClusterTypeList' item='item' index='index' open="(" separator=',' close=")">
+ #{item}
+ </foreach>
+ </if>
+ )
+ </script>
+ """)
+ /**
+ * 查询 子集群的主集群中的某个类型的集群。
+ */
+ List<RuntimeEntity> queryClusterRuntimeOnClusterSpecifyByClusterId(QueryRuntimeByBigExpandClusterDO queryRuntimeByBigExpandClusterDO);
+
+ /**
+ * TODO 如何设计动态查询
+ * 通过 本集群 查询 主集群中 特定依赖集群中 的 特定依赖集群的 runtime
+ * <p> 比如 eventmesh runtime 得到所有存储的 meta集群信息 </p>
+ * <ol>
+ * <li> 通过 eventmesh runtime id 以及 eventmesh cluster type 得到 eventmesh cluster id </li>
+ * <li> 通过 eventmesh cluster id 以及 storage cluster type(列表) or storage type 得到 storage cluster id </li>
+ * <li> 通过 storage cluster id 以及 storage meta type 列表) or meta type 得到 meta cluster id </li>
+ * <li> 通过 meta cluster id 得到 runtime </li>
+ * </ol>
+ */
+ @Select("""
+ <script>
+ select * from runtime where cluster_id in(
+ select relationship_id from cluster_relationship where cluster_id in(
+ select relationship_id from cluster_relationship where cluster_id in(
+ select cluster_id from cluster_relationship where relationship_id = #{followClusterId} and cluster_type= #{mainClusterType}
+ )
+ and relationship_type in
+ <foreach collection='storageClusterTypeList' item='item' index='index' open="(" separator=',' close=")">
+ #{item}
+ </foreach>
+ )
+ <if test='storageClusterTypeList!=null'>
+ and relationship_type in
+ <foreach collection='storageMetaClusterTypeList' item='item' index='index' open="(" separator=',' close=")">
+ #{item}
+ </foreach>
+ </if>
+ )
+ </script>
+ """)
+ List<RuntimeEntity> queryRuntimeByBigExpandCluster(QueryRuntimeByBigExpandClusterDO queryRuntimeByBigExpandClusterDO);
+
+
+ @Select("""
+ <script>
+ select * from runtime where cluster_id in
+ <foreach collection='list' item='item' index='index' open="(" separator=',' close=")">
+ #{item.id}
+ </foreach>
+ </script>
+ """)
+ List<RuntimeEntity> queryRuntimeByClusterId(List<ClusterEntity> clusterEntityList);
+
@Select("select * from runtime where cluster_id=#{clusterid} and status=1")
List<RuntimeEntity> selectRuntimeByCluster(RuntimeEntity runtimeEntity);
+ @Select("select COUNT(*) from runtime where cluster_id=#{clusterId} AND status=1")
+ Integer getRuntimeNumByCluster(RuntimeEntity runtimeEntity);
+
+ @Select("select * from runtime where update_time = #{updateTime} and status=1")
+ List<RuntimeEntity> queryByUpdateTime(RuntimeEntity runtimeEntity);
+
+
@Select("select * from runtime where id=#{id} and status=1")
RuntimeEntity queryRuntimeEntityById(RuntimeEntity runtimeEntity);
- @Select({
- "<script>",
- "SELECT * FROM runtime",
- "<where>",
- "cluster_id =#{runtimeEntity.clusterId}",
- "<if test='runtimeEntity.host!=null'>",
- "and host like CONCAT('%',#{runtimeEntity.host},'%')",
- "</if>",
- "</where>",
- "</script>"})
- List<RuntimeEntity> selectRuntimesToFrontByCluster(@Param("runtimeEntity") RuntimeEntity runtimeEntity);
+ @Select("select * from runtime where status=1")
+ List<RuntimeEntity> queryAll();
- @Select("SELECT * FROM runtime WHERE host = #{host} and port = #{port} and status = 1")
- List<RuntimeEntity> selectByHostPort(RuntimeEntity runtimeEntity);
+ @Update("UPDATE runtime SET port=#{port} ,jmx_port=#{jmxPort} ,status=#{status} where cluster_id=#{clusterId} AND status=1")
+ void updateRuntimeByCluster(RuntimeEntity runtimeEntity);
- @Update("UPDATE runtime SET port=#{port} ,jmx_port=#{jmxPort} ,status=#{status} WHERE cluster_id=#{clusterId} AND status=1")
- Integer updateRuntimeByCluster(RuntimeEntity runtimeEntity);
+ @Update("UPDATE runtime SET status=0 where cluster_id=#{clusterId}")
+ void deleteRuntimeByCluster(RuntimeEntity runtimeEntity);
- @Update("UPDATE runtime SET status=0 WHERE cluster_id=#{clusterId}")
- Integer deleteRuntimeByCluster(RuntimeEntity runtimeEntity);
+ @Update("UPDATE runtime SET status = 0 where id = #{id}")
+ void deactivate(RuntimeEntity runtimeEntity);
- @Update("UPDATE runtime SET status = 0 WHERE id = #{id}")
- Integer deactivate(RuntimeEntity runtimeEntity);
- @Insert({
- "<script>",
- " INSERT INTO runtime (cluster_id, host, storage_cluster_id, port, jmx_port, start_timestamp, rack, status, endpoint_map) VALUES",
- " <foreach collection='list' item='c' index='index' separator=','>",
- " (#{c.clusterId},#{c.host},#{c.storageClusterId},#{c.port},#{c.jmxPort},NOW(),#{c.rack},#{c.status},#{c.endpointMap})",
- " </foreach>",
- "</script>"})
+ @Insert("""
+ <script>
+ insert into runtime( organization_id , cluster_id , name , cluster_type ,version ,host ,port ,trusteeship_type,first_to_whom,
+ replication_type,kubernetes_cluster_id, deploy_status_type, resources_config_id,deploy_script_id,
+ create_script_content ,auth_type,jmx_port)
+ values
+ <foreach collection='list' item='item' index='index' separator=','>
+ (
+ #{item.organizationId}, #{item.clusterId}, #{item.name}, #{item.clusterType},#{item.version},#{item.host},
+ #{item.port},#{item.trusteeshipType},#{item.firstToWhom},#{item.replicationType},#{item.kubernetesClusterId},
+ #{item.deployStatusType}, #{item.resourcesConfigId},#{item.deployScriptId},'',#{item.authType},#{item.jmxPort}
+ )
+ </foreach>
+
+ </script>
+ """)
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- Integer batchInsert(List<RuntimeEntity> runtimeEntities);
+ void batchInsert(List<RuntimeEntity> runtimeEntities);
- @Insert("INSERT INTO runtime (cluster_id, host, storage_cluster_id, port, jmx_port, start_timestamp, rack, status, "
- + "endpoint_map) VALUES(#{clusterId},#{host},#{storageClusterId},#{port},#{jmxPort},NOW(),#{rack},#{status},#{endpointMap})"
- + " ON DUPLICATE KEY UPDATE status=1,start_timestamp = now()")
+ @Insert("""
+ insert into runtime( organization_id , cluster_id , name , cluster_type ,version ,host ,port ,trusteeship_type,first_to_whom,
+ replication_type, deploy_status_type, resources_config_id,deploy_script_id,create_script_content ,auth_type,jmx_port)
+ values(#{organizationId}, #{clusterId}, #{name}, #{clusterType},#{version},#{host},#{port},#{trusteeshipType},#{firstToWhom},
+ #{replicationType}, #{deployStatusType},#{resourcesConfigId},#{deployScriptId},'',#{authType},#{jmxPort})
+ ON DUPLICATE KEY UPDATE status=1,online_timestamp = now()
+ """)
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void insertRuntime(RuntimeEntity runtimeEntity);
+ void syncInsert(List<RuntimeEntity> runtimeEntities);
+
+ void syncUpdate(List<RuntimeEntity> runtimeEntities);
+
+ void syncDelete(List<RuntimeEntity> runtimeEntities);
+
+
+ List<RuntimeEntity> syncGet(RuntimeEntity topicEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapper.java
index 1c9d7be..3ae4011 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapper.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapper.connector;
import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
@@ -45,37 +46,11 @@
@Select("SELECT * FROM connector WHERE host = #{host} AND port = #{port} AND status=1")
List<ConnectorEntity> selectByHostAndPort(ConnectorEntity connectorEntity);
- @Update("UPDATE connector SET status = 1 WHERE id = #{id}")
- Integer active(ConnectorEntity connectorEntity);
-
- @Update("UPDATE connector SET status = 0 WHERE id = #{id}")
- Integer deActive(ConnectorEntity connectorEntity);
-
- @Update("UPDATE connector SET pod_state = #{podState} WHERE id = #{id}")
- Integer updatePodState(ConnectorEntity connectorEntity);
-
- @Update("UPDATE connector SET config_ids = #{configIds} WHERE id = #{id}")
- Integer updateConfigIds(ConnectorEntity connectorEntity);
-
- @Update("UPDATE connector SET status = 0 WHERE cluster_id = #{clusterId}")
- Integer deactivateByClusterId(ConnectorEntity connectorEntity);
-
- @Update({
- "<script>",
- " update connector set status = 0 ",
- " where id in ",
- " <foreach collection='list' item='item' index='index' open='(' separator=',' close=')'>",
- " #{item.id}",
- " </foreach>",
- "</script>"
- })
- Integer batchDeactivate(List<ConnectorEntity> connectorEntities);
-
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@Insert("INSERT INTO connector (cluster_id,name, class_name, type, status, pod_state, config_ids, host, port) "
+ "VALUES (#{clusterId}, #{name}, #{className}, #{type}, #{status}, #{podState}, #{configIds}, #{host}, #{port})"
+ "ON DUPLICATE KEY UPDATE status = 1, pod_state = #{podState}, config_ids = #{configIds}, host = #{host}, port = #{port}")
- void insert(ConnectorEntity connectorEntity);
+ Long insert(ConnectorEntity connectorEntity);
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@Insert({
@@ -87,6 +62,31 @@
" #{connectorEntity.configIds}, #{connectorEntity.host}, #{connectorEntity.port})",
" </foreach>",
"</script>"})
- Integer batchInsert(List<ConnectorEntity> connectorEntityList);
+ void batchInsert(List<ConnectorEntity> connectorEntityList);
+ @Update("UPDATE connector SET status = 1 WHERE id = #{id}")
+ void active(ConnectorEntity connectorEntity);
+
+ @Update("UPDATE connector SET status = 0 WHERE id = #{id}")
+ void deActive(ConnectorEntity connectorEntity);
+
+ @Update("UPDATE connector SET pod_state = #{podState} WHERE id = #{id}")
+ void updatePodState(ConnectorEntity connectorEntity);
+
+ @Update("UPDATE connector SET config_ids = #{configIds} WHERE id = #{id}")
+ void updateConfigIds(ConnectorEntity connectorEntity);
+
+ @Update("UPDATE connector SET status = 0 WHERE cluster_id = #{clusterId}")
+ void deactivateByClusterId(ConnectorEntity connectorEntity);
+
+ @Update({
+ "<script>",
+ " update connector set status = 0 ",
+ " where id in ",
+ " <foreach collection='list' item='item' index='index' open='(' separator=',' close=')'>",
+ " #{item.id}",
+ " </foreach>",
+ "</script>"
+ })
+ void batchDeactivate(List<ConnectorEntity> connectorEntities);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/deploy/DeployScriptMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/deploy/DeployScriptMapper.java
new file mode 100644
index 0000000..7b96b6e
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/deploy/DeployScriptMapper.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.mapper.deploy;
+
+import org.apache.eventmesh.dashboard.console.entity.cases.DeployScriptEntity;
+
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+/**
+ *
+ */
+@Mapper
+public interface DeployScriptMapper {
+
+
+ @Insert("""
+ insert into deploy_script () values()
+ """)
+ void insert(DeployScriptEntity deployScriptEntity);
+
+
+ @Update("""
+ update deploy_script set description=#{description} content=#{content} where id=#{id}")"
+ """)
+ void update(DeployScriptEntity deployScriptEntity);
+
+
+ @Update("""
+ update deploy_script set status = 1 where id=#{id}")"
+ """)
+ void deleteById(DeployScriptEntity deployScriptEntity);
+
+
+ @Select("""
+ <script>
+ select * from deploy_script where organization_id=#{id}
+ <if test = "name!=null">
+ and name like concat('%',#{name},'%')
+ </if>
+ </script>
+ """)
+ void queryByName(DeployScriptEntity deployScriptEntity);
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/deploy/PortMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/deploy/PortMapper.java
new file mode 100644
index 0000000..50fe175
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/deploy/PortMapper.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.mapper.deploy;
+
+import org.apache.eventmesh.dashboard.console.entity.cases.PortEntity;
+
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+/**
+ *
+ */
+@Mapper
+public interface PortMapper {
+
+
+ @Insert("insert into port(cluster_id, current_port)values (#{clusterId},#{currentPort})")
+ void insertPort(PortEntity portEntity);
+
+
+ @Select(" select * from port where cluster_id = #{clusterId} for update")
+ PortEntity lockPort(PortEntity portEntity);
+
+ @Update(" update port set current_port = current_port + #{currentPort} where cluster_id=#{clusterId}")
+ void updatePort(PortEntity portEntity);
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/ConfigMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/ConfigMapper.java
index 119c5ae..ce1542d 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/ConfigMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/ConfigMapper.java
@@ -15,13 +15,16 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapper.function;
import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.mapper.SyncDataHandlerMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
+import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
@@ -31,7 +34,7 @@
* config table operation
*/
@Mapper
-public interface ConfigMapper {
+public interface ConfigMapper extends SyncDataHandlerMapper<ConfigEntity> {
@Select({
"<script>",
@@ -49,7 +52,7 @@
"</if>",
"</where>",
"</script>"})
- List<ConfigEntity> selectConfigsToFrontWithDynamic(ConfigEntity configEntity);
+ List<ConfigEntity> getConfigsToFrontWithDynamic(ConfigEntity configEntity);
@Select("SELECT * FROM config WHERE business_type=#{businessType} AND is_default=1")
List<ConfigEntity> selectConnectorConfigsByBusinessType(ConfigEntity configEntity);
@@ -57,32 +60,13 @@
@Select("SELECT DISTINCT business_type FROM config WHERE instance_type=2 AND is_default=1 AND business_type LIKE CONCAT('%',#{businessType},'%')")
List<String> selectConnectorBusinessType(ConfigEntity configEntity);
+
@Select("SELECT * FROM config WHERE status=1 AND is_default=0")
List<ConfigEntity> selectAll();
@Select("SELECT * FROM config WHERE instance_type=#{instanceType} AND instance_id=#{instanceId}")
List<ConfigEntity> selectConfigsByInstance(ConfigEntity configEntity);
- @Select("SELECT * FROM config WHERE instance_type=#{instanceType} AND instance_id=#{instanceId} AND is_default=0")
- List<ConfigEntity> selectByInstanceId(ConfigEntity configEntity);
-
- @Select("SELECT * FROM config WHERE cluster_id=-1 AND business_type=#{businessType} AND instance_type=#{instanceType} AND is_default=1")
- List<ConfigEntity> selectDefaultConfig(ConfigEntity configEntity);
-
- @Select("SELECT * FROM config WHERE is_default=1")
- List<ConfigEntity> selectAllDefaultConfig();
-
- @Select("SELECT * FROM config WHERE cluster_id=#{clusterId} AND instance_type=#{instanceType} "
- + "AND instance_id=#{instanceId} AND config_name=#{configName} AND status=1")
- ConfigEntity selectByUnique(ConfigEntity configEntity);
-
- @Update("UPDATE config SET status=0 WHERE id=#{id}")
- Integer deleteConfig(ConfigEntity configEntity);
-
- @Update("UPDATE config SET config_value=#{configValue} ,already_update=#{alreadyUpdate} WHERE instance_type=#{instanceType} AND"
- + " instance_id=#{instanceId} AND config_name=#{configName} AND is_default=0")
- Integer updateConfig(ConfigEntity configEntity);
-
@Insert({
"<script>",
" INSERT INTO config (cluster_id, business_type, instance_type, instance_id, config_name, config_value, start_version,",
@@ -94,15 +78,46 @@
" </foreach>",
"</script>"})
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- Integer batchInsert(List<ConfigEntity> configEntityList);
+ void batchInsert(List<ConfigEntity> configEntityList);
+
+
+ @Insert("insert into config () select *,#{targetId} as cluster_id from config where clster where cluster_id = #{sourceId}")
+ void copyConfig(@Param("sourceId") Long sourceId, @Param("targetId") Long targetId);
@Insert("INSERT INTO config (cluster_id, business_type, instance_type, instance_id, config_name, config_value, "
- + "status, is_default, diff_type, description, edit, is_modify,start_version,"
- + "eventmesh_version,end_version) VALUE "
- + "(#{clusterId},#{businessType},#{instanceType},#{instanceId},#{configName},"
- + "#{configValue},#{status},#{isDefault},#{diffType},#{description},#{edit},#{isModify},"
- + "#{startVersion},#{eventmeshVersion},#{endVersion})")
+ + "status, is_default, diff_type, description, edit, is_modify,start_version,"
+ + "eventmesh_version,end_version) VALUE "
+ + "(#{clusterId},#{businessType},#{instanceType},#{instanceId},#{configName},"
+ + "#{configValue},#{status},#{isDefault},#{diffType},#{description},#{edit},#{isModify},"
+ + "#{startVersion},#{eventmeshVersion},#{endVersion})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- void insertConfig(ConfigEntity configEntity);
+ Integer addConfig(ConfigEntity configEntity);
+ @Update("UPDATE config SET status=0 WHERE id=#{id}")
+ Integer deleteConfig(ConfigEntity configEntity);
+
+ @Update("UPDATE config SET config_value=#{configValue} ,already_update=#{alreadyUpdate} WHERE instance_type=#{instanceType} AND"
+ + " instance_id=#{instanceId} AND config_name=#{configName} AND is_default=0")
+ void updateConfig(ConfigEntity configEntity);
+
+ @Select("SELECT * FROM config WHERE instance_type=#{instanceType} AND instance_id=#{instanceId} AND is_default=0")
+ List<ConfigEntity> selectByInstanceId(ConfigEntity configEntity);
+
+ @Select("SELECT * FROM config WHERE cluster_id=-1 AND business_type=#{businessType} AND instance_type=#{instanceType} AND is_default=1")
+ List<ConfigEntity> selectDefaultConfig(ConfigEntity configEntity);
+
+ @Select("SELECT * FROM config WHERE is_default=1")
+ List<ConfigEntity> selectAllDefaultConfig();
+
+ @Select("SELECT * FROM config WHERE cluster_id=#{clusterId} AND instance_type=#{instanceType} "
+ + "AND instance_id=#{instanceId} AND config_name=#{configName} AND status=1")
+ ConfigEntity selectByUnique(ConfigEntity configEntity);
+
+ void syncInsert(List<ConfigEntity> entityList);
+
+ void syncUpdate(List<ConfigEntity> entityList);
+
+ void syncDelete(List<ConfigEntity> entityList);
+
+ List<ConfigEntity> syncGet(ConfigEntity topicEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/HealthCheckResultMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/HealthCheckResultMapper.java
index bdb1587..f955fee 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/HealthCheckResultMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/HealthCheckResultMapper.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapper.function;
import org.apache.eventmesh.dashboard.console.entity.function.HealthCheckResultEntity;
@@ -54,38 +55,6 @@
List<HealthCheckResultEntity> selectByClusterIdAndCreateTimeRange(@Param("clusterId") Long clusterId,
@Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime);
- @Select({
- "<script>",
- " SELECT * FROM health_check_result",
- " <if test='list != null and list.size() > 0'>",
- " WHERE (cluster_id, type, type_id) IN",
- " <foreach collection='list' item='item' open='(' separator=',' close=')'>",
- " (#{item.clusterId}, #{item.type}, #{item.typeId})",
- " </foreach>",
- " AND (state = 2 OR state = 4)",
- " </if>",
- " ORDER BY create_time DESC",
- "</script>"
- })
- List<HealthCheckResultEntity> selectIdsNeedToBeUpdateByClusterIdAndTypeAndTypeId(List<HealthCheckResultEntity> healthCheckResultEntityList);
-
- @Update("UPDATE health_check_result SET state = #{state}, result_desc = #{resultDesc} WHERE id = #{id}")
- Integer update(HealthCheckResultEntity healthCheckResultEntity);
-
- @Update({
- "<script>",
- " <foreach collection='list' item='healthCheckResultEntity' index='index' separator=';'>",
- " UPDATE health_check_result SET state = #{healthCheckResultEntity.state},",
- " result_desc = #{healthCheckResultEntity.resultDesc} WHERE id = #{healthCheckResultEntity.id}",
- " </foreach>",
- "</script>"})
- Integer batchUpdate(List<HealthCheckResultEntity> healthCheckResultEntityList);
-
- /**
- * TODO 未同步修改调用方法^
- * @param healthCheckResultEntity
- */
-
@Options(useGeneratedKeys = true, keyProperty = "id")
@Insert("INSERT INTO health_check_result(type,type_id, cluster_id, state,result_desc)"
+ " VALUES( #{type}, #{typeId}, #{clusterId}, #{state}, #{resultDesc})")
@@ -106,7 +75,7 @@
" </if>",
"</script>"
})
- Integer batchInsert(List<HealthCheckResultEntity> healthCheckResultEntityList);
+ void batchInsert(List<HealthCheckResultEntity> healthCheckResultEntityList);
@Insert({
"<script>",
@@ -120,7 +89,33 @@
" </if>",
"</script>"
})
- Integer insertNewChecks(List<HealthCheckResultEntity> healthCheckResultEntityList);
+ void insertNewChecks(List<HealthCheckResultEntity> healthCheckResultEntityList);
+ @Update("UPDATE health_check_result SET state = #{state}, result_desc = #{resultDesc} WHERE id = #{id}")
+ void update(HealthCheckResultEntity healthCheckResultEntity);
+
+ @Update({
+ "<script>",
+ " <foreach collection='list' item='healthCheckResultEntity' index='index' separator=';'>",
+ " UPDATE health_check_result SET state = #{healthCheckResultEntity.state},",
+ " result_desc = #{healthCheckResultEntity.resultDesc} WHERE id = #{healthCheckResultEntity.id}",
+ " </foreach>",
+ "</script>"})
+ void batchUpdate(List<HealthCheckResultEntity> healthCheckResultEntityList);
+
+ @Select({
+ "<script>",
+ " SELECT * FROM health_check_result",
+ " <if test='list != null and list.size() > 0'>",
+ " WHERE (cluster_id, type, type_id) IN",
+ " <foreach collection='list' item='item' open='(' separator=',' close=')'>",
+ " (#{item.clusterId}, #{item.type}, #{item.typeId})",
+ " </foreach>",
+ " AND (state = 2 OR state = 4)",
+ " </if>",
+ " ORDER BY create_time DESC",
+ "</script>"
+ })
+ List<HealthCheckResultEntity> getIdsNeedToBeUpdateByClusterIdAndTypeAndTypeId(List<HealthCheckResultEntity> healthCheckResultEntityList);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/OprLogMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/OprLogMapper.java
index 6452a48..0779e31 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/OprLogMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/OprLogMapper.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapper.function;
import org.apache.eventmesh.dashboard.console.entity.function.LogEntity;
@@ -49,7 +50,15 @@
" AND is_delete=0",
" </where>",
"</script>"})
- List<LogEntity> selectLogList(LogEntity logEntity);
+ List<LogEntity> getLogList(LogEntity logEntity);
+
+ @Insert("INSERT INTO operation_log ( cluster_id, operation_type,target_type, content,operation_user,result)"
+ + "VALUE (#{clusterId},#{operationType},#{targetType},#{content},#{operationUser},#{result})")
+ @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
+ Long addLog(LogEntity logEntity);
+
+ @Update("UPDATE operation_log SET state=#{state} ,result=#{result} WHERE id=#{id}")
+ Integer updateLog(LogEntity logEntity);
@Select({
"<script>",
@@ -73,14 +82,5 @@
"</where>",
"</script>"
})
- List<LogEntity> selectLogListToFront(LogEntity logEntity);
-
- @Update("UPDATE operation_log SET state=#{state} ,result=#{result} WHERE id=#{id}")
- Integer updateLog(LogEntity logEntity);
-
- @Insert("INSERT INTO operation_log ( cluster_id, operation_type,target_type, content,operation_user,result)"
- + "VALUE (#{clusterId},#{operationType},#{targetType},#{content},#{operationUser},#{result})")
- @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- void insertLog(LogEntity logEntity);
-
+ List<LogEntity> getLogListToFront(LogEntity logEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/ConsumerOffsetMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/ConsumerOffsetMapper.java
new file mode 100644
index 0000000..465efc2
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/ConsumerOffsetMapper.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.mapper.message;
+
+import org.apache.eventmesh.dashboard.console.entity.message.ConsumeOffsetEntity;
+import org.apache.eventmesh.dashboard.console.mapper.SyncDataHandlerMapper;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ *
+ */
+@Mapper
+public interface ConsumerOffsetMapper extends SyncDataHandlerMapper<ConsumeOffsetEntity> {
+
+
+ void syncInsert(List<ConsumeOffsetEntity> entityList);
+
+ void syncUpdate(List<ConsumeOffsetEntity> entityList);
+
+ void syncDelete(List<ConsumeOffsetEntity> entityList);
+
+ List<ConsumeOffsetEntity> syncGet(ConsumeOffsetEntity topicOffsetEntity);
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/OprGroupMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/GroupMapper.java
similarity index 80%
rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/OprGroupMapper.java
rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/GroupMapper.java
index ae196ec..8b6130d 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/OprGroupMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/GroupMapper.java
@@ -15,9 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapper.message;
import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity;
+import org.apache.eventmesh.dashboard.console.mapper.SyncDataHandlerMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
@@ -31,19 +33,28 @@
* operate Group mapper
**/
@Mapper
-public interface OprGroupMapper {
+public interface GroupMapper extends SyncDataHandlerMapper<GroupEntity> {
@Select("SELECT * FROM `group` WHERE cluster_id=#{clusterId} AND name=#{name} AND type=0 ")
GroupEntity selectGroupByNameAndClusterId(GroupEntity groupEntity);
@Select("SELECT COUNT(*) FROM `group` WHERE cluster_id=#{clusterId} AND type=0")
- Integer selectConsumerNumByCluster(GroupEntity groupEntity);
+ Integer getConsumerNumByCluster(GroupEntity groupEntity);
@Select("SELECT * FROM `group` WHERE status=1")
List<GroupEntity> selectAll();
+ @Update("UPDATE `group` SET member_count=#{memberCount},"
+ + "members=#{members},type=#{type},state=#{state} WHERE id=#{id}")
+ @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
+ Integer updateGroup(GroupEntity groupEntity);
+
+ @Update("UPDATE `group` SET status=1 WHERE id=#{id}")
+ @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
+ Integer deleteGroup(GroupEntity groupEntity);
+
@Select("SELECT * FROM `group` WHERE cluster_id=#{clusterId} AND name=#{name} AND status=1")
GroupEntity selectGroupByUnique(GroupEntity groupEntity);
@@ -65,15 +76,6 @@
"</script>"})
List<GroupEntity> selectGroup(GroupEntity groupEntity);
- @Update("UPDATE `group` SET member_count=#{memberCount},"
- + "members=#{members},type=#{type},state=#{state} WHERE id=#{id}")
- @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- Integer updateGroup(GroupEntity groupEntity);
-
- @Update("UPDATE `group` SET status=1 WHERE id=#{id}")
- @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- Integer deleteGroup(GroupEntity groupEntity);
-
@Insert({
"<script>",
@@ -83,11 +85,24 @@
" </foreach>",
"</script>"})
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- Integer batchInsert(List<GroupEntity> groupEntities);
+ void batchInsert(List<GroupEntity> groupEntities);
@Insert("INSERT INTO `group` (cluster_id, name, member_count, members, type, state)"
- + "VALUE (#{clusterId},#{name},#{memberCount},#{members},#{type},#{state}) "
- + "ON DUPLICATE KEY UPDATE status=1")
+ + "VALUE (#{clusterId},#{name},#{memberCount},#{members},#{type},#{state}) "
+ + "ON DUPLICATE KEY UPDATE status=1")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- void insertGroup(GroupEntity groupEntity);
+ void addGroup(GroupEntity groupEntity);
+
+
+ @Override
+ void syncInsert(List<GroupEntity> entityList);
+
+ @Override
+ void syncUpdate(List<GroupEntity> entityList);
+
+ @Override
+ void syncDelete(List<GroupEntity> entityList);
+
+ @Override
+ List<GroupEntity> syncGet(GroupEntity topicEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/OprGroupMemberMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/OprGroupMemberMapper.java
index 79f6b1a..0e81b13 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/OprGroupMemberMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/OprGroupMemberMapper.java
@@ -15,10 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapper.message;
-import org.apache.eventmesh.dashboard.console.entity.message.GroupMemberEntity;
+import org.apache.eventmesh.dashboard.console.entity.message.SubscriptionEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
@@ -35,68 +36,78 @@
@Mapper
public interface OprGroupMemberMapper {
- @Select("SELECT topic_name FROM group_member WHERE cluster_id=#{clusterId} AND group_name=#{groupName}")
- List<String> selectTopicsByGroupNameAndClusterId(GroupMemberEntity groupMemberEntity);
- @Select("SELECT DISTINCT (group_name) FROM group_member WHERE cluster_id=#{clusterId} AND topic_name=#{topicName}")
- List<String> selectGroupNameByTopicName(GroupMemberEntity groupMemberEntity);
+ @Deprecated
+ @Select("select topic_name from group_member where cluster_id=#{clusterId} and group_name=#{groupName}")
+ List<String> selectTopicsByGroupNameAndClusterId(SubscriptionEntity subscriptionEntity);
- @Select("SELECT * FROM group_member WHERE status=1")
- List<GroupMemberEntity> selectAll();
+ @Deprecated
+ @Select("select DISTINCT (group_name) from group_member where cluster_id=#{clusterId} and topic_name=#{topicName}")
+ List<String> selectGroupNameByTopicName(SubscriptionEntity subscriptionEntity);
- @Select("SELECT * FROM group_member WHERE cluster_id=#{clusterId} AND group_name=#{groupName} AND topic_name=#{topicName} AND status=1")
- GroupMemberEntity selectGroupMemberByUnique(GroupMemberEntity groupMemberEntity);
+ @Select("select * from group_member where status=1")
+ List<SubscriptionEntity> selectAll();
- @Select("SELECT * FROM group_member WHERE id=#{id} AND status=1")
- GroupMemberEntity selectGroupMemberById(GroupMemberEntity groupMemberEntity);
- @Select({
- "<script>",
- " SELECT * FROM group_member",
- " <where>",
- " <if test='clusterId != null'>",
- " cluster_id=#{clusterId}",
- " </if>",
- " <if test='groupName != null'>",
- " AND group_name=#{groupName}",
- " </if>",
- " <if test='topicName != null'>",
- " AND topic_name=#{topicName}",
- " </if>",
- " </where>",
- " AND status=1",
- "</script>"})
- List<GroupMemberEntity> selectMember(GroupMemberEntity groupMemberEntity);
+ @Deprecated
+ @Select("select * from group_member where cluster_id=#{clusterId} and status=1")
+ List<SubscriptionEntity> getGroupByClusterId(SubscriptionEntity subscriptionEntity);
- @Select("SELECT * FROM group_member WHERE cluster_id=#{clusterId} AND status=1")
- List<GroupMemberEntity> selectGroupByClusterId(GroupMemberEntity groupMemberEntity);
- @Update("UPDATE group_member SET state=#{state} WHERE id=#{id}")
+ @Deprecated
+ @Select("select * from group_member where cluster_id=#{clusterId} and group_name=#{groupName} and topic_name=#{topicName} and status=1")
+ SubscriptionEntity selectGroupMemberByUnique(SubscriptionEntity subscriptionEntity);
+
+ @Select("""
+ <script>
+ select * from group_member
+ where
+ <if test='clusterId != null'>
+ cluster_id=#{clusterId}
+ </if>
+ <if test='groupName != null'>
+ and group_name=#{groupName}
+ </if>
+ <if test='topicName != null'>
+ and topic_name=#{topicName}
+ </if>
+ and status=1
+ </script>
+ """)
+ List<SubscriptionEntity> selectMember(SubscriptionEntity subscriptionEntity);
+
+
+ @Select("select * from group_member where id=#{id} and status=1")
+ SubscriptionEntity selectGroupMemberById(SubscriptionEntity subscriptionEntity);
+
+ @Update("UPDATE group_member SET state=#{state} where id=#{id}")
+ void updateGroupMember(SubscriptionEntity subscriptionEntity);
+
+ @Deprecated
+ @Update("UPDATE group_member SET state=#{state} where topic_name=#{topicName}")
+ void updateMemberByTopic(SubscriptionEntity subscriptionEntity);
+
+
+ @Update("UPDATE group_member SET status=0 where id=#{id} ")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- Integer updateGroupMember(GroupMemberEntity groupMemberEntity);
-
- @Update("UPDATE group_member SET status=0 WHERE id=#{id} ")
- @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- Integer deleteGroupMember(GroupMemberEntity groupMemberEntity);
-
- @Update("UPDATE group_member SET state=#{state} WHERE topic_name=#{topicName}")
- Integer updateMemberByTopic(GroupMemberEntity groupMemberEntity);
+ SubscriptionEntity deleteGroupMember(SubscriptionEntity subscriptionEntity);
@Insert({
"<script>",
- " INSERT INTO group_member (cluster_id, topic_name, group_name, eventmesh_user, state) VALUES ",
+ " insert into group_member (cluster_id, topic_name, group_name, eventmesh_user, state) values ",
" <foreach collection='list' item='c' index='index' separator=','>",
"(#{c.clusterId},#{c.topicName},#{c.groupName},#{c.eventMeshUser},#{c.state})",
" </foreach>",
"</script>"})
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- Integer batchInsert(List<GroupMemberEntity> groupMemberEntities);
+ void batchInsert(List<SubscriptionEntity> groupMemberEntities);
- @Insert("INSERT INTO group_member (cluster_id, topic_name, group_name, eventmesh_user,state)"
- + " VALUE (#{clusterId},#{topicName},#{groupName},#{eventMeshUser},#{state})"
- + "ON DUPLICATE KEY UPDATE status=0")
+
+ @Insert("insert into group_member (cluster_id, topic_name, group_name, eventmesh_user,state)"
+ + " values (#{clusterId},#{topicName},#{groupName},#{eventMeshUser},#{state})"
+ + "ON DUPLICATE KEY UPDATE status=0")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- void insertGroupMember(GroupMemberEntity groupMemberEntity);
+ void addGroupMember(SubscriptionEntity subscriptionEntity);
-}
+}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/TopicMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/TopicMapper.java
index 5a98d9b..50703e7 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/TopicMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/TopicMapper.java
@@ -15,10 +15,12 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapper.message;
import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity;
+import org.apache.eventmesh.dashboard.console.mapper.SyncDataHandlerMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
@@ -33,7 +35,7 @@
* operate Topic mapper
**/
@Mapper
-public interface TopicMapper {
+public interface TopicMapper extends SyncDataHandlerMapper<TopicEntity> {
@Select("SELECT count(*) FROM topic WHERE cluster_id=#{clusterId} AND status=1")
@@ -51,38 +53,70 @@
"</script>"})
List<TopicEntity> queryTopicsToFrontByClusterId(@Param("topicEntity") TopicEntity topicEntity);
+
@Select("SELECT * FROM topic WHERE cluster_id=#{clusterId} and status = 1")
List<TopicEntity> selectTopicByCluster(TopicEntity topicEntity);
+
@Select("SELECT * FROM topic WHERE status=1")
List<TopicEntity> selectAll();
@Select("SELECT * FROM topic WHERE id=#{id}")
- TopicEntity selectTopicById(TopicEntity topicEntity);
+ TopicEntity queryTopicById(TopicEntity topicEntity);
- @Update("UPDATE topic SET type=#{type},description=#{description} WHERE id=#{id}")
- Integer updateTopic(TopicEntity topicEntity);
+
+ @Update("UPDATE topic SET topic_type=#{topicType},description=#{description} WHERE id=#{id}")
+ void updateTopic(TopicEntity topicEntity);
@Update("UPDATE topic SET create_progress=#{createProgress} WHERE id=#{id}")
- Integer updateTopicCreateProgress(TopicEntity topicEntity);
+ void updateTopicCreateProgress(TopicEntity topicEntity);
+
+ @Update("""
+ <script>
+ update `topic` set status=0 where id in(
+ <foreach collection='list' item='item' index='index' separator=','>
+ #{item.id}
+ </foreach>
+ )
+ </script>
+ """)
+ Integer deleteTopicByIds(List<TopicEntity> topicEntity);
+
@Update("UPDATE `topic` SET status=0 WHERE id=#{id}")
- Integer deleteTopic(TopicEntity topicEntity);
+ Integer deleteTopicById(TopicEntity topicEntity);
- @Insert({
- "<script>",
- "INSERT INTO topic (cluster_id, topic_name, retention_ms, type, description, create_progress) VALUES ",
- " <foreach collection='list' item='c' index='index' separator=','>",
- " (#{c.clusterId},#{c.topicName},#{c.storageId},#{c.retentionMs},#{c.type},#{c.description},#{c.createProgress})",
- " </foreach>",
- "</script>"})
+ @Insert("""
+ <script>
+ insert into topic (cluster_id, topic_name, retention_ms, topic_type, description, create_progress)
+ values
+ <foreach collection='list' item='c' index='index' separator=','>
+ (#{c.clusterId},#{c.topicName},#{c.retentionMs},#{c.topicType},#{c.description},#{c.createProgress})
+ </foreach>
+ </script>
+ """)
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void batchInsert(List<TopicEntity> topicEntities);
- @Insert("INSERT INTO topic (cluster_id, topic_name, retention_ms, type, description, create_progress) "
- + "VALUE (#{clusterId},#{topicName},#{storageId},#{retentionMs},#{type},#{description},#{createProgress})"
- + "ON DUPLICATE KEY UPDATE status = 1")
+ @Insert("""
+ insert into topic (cluster_id , topic_name , retention_ms , topic_type , description, create_progress)
+ values (#{clusterId} ,#{topicName},#{retentionMs},#{topicType},#{description},#{createProgress})
+ on duplicate key update status = 1
+ """)
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void insertTopic(TopicEntity topicEntity);
-}
+
+ @Override
+ void syncInsert(List<TopicEntity> entityList);
+
+ @Override
+ void syncUpdate(List<TopicEntity> entityList);
+
+ @Override
+ void syncDelete(List<TopicEntity> entityList);
+
+ @Override
+ List<TopicEntity> syncGet(TopicEntity topicEntity);
+
+}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/TopicOffsetMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/TopicOffsetMapper.java
new file mode 100644
index 0000000..915813e
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/TopicOffsetMapper.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.mapper.message;
+
+import org.apache.eventmesh.dashboard.console.entity.message.TopicOffsetEntity;
+import org.apache.eventmesh.dashboard.console.mapper.SyncDataHandlerMapper;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ *
+ */
+@Mapper
+public interface TopicOffsetMapper extends SyncDataHandlerMapper<TopicOffsetEntity> {
+
+
+ void syncInsert(List<TopicOffsetEntity> entityList);
+
+ void syncUpdate(List<TopicOffsetEntity> entityList);
+
+ void syncDelete(List<TopicOffsetEntity> entityList);
+
+ List<TopicOffsetEntity> syncGet(TopicOffsetEntity topicOffsetEntity);
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/storage/StoreMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/storage/StoreMapper.java
deleted file mode 100644
index 9aaa07c..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/storage/StoreMapper.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.mapper.storage;
-
-import org.apache.eventmesh.dashboard.console.entity.StoreEntity;
-
-import org.apache.ibatis.annotations.Insert;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Options;
-import org.apache.ibatis.annotations.Select;
-import org.apache.ibatis.annotations.Update;
-
-import java.util.List;
-
-/**
- * store table operation
- */
-@Mapper
-public interface StoreMapper {
-
- @Select("SELECT * FROM store WHERE status=1")
- List<StoreEntity> selectAll();
-
- @Select("SELECT * FROM store WHERE id=#{id} AND status=1")
- StoreEntity selectById(StoreEntity storeEntity);
-
- @Select("SELECT * FROM store WHERE host=#{host} AND port=#{port} AND status=1 LIMIT 1")
- StoreEntity selectByHostPort(StoreEntity storeEntity);
-
- @Select("SELECT * FROM store WHERE cluster_id=#{clusterId} AND status=1")
- StoreEntity selectStoreByCluster(StoreEntity storeEntity);
-
- @Update("UPDATE store SET status=0 WHERE cluster_id=#{clusterId} AND store_id=#{storeId}")
- Integer deleteStoreByUnique(StoreEntity storeEntity);
-
- @Update("UPDATE store SET status=#{status} WHERE cluster_id=#{clusterId} AND store_id=#{storeId}")
- Integer updateStoreByUnique(StoreEntity storeEntity);
-
- @Update("UPDATE store SET topic_list=#{topicList} WHERE cluster_id=#{clusterId}")
- Integer updateTopicListByCluster(StoreEntity storeEntity);
-
- @Insert({
- "<script>",
- "INSERT INTO store (cluster_id, store_id, store_type, host, runtime_id, topic_list, diff_type, port, jmx_port,start_timestamp, rack,",
- " status, endpoint_map) VALUES ",
- " <foreach collection='list' item='c' index='index' separator=','>",
- " (#{c.clusterId}, #{c.storeId}, #{c.storeType}, #{c.host}, #{c.runtimeId}, #{c.topicList}, #{c.diffType}, #{c.port}, #{c.jmxPort},",
- " #{c.startTimestamp}, #{c.rack}, #{c.status}, #{c.endpointMap})",
- " </foreach>",
- "</script>"})
- @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- Integer batchInsert(List<StoreEntity> storeEntities);
-
- @Insert("INSERT INTO store (cluster_id, store_id, store_type, host, runtime_id, topic_list, diff_type"
- + ", port, jmx_port, start_timestamp, rack, status, endpoint_map ) VALUES ("
- + "#{clusterId},#{storeId},#{storeType},#{host},#{runtimeId},#{topicList},#{diffType},#{port},#{jmxPort}"
- + ",#{startTimestamp},#{rack},#{status},#{endpointMap})")
- @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- void insertStore(StoreEntity storeEntity);
-
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/ClientDataControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/ClientDataControllerMapper.java
index 2de3f0b..b159488 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/ClientDataControllerMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/ClientDataControllerMapper.java
@@ -15,10 +15,8 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.mapstruct.cluster;
-import org.apache.eventmesh.dashboard.console.entity.cluster.ClientEntity;
-import org.apache.eventmesh.dashboard.console.modle.cluster.client.SelectByClusterIdDTO;
+package org.apache.eventmesh.dashboard.console.mapstruct.cluster;
import org.mapstruct.factory.Mappers;
@@ -30,6 +28,5 @@
ClientDataControllerMapper INSTANCE = Mappers.getMapper(ClientDataControllerMapper.class);
- ClientEntity selectByClusterIdDTO(SelectByClusterIdDTO selectByClusterIdDTO);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/ClusterControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/ClusterControllerMapper.java
index 08ca20c..82d5989 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/ClusterControllerMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/ClusterControllerMapper.java
@@ -15,10 +15,14 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapstruct.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
-import org.apache.eventmesh.dashboard.console.modle.cluster.CreateClusterDTO;
+import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
+import org.apache.eventmesh.dashboard.console.modle.cluster.CreateClusterBySimpleDataDTO;
+import org.apache.eventmesh.dashboard.console.modle.cluster.cluster.QueryClusterByOrganizationIdAndTypeDTO;
+import org.apache.eventmesh.dashboard.console.modle.cluster.cluster.QueryRelationClusterByClusterIdAndTypeDTO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@@ -32,6 +36,12 @@
ClusterControllerMapper INSTANCE = Mappers.getMapper(ClusterControllerMapper.class);
- ClusterEntity createCluster(CreateClusterDTO createClusterDTO);
+ ClusterEntity queryClusterByOrganizationIdAndType(QueryClusterByOrganizationIdAndTypeDTO dto);
+
+ ClusterEntity queryRelationClusterByClusterIdAndType(QueryRelationClusterByClusterIdAndTypeDTO dto);
+
+ ClusterEntity createCluster(CreateClusterBySimpleDataDTO createClusterBySimpleDataDTO);
+
+ ClusterEntity toClusterEntity(ClusterIdDTO clusterIdDTO);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/GroupControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/GroupControllerMapper.java
index 1b2eab8..402692b 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/GroupControllerMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/GroupControllerMapper.java
@@ -15,11 +15,12 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapstruct.cluster;
import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity;
-import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
import org.apache.eventmesh.dashboard.console.modle.IdDTO;
+import org.apache.eventmesh.dashboard.console.modle.vo.RuntimeIdDTO;
import org.mapstruct.factory.Mappers;
@@ -31,7 +32,7 @@
GroupControllerMapper INSTANCE = Mappers.getMapper(GroupControllerMapper.class);
- GroupEntity queryGroupListByClusterId(ClusterIdDTO clusterId);
+ GroupEntity queryGroupListByClusterId(RuntimeIdDTO runtimeIdDTO);
GroupEntity deleteGroupById(IdDTO idDTO);
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/RuntimeControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/RuntimeControllerMapper.java
index eccf850..731fb6b 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/RuntimeControllerMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/RuntimeControllerMapper.java
@@ -15,12 +15,13 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapstruct.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
import org.apache.eventmesh.dashboard.console.modle.IdDTO;
-import org.apache.eventmesh.dashboard.console.modle.cluster.runtime.CrateRuntimeDTO;
+import org.apache.eventmesh.dashboard.console.modle.cluster.runtime.CreateRuntimeDTO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@@ -38,7 +39,7 @@
RuntimeEntity queryRuntimeListById(IdDTO idDTO);
- RuntimeEntity crateRuntime(CrateRuntimeDTO crateRuntimeDTO);
+ RuntimeEntity crateRuntime(CreateRuntimeDTO crateRuntimeDTO);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/connection/ConnectionControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/connection/ConnectionControllerMapper.java
deleted file mode 100644
index a1c2264..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/connection/ConnectionControllerMapper.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.mapstruct.connection;
-
-import org.apache.eventmesh.dashboard.console.entity.CreateConnectionEntity;
-import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity;
-import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO;
-import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO;
-
-import org.mapstruct.factory.Mappers;
-
-/**
- *
- */
-public interface ConnectionControllerMapper {
-
- ConnectionControllerMapper INSTANCE = Mappers.getMapper(ConnectionControllerMapper.class);
-
- ConnectionEntity queryEntityByConnection(GetConnectionListDTO getConnectionListDTO);
-
- CreateConnectionEntity queryCreateEntityByConnection(CreateConnectionDTO createConnectionDTO);
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/log/LogControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/deploy/CaseControllerMapper.java
similarity index 66%
rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/log/LogControllerMapper.java
rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/deploy/CaseControllerMapper.java
index 03c5302..bda9601 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/log/LogControllerMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/deploy/CaseControllerMapper.java
@@ -15,24 +15,22 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.mapstruct.log;
-import org.apache.eventmesh.dashboard.console.entity.function.LogEntity;
-import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO;
+package org.apache.eventmesh.dashboard.console.mapstruct.deploy;
+import org.apache.eventmesh.dashboard.console.entity.cases.CaseEntity;
+import org.apache.eventmesh.dashboard.console.modle.deploy.cases.QueryCaseByObjectTypeDTO;
-import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
*
*/
-@Mapper
-public interface LogControllerMapper {
+public interface CaseControllerMapper {
- LogControllerMapper INSTANCE = Mappers.getMapper(LogControllerMapper.class);
+ CaseControllerMapper INSTANCE = Mappers.getMapper(CaseControllerMapper.class);
- LogEntity queryEntityByLog(GetLogListDTO getLogListDTO);
+ CaseEntity queryCaseByObjectType(QueryCaseByObjectTypeDTO queryCaseByObjectTypeDTO);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/deploy/ClusterCycleControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/deploy/ClusterCycleControllerMapper.java
new file mode 100644
index 0000000..b78bfd7
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/deploy/ClusterCycleControllerMapper.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.mapstruct.deploy;
+
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.modle.deploy.create.CreateClusterByDeployScriptDO;
+import org.apache.eventmesh.dashboard.console.modle.deploy.create.CreateClusterByEventMesh;
+import org.apache.eventmesh.dashboard.console.modle.deploy.create.CreateRuntimeByDeployScriptDTO;
+import org.apache.eventmesh.dashboard.console.modle.deploy.create.CreateRuntimeByOnlyDataDO;
+
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+/**
+ *
+ */
+@Mapper
+public interface ClusterCycleControllerMapper {
+
+ ClusterCycleControllerMapper INSTANCE = Mappers.getMapper(ClusterCycleControllerMapper.class);
+
+
+ RuntimeEntity createRuntimeByOnlyDataHandler(CreateRuntimeByOnlyDataDO createRuntimeByOnlyDataDO);
+
+
+ ClusterEntity createClusterByEventMesh(CreateClusterByEventMesh createClusterByEventMesh);
+
+
+ ClusterEntity createClusterByDeployScript(CreateClusterByDeployScriptDO createClusterByDeployScriptDO);
+
+ RuntimeEntity createRuntimeByDeployScript(CreateRuntimeByDeployScriptDTO createRuntimeByDeployScriptDTO);
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/deploy/ResourceConfigControllerMapper.java
similarity index 62%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/deploy/ResourceConfigControllerMapper.java
index 2afd16c..037806a 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/deploy/ResourceConfigControllerMapper.java
@@ -15,23 +15,22 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.mapstruct.config;
+package org.apache.eventmesh.dashboard.console.mapstruct.deploy;
-import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
-import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO;
+import org.apache.eventmesh.dashboard.console.entity.cases.ResourcesConfigEntity;
+import org.apache.eventmesh.dashboard.console.modle.deploy.resouce.QueryResourceByObjectTypeDTO;
-import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
*
*/
+public interface ResourceConfigControllerMapper {
-@Mapper
-public interface ConfigControllerMapper {
+ ResourceConfigControllerMapper INSTANCE = Mappers.getMapper(ResourceConfigControllerMapper.class);
- ConfigControllerMapper INSTANCE = Mappers.getMapper(ConfigControllerMapper.class);
- public ConfigEntity queryEntityByConfig(GetConfigsListDTO getConfigsListDTO);
+ ResourcesConfigEntity queryResourcesConfigByObjectType(QueryResourceByObjectTypeDTO queryResourceByObjectTypeDTO);
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/message/TopicControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/message/TopicControllerMapper.java
index 6f44f3b..19bfd5b 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/message/TopicControllerMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/message/TopicControllerMapper.java
@@ -15,12 +15,14 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.mapstruct.message;
import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity;
import org.apache.eventmesh.dashboard.console.modle.IdDTO;
import org.apache.eventmesh.dashboard.console.modle.dto.topic.CreateTopicDTO;
import org.apache.eventmesh.dashboard.console.modle.dto.topic.GetTopicListDTO;
+import org.apache.eventmesh.dashboard.console.modle.vo.RuntimeIdDTO;
import org.mapstruct.factory.Mappers;
@@ -34,7 +36,7 @@
TopicEntity queryTopicListByClusterId(GetTopicListDTO getTopicListDTO);
- TopicEntity queryTopicListById(IdDTO idDTO);
+ TopicEntity queryTopicListById(RuntimeIdDTO runtimeIdDTO);
TopicEntity deleteTopic(IdDTO idDTO);
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/ClusterIdDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/ClusterIdDTO.java
index d6f008a..760561d 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/ClusterIdDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/ClusterIdDTO.java
@@ -15,16 +15,21 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle;
import javax.validation.constraints.NotNull;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class ClusterIdDTO {
+@EqualsAndHashCode(callSuper = false)
+public class ClusterIdDTO extends OrganizationIdDTO {
@NotNull
private Long clusterId;
+
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/DO/QueryRuntimeByClusterIdAndClusterTypeDO.java
similarity index 71%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/DO/QueryRuntimeByClusterIdAndClusterTypeDO.java
index 291fe8c..37e179e 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/DO/QueryRuntimeByClusterIdAndClusterTypeDO.java
@@ -15,19 +15,20 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.connection;
+package org.apache.eventmesh.dashboard.console.modle.DO;
-import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import java.util.ArrayList;
import java.util.List;
import lombok.Data;
@Data
-public class AddConnectorConfigEntity {
+public class QueryRuntimeByClusterIdAndClusterTypeDO {
- private List<ConfigEntity> sinkConnectorConfigs;
+ private List<ClusterType> clusterTypeList = new ArrayList<>();
- private List<ConfigEntity> sourceConnectorConfigs;
+ private List<Long> clusterIdList = new ArrayList<>();
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsRequest.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/DO/clusterRelationship/QueryListByClusterIdAndTypeDO.java
similarity index 70%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsRequest.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/DO/clusterRelationship/QueryListByClusterIdAndTypeDO.java
index d9920d8..794861e 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsRequest.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/DO/clusterRelationship/QueryListByClusterIdAndTypeDO.java
@@ -15,20 +15,27 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting.topic;
+package org.apache.eventmesh.dashboard.console.modle.DO.clusterRelationship;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+
+import java.util.List;
import lombok.AllArgsConstructor;
+import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
+@Builder
@NoArgsConstructor
@AllArgsConstructor
-public class GetTopicsRequest extends GlobalRequest {
+public class QueryListByClusterIdAndTypeDO {
- private String runtimeHost;
+ private Long clusterId;
- private Integer runtimePort;
+ private List<ClusterType> clusterTypeList;
+
+ private List<ClusterType> relationshipTypeList;
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/DO/runtime/QueryRuntimeByBigExpandClusterDO.java
similarity index 65%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/DO/runtime/QueryRuntimeByBigExpandClusterDO.java
index 291fe8c..6104ffb 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/DO/runtime/QueryRuntimeByBigExpandClusterDO.java
@@ -15,19 +15,28 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.connection;
+package org.apache.eventmesh.dashboard.console.modle.DO.runtime;
-import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
import java.util.List;
+import lombok.Builder;
import lombok.Data;
@Data
-public class AddConnectorConfigEntity {
+@Builder
+public class QueryRuntimeByBigExpandClusterDO {
- private List<ConfigEntity> sinkConnectorConfigs;
+ private Long followClusterId;
- private List<ConfigEntity> sourceConnectorConfigs;
+ private ClusterType mainClusterType;
+
+ private List<ClusterType> storageClusterTypeList;
+
+ private List<ClusterType> storageMetaClusterTypeList;
+
+
+ private List<ClusterType> queryClusterTypeList;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/IdDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/IdDTO.java
index adc3699..a6e3808 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/IdDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/IdDTO.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle;
import lombok.Data;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/OperateDTO.java
similarity index 66%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/OperateDTO.java
index bf167b1..77d86fc 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/OperateDTO.java
@@ -15,16 +15,25 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+
+package org.apache.eventmesh.dashboard.console.modle;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.OperationRange.OperationRangeType;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+/**
+ *
+ */
@Data
-public class ChangeConfigEntity {
+@EqualsAndHashCode(callSuper = true)
+public class OperateDTO extends IdDTO {
- private String configName;
- private String configValue;
+ private OperationRangeType operationRangeType;
- private Integer alreadyUpdate;
+ private ClusterType clusterType;
+
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/OrganizationIdDTO.java
similarity index 86%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/OrganizationIdDTO.java
index 82e6c7f..7d03e62 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/OrganizationIdDTO.java
@@ -15,12 +15,13 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
+
+package org.apache.eventmesh.dashboard.console.modle;
import lombok.Data;
@Data
-public class GlobalRequest {
+public class OrganizationIdDTO {
- private Long clusterId;
+ private String organizationId;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/ClusterHomeListVO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/ClusterHomeListVO.java
index 3eaa45b..e3fccc1 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/ClusterHomeListVO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/ClusterHomeListVO.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterByCompleteDataDTO.java
similarity index 66%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterByCompleteDataDTO.java
index 344d02d..8ee206c 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterByCompleteDataDTO.java
@@ -15,28 +15,26 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.message;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+package org.apache.eventmesh.dashboard.console.modle.cluster;
+
+import org.apache.eventmesh.dashboard.common.enums.ReplicationType;
import lombok.Data;
import lombok.EqualsAndHashCode;
+@EqualsAndHashCode(callSuper = true)
@Data
-@EqualsAndHashCode(callSuper = true, exclude = "status")
-public class GroupMemberEntity extends BaseEntity {
+public class CreateClusterByCompleteDataDTO extends CreateClusterBySimpleDataDTO {
- private Long id;
- private Long clusterId;
+ private Long k8sClusterId;
- private String topicName;
+ private Long deployScriptId;
- private String groupName;
+ private Long resourcesId;
- private String eventMeshUser;
+ private Long createNum;
- private String state;
-
- private Integer status;
+ private ReplicationType replicationType;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterBySimpleDataDTO.java
similarity index 82%
rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java
rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterBySimpleDataDTO.java
index 2102c5c..66b9b1c 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterBySimpleDataDTO.java
@@ -15,36 +15,38 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.cluster;
import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
import org.apache.eventmesh.dashboard.common.enums.ClusterType;
-import javax.validation.constraints.NotNull;
-
import lombok.Data;
+/**
+ *
+ */
@Data
-public class CreateClusterDTO {
+public class CreateClusterBySimpleDataDTO {
- @NotNull
private String name;
- @NotNull
+ private Long currentClusterId;
+
+ private Long configGatherId;
+
private ClusterTrusteeshipType trusteeshipType;
- @NotNull
private ClusterType clusterType;
- @NotNull
private String version;
+ private String jmxProperties;
- private String jmxProperties = "";
+ private String description;
- private String description = "";
+ private Integer authType;
-
- private Integer authType = 0;
+ private Integer runState;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/VerifyNameDTO.java
similarity index 75%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/VerifyNameDTO.java
index bf167b1..2f4a4bc 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/VerifyNameDTO.java
@@ -15,16 +15,20 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+
+package org.apache.eventmesh.dashboard.console.modle.cluster;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
import lombok.Data;
@Data
-public class ChangeConfigEntity {
+public class VerifyNameDTO {
- private String configName;
- private String configValue;
+ private Integer organizationId;
- private Integer alreadyUpdate;
+ private ClusterType clusterType;
+
+ private String clusterName;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/QueryClientByUserFormDTO.java
similarity index 85%
rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java
rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/QueryClientByUserFormDTO.java
index 268aeac..401feaa 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/QueryClientByUserFormDTO.java
@@ -15,11 +15,17 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.cluster.client;
import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
-public class SelectByClusterIdDTO extends ClusterIdDTO {
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class QueryClientByUserFormDTO extends ClusterIdDTO {
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingServiceType.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/cluster/ClusterDetailsVO.java
similarity index 87%
copy from eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingServiceType.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/cluster/ClusterDetailsVO.java
index 2da47e6..003bab7 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingServiceType.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/cluster/ClusterDetailsVO.java
@@ -15,9 +15,12 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.service.remoting;
-public enum RemotingServiceType {
+package org.apache.eventmesh.dashboard.console.modle.cluster.cluster;
+
+public class ClusterDetailsVO {
+
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/cluster/QueryClusterByOrganizationIdAndTypeDTO.java
similarity index 69%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/cluster/QueryClusterByOrganizationIdAndTypeDTO.java
index 2102c5c..31c34c4 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/cluster/QueryClusterByOrganizationIdAndTypeDTO.java
@@ -15,36 +15,23 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.cluster;
-import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+package org.apache.eventmesh.dashboard.console.modle.cluster.cluster;
+
import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
import javax.validation.constraints.NotNull;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class CreateClusterDTO {
-
- @NotNull
- private String name;
-
- @NotNull
- private ClusterTrusteeshipType trusteeshipType;
+@EqualsAndHashCode(callSuper = true)
+public class QueryClusterByOrganizationIdAndTypeDTO extends ClusterIdDTO {
@NotNull
private ClusterType clusterType;
- @NotNull
- private String version;
-
-
- private String jmxProperties = "";
-
- private String description = "";
-
-
- private Integer authType = 0;
-
+ private String clusterName;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/cluster/QueryRelationClusterByClusterIdAndTypeDTO.java
similarity index 71%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/cluster/QueryRelationClusterByClusterIdAndTypeDTO.java
index 268aeac..345f0b5 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/cluster/QueryRelationClusterByClusterIdAndTypeDTO.java
@@ -15,11 +15,19 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.cluster.client;
+package org.apache.eventmesh.dashboard.console.modle.cluster.cluster;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
-public class SelectByClusterIdDTO extends ClusterIdDTO {
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class QueryRelationClusterByClusterIdAndTypeDTO extends ClusterIdDTO {
+
+
+ private ClusterType clusterType;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/CrateRuntimeDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/CreateRuntimeDTO.java
similarity index 75%
rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/CrateRuntimeDTO.java
rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/CreateRuntimeDTO.java
index c08eeb7..a027cd7 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/CrateRuntimeDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/CreateRuntimeDTO.java
@@ -15,16 +15,21 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.cluster.runtime;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType.FirstToWhom;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
import java.time.LocalDateTime;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class CrateRuntimeDTO extends ClusterIdDTO {
+@EqualsAndHashCode(callSuper = true)
+public class CreateRuntimeDTO extends ClusterIdDTO {
private String name;
@@ -39,4 +44,8 @@
private String rack = "";
private String endpointMap;
+
+ private FirstToWhom firstToWhom = FirstToWhom.DASHBOARD;
+
+ private ClusterType trusteeshipArrangeType = ClusterType.RUNTIME;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/QueryRuntimeListByClusterIdDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/QueryRuntimeListByClusterIdDTO.java
index 5cccc89..b53e4ca 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/QueryRuntimeListByClusterIdDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/QueryRuntimeListByClusterIdDTO.java
@@ -15,13 +15,17 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.cluster.runtime;
import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+
@Data
+@EqualsAndHashCode(callSuper = true)
public class QueryRuntimeListByClusterIdDTO extends ClusterIdDTO {
private String host;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtimeCycle/CreateRuntimeDTO.java
similarity index 77%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtimeCycle/CreateRuntimeDTO.java
index 268aeac..ee981f7 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtimeCycle/CreateRuntimeDTO.java
@@ -15,11 +15,18 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.cluster.client;
+package org.apache.eventmesh.dashboard.console.modle.cluster.runtimeCycle;
import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
-public class SelectByClusterIdDTO extends ClusterIdDTO {
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CreateRuntimeDTO extends ClusterIdDTO {
+
+ private int runtimeNum;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/BaseConifgDO.java
similarity index 80%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/BaseConifgDO.java
index 291fe8c..5585972 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/BaseConifgDO.java
@@ -15,7 +15,8 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.connection;
+
+package org.apache.eventmesh.dashboard.console.modle.deploy;
import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
@@ -24,10 +25,12 @@
import lombok.Data;
@Data
-public class AddConnectorConfigEntity {
+public class BaseConifgDO {
- private List<ConfigEntity> sinkConnectorConfigs;
- private List<ConfigEntity> sourceConnectorConfigs;
+ private List<ConfigEntity> configList;
+
+
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/BaseDeployDO.java
similarity index 71%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/BaseDeployDO.java
index 291fe8c..009a282 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/BaseDeployDO.java
@@ -15,19 +15,24 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.connection;
-import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
+package org.apache.eventmesh.dashboard.console.modle.deploy;
+
+import org.apache.eventmesh.dashboard.console.entity.cases.ResouceEntity;
import java.util.List;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class AddConnectorConfigEntity {
+@EqualsAndHashCode(callSuper = true)
+public class BaseDeployDO extends BaseConifgDO {
- private List<ConfigEntity> sinkConnectorConfigs;
- private List<ConfigEntity> sourceConnectorConfigs;
+ private List<DeployTopicDO> topicList;
+
+ private ResouceEntity resource;
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/ClusterAllMetadataDO.java
similarity index 62%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/ClusterAllMetadataDO.java
index 291fe8c..5e8573e 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/ClusterAllMetadataDO.java
@@ -15,19 +15,24 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.connection;
-import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
+package org.apache.eventmesh.dashboard.console.modle.deploy;
+
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
import java.util.List;
import lombok.Data;
@Data
-public class AddConnectorConfigEntity {
+public class ClusterAllMetadataDO {
- private List<ConfigEntity> sinkConnectorConfigs;
+ private List<ClusterEntity> clusterEntityList;
- private List<ConfigEntity> sourceConnectorConfigs;
+ private List<RuntimeEntity> runtimeEntityList;
+
+ private List<ClusterRelationshipEntity> clusterRelationshipEntityList;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployClusterDO.java
similarity index 70%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployClusterDO.java
index 291fe8c..a93eccf 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployClusterDO.java
@@ -15,19 +15,23 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.connection;
-import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
+package org.apache.eventmesh.dashboard.console.modle.deploy;
+
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
import java.util.List;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class AddConnectorConfigEntity {
+@EqualsAndHashCode(callSuper = true)
+public class DeployClusterDO extends BaseDeployDO {
- private List<ConfigEntity> sinkConnectorConfigs;
+ private ClusterEntity cluster;
- private List<ConfigEntity> sourceConnectorConfigs;
+ private List<DeployRuntimeDO> deployRuntimeDOList;
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployFullDO.java
similarity index 72%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployFullDO.java
index 291fe8c..b94ba0d 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployFullDO.java
@@ -15,19 +15,22 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.connection;
-import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
+package org.apache.eventmesh.dashboard.console.modle.deploy;
+
+import org.apache.eventmesh.dashboard.console.entity.cases.DeployScriptEntity;
import java.util.List;
import lombok.Data;
@Data
-public class AddConnectorConfigEntity {
+public class DeployFullDO {
- private List<ConfigEntity> sinkConnectorConfigs;
+ private List<DeployClusterDO> deployClusterDOList;
- private List<ConfigEntity> sourceConnectorConfigs;
+ private List<Object> kubernetesList;
+
+ private List<DeployScriptEntity> deployScriptEntityList;
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployGroupDO.java
similarity index 81%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployGroupDO.java
index 82e6c7f..4f0cec4 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployGroupDO.java
@@ -15,12 +15,15 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
+
+package org.apache.eventmesh.dashboard.console.modle.deploy;
+
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class GlobalRequest {
+@EqualsAndHashCode(callSuper = true)
+public class DeployGroupDO extends BaseConifgDO {
- private Long clusterId;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployMetadataDO.java
similarity index 71%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployMetadataDO.java
index 291fe8c..b62784c 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployMetadataDO.java
@@ -15,19 +15,24 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.connection;
-import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
+package org.apache.eventmesh.dashboard.console.modle.deploy;
+
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity;
import java.util.List;
import lombok.Data;
+
@Data
-public class AddConnectorConfigEntity {
+public class DeployMetadataDO {
- private List<ConfigEntity> sinkConnectorConfigs;
- private List<ConfigEntity> sourceConnectorConfigs;
+ private List<DeployClusterDO> deployClusterDOList;
+
+ private List<ClusterRelationshipEntity> relationshipList;
+
+ private List<Object> kubernetesList;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployRuntimeDO.java
similarity index 77%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployRuntimeDO.java
index bf167b1..444c2d9 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployRuntimeDO.java
@@ -15,16 +15,16 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.console.modle.deploy;
-@Data
-public class ChangeConfigEntity {
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
- private String configName;
+public class DeployRuntimeDO extends BaseDeployDO {
- private String configValue;
+ private RuntimeEntity runtime;
- private Integer alreadyUpdate;
+
+
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployTopicDO.java
similarity index 74%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployTopicDO.java
index 6dafeef..e0f8f09 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/DeployTopicDO.java
@@ -15,20 +15,19 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+package org.apache.eventmesh.dashboard.console.modle.deploy;
+
+import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class UpdateConfigsLog {
+@EqualsAndHashCode(callSuper = true)
+public class DeployTopicDO extends BaseConifgDO {
- private Long instanceId;
+ private TopicEntity topic;
- private Long clusterId;
-
- private String name;
-
- private String configProperties;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/GetPortsDO.java
similarity index 75%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/GetPortsDO.java
index 268aeac..fb1af80 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/GetPortsDO.java
@@ -15,11 +15,19 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.cluster.client;
+package org.apache.eventmesh.dashboard.console.modle.deploy;
import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
-public class SelectByClusterIdDTO extends ClusterIdDTO {
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class GetPortsDO extends ClusterIdDTO {
+
+ private Integer portNum;
+
+ private String kubernetesPortModel;
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/cases/QueryCaseByObjectTypeDTO.java
similarity index 82%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/cases/QueryCaseByObjectTypeDTO.java
index 82e6c7f..b888590 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/cases/QueryCaseByObjectTypeDTO.java
@@ -15,12 +15,16 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
+
+package org.apache.eventmesh.dashboard.console.modle.deploy.cases;
import lombok.Data;
@Data
-public class GlobalRequest {
+public class QueryCaseByObjectTypeDTO {
- private Long clusterId;
+
+ private String objectType;
+
+ private String objectId;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateClusterByDeployScriptDO.java
similarity index 67%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateClusterByDeployScriptDO.java
index 2102c5c..3235e3f 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateClusterByDeployScriptDO.java
@@ -15,36 +15,39 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.cluster;
-import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+package org.apache.eventmesh.dashboard.console.modle.deploy.create;
+
import org.apache.eventmesh.dashboard.common.enums.ClusterType;
-import javax.validation.constraints.NotNull;
-
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class CreateClusterDTO {
+@EqualsAndHashCode(callSuper = true)
+public class CreateClusterByDeployScriptDO extends CreateRuntimeByDeployScriptDO {
- @NotNull
+
private String name;
- @NotNull
- private ClusterTrusteeshipType trusteeshipType;
+ private Long configGatherId;
- @NotNull
private ClusterType clusterType;
- @NotNull
private String version;
+ private String jmxProperties;
- private String jmxProperties = "";
+ private String description;
- private String description = "";
+ private Integer authType;
+ private Integer runState;
- private Integer authType = 0;
+ private Long k8sClusterId;
+
+ private Long deployScriptId;
+
+ private Long resourcesConfigId;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateClusterByEventMesh.java
similarity index 68%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateClusterByEventMesh.java
index 6dafeef..cf891f3 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateClusterByEventMesh.java
@@ -15,20 +15,27 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+package org.apache.eventmesh.dashboard.console.modle.deploy.create;
+
+import org.apache.eventmesh.dashboard.console.modle.OrganizationIdDTO;
+
+import javax.validation.constraints.NotNull;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class UpdateConfigsLog {
+@EqualsAndHashCode(callSuper = true)
+public class CreateClusterByEventMesh extends OrganizationIdDTO {
- private Long instanceId;
-
- private Long clusterId;
-
+ @NotNull
private String name;
- private String configProperties;
+
+ @NotNull
+ private String description;
+
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateEventMeshClusterByOnlyScript.java
similarity index 68%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateEventMeshClusterByOnlyScript.java
index 6dafeef..0b7e65b 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateEventMeshClusterByOnlyScript.java
@@ -15,20 +15,25 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+package org.apache.eventmesh.dashboard.console.modle.deploy.create;
+import org.apache.eventmesh.dashboard.console.modle.OrganizationIdDTO;
+
+import javax.validation.constraints.NotNull;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+
@Data
-public class UpdateConfigsLog {
+@EqualsAndHashCode(callSuper = true)
+public class CreateEventMeshClusterByOnlyScript extends OrganizationIdDTO {
- private Long instanceId;
- private Long clusterId;
-
+ @NotNull
private String name;
- private String configProperties;
+ @NotNull
+ private String description;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/CrateRuntimeDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateRuntimeByDeployScriptDO.java
similarity index 68%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/CrateRuntimeDTO.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateRuntimeByDeployScriptDO.java
index c08eeb7..94ac526 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/CrateRuntimeDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateRuntimeByDeployScriptDO.java
@@ -15,28 +15,25 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.cluster.runtime;
+package org.apache.eventmesh.dashboard.console.modle.deploy.create;
+
+import org.apache.eventmesh.dashboard.common.enums.ReplicationType;
import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
-import java.time.LocalDateTime;
-
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class CrateRuntimeDTO extends ClusterIdDTO {
+@EqualsAndHashCode(callSuper = true)
+public class CreateRuntimeByDeployScriptDO extends ClusterIdDTO {
- private String name;
- private String host;
+ private Long deployScriptId;
- private Integer port;
+ private Long resourcesConfigId;
- private Integer jmxPort;
+ private Integer createNum;
- private LocalDateTime startTimestamp = LocalDateTime.now();
-
- private String rack = "";
-
- private String endpointMap;
+ private ReplicationType replicationType;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/CrateRuntimeDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateRuntimeByDeployScriptDTO.java
similarity index 69%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/CrateRuntimeDTO.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateRuntimeByDeployScriptDTO.java
index c08eeb7..73a556e 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/CrateRuntimeDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateRuntimeByDeployScriptDTO.java
@@ -15,28 +15,22 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.cluster.runtime;
+package org.apache.eventmesh.dashboard.console.modle.deploy.create;
+import org.apache.eventmesh.dashboard.common.enums.ReplicationType;
import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
-import java.time.LocalDateTime;
-
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class CrateRuntimeDTO extends ClusterIdDTO {
+@EqualsAndHashCode(callSuper = true)
+public class CreateRuntimeByDeployScriptDTO extends ClusterIdDTO {
- private String name;
- private String host;
+ private Long deployScriptId;
- private Integer port;
+ private Long resourcesConfigId;
- private Integer jmxPort;
-
- private LocalDateTime startTimestamp = LocalDateTime.now();
-
- private String rack = "";
-
- private String endpointMap;
+ private ReplicationType replicationType;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateRuntimeByOnlyDataDO.java
similarity index 60%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateRuntimeByOnlyDataDO.java
index 2102c5c..4bc8927 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/create/CreateRuntimeByOnlyDataDO.java
@@ -15,36 +15,43 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.cluster;
+
+package org.apache.eventmesh.dashboard.console.modle.deploy.create;
import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
-import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType.FirstToWhom;
+import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
import javax.validation.constraints.NotNull;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+
@Data
-public class CreateClusterDTO {
+@EqualsAndHashCode(callSuper = true)
+public class CreateRuntimeByOnlyDataDO extends ClusterIdDTO {
@NotNull
private String name;
@NotNull
+ private String host;
+
+ /**
+ * 添加的时候只需要 host 与 post eventmesh runtime 是 admin port。通过 runtime admin 获得所有的配置。 meta 需要 host 与 post store host 与 post jmxPort
+ */
+ @NotNull
+ private Integer port;
+
+ private Integer jmxPort;
+
+ private Integer adminPort;
+
+ @NotNull
private ClusterTrusteeshipType trusteeshipType;
@NotNull
- private ClusterType clusterType;
-
- @NotNull
- private String version;
-
-
- private String jmxProperties = "";
-
- private String description = "";
-
-
- private Integer authType = 0;
+ private FirstToWhom firstToWhom;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/resouce/QueryResourceByObjectTypeDTO.java
similarity index 72%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/resouce/QueryResourceByObjectTypeDTO.java
index bf167b1..292a4a2 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/deploy/resouce/QueryResourceByObjectTypeDTO.java
@@ -15,16 +15,17 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+
+package org.apache.eventmesh.dashboard.console.modle.deploy.resouce;
+
+import org.apache.eventmesh.dashboard.console.modle.deploy.cases.QueryCaseByObjectTypeDTO;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class ChangeConfigEntity {
+@EqualsAndHashCode(callSuper = true)
+public class QueryResourceByObjectTypeDTO extends QueryCaseByObjectTypeDTO {
- private String configName;
- private String configValue;
-
- private Integer alreadyUpdate;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/domain/ClusterEntityDO.java
similarity index 70%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/domain/ClusterEntityDO.java
index 291fe8c..2fa04eb 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/domain/ClusterEntityDO.java
@@ -15,19 +15,19 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.connection;
+package org.apache.eventmesh.dashboard.console.modle.domain;
+
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
-
-import java.util.List;
+import org.apache.eventmesh.dashboard.core.cluster.ClusterBaseDO;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class AddConnectorConfigEntity {
+@EqualsAndHashCode(callSuper = true)
+public class ClusterEntityDO extends ClusterBaseDO<ClusterEntity, RuntimeEntityDO, Object, ConfigEntity> {
- private List<ConfigEntity> sinkConnectorConfigs;
-
- private List<ConfigEntity> sourceConnectorConfigs;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/domain/RuntimeEntityDO.java
similarity index 71%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/domain/RuntimeEntityDO.java
index 291fe8c..1046a9d 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/domain/RuntimeEntityDO.java
@@ -15,19 +15,20 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.connection;
+package org.apache.eventmesh.dashboard.console.modle.domain;
+
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
-
-import java.util.List;
+import org.apache.eventmesh.dashboard.core.cluster.RuntimeBaseDO;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+
@Data
-public class AddConnectorConfigEntity {
+@EqualsAndHashCode(callSuper = true)
+public class RuntimeEntityDO extends RuntimeBaseDO<RuntimeEntity, Object, ConfigEntity> {
- private List<ConfigEntity> sinkConnectorConfigs;
-
- private List<ConfigEntity> sourceConnectorConfigs;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/ChangeConfigDTO.java
similarity index 81%
rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/ChangeConfigDTO.java
index bf167b1..1aa3046 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/ChangeConfigDTO.java
@@ -15,12 +15,17 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+package org.apache.eventmesh.dashboard.console.modle.dto.config;
+
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor
+@AllArgsConstructor
@Data
-public class ChangeConfigEntity {
+public class ChangeConfigDTO {
private String configName;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/DetailConfigsVO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/DetailConfigsVO.java
index 1796fa5..10e05e9 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/DetailConfigsVO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/DetailConfigsVO.java
@@ -15,10 +15,15 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.dto.config;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor
+@AllArgsConstructor
@Data
public class DetailConfigsVO {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/GetConfigsListDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/GetConfigsListDTO.java
index e1420a2..93b0c79 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/GetConfigsListDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/GetConfigsListDTO.java
@@ -15,10 +15,15 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.dto.config;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor
+@AllArgsConstructor
@Data
public class GetConfigsListDTO {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigDTO.java
index 69232c0..ff07318 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigDTO.java
@@ -15,24 +15,19 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.dto.config;
-import org.apache.eventmesh.dashboard.console.modle.config.ChangeConfigEntity;
-
-import java.util.List;
+import org.apache.eventmesh.dashboard.console.modle.dto.operation.OperationBaseDTO;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+
@Data
-public class UpdateConfigDTO {
+@EqualsAndHashCode(callSuper = true)
+public class UpdateConfigDTO extends OperationBaseDTO {
- private Long clusterId;
- private List<ChangeConfigEntity> changeConfigEntities;
-
- private String username;
-
- private Integer instanceType;
-
- private Long instanceId;
+ private String configValue;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigsLog.java
similarity index 85%
rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigsLog.java
index 6dafeef..1a5e3a4 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigsLog.java
@@ -15,11 +15,16 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+
+package org.apache.eventmesh.dashboard.console.modle.dto.config;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor
+@AllArgsConstructor
@Data
public class UpdateConfigsLog {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectionEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectionDTO.java
similarity index 85%
rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectionEntity.java
rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectionDTO.java
index 917462a..9c33dc9 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectionEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectionDTO.java
@@ -15,12 +15,17 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.connection;
+package org.apache.eventmesh.dashboard.console.modle.dto.connection;
+
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor
+@AllArgsConstructor
@Data
-public class AddConnectionEntity {
+public class AddConnectionDTO {
private String sinkName;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java
similarity index 82%
rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java
index 291fe8c..a6d00b4 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java
@@ -15,16 +15,21 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.connection;
+
+package org.apache.eventmesh.dashboard.console.modle.dto.connection;
import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
import java.util.List;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor
+@AllArgsConstructor
@Data
-public class AddConnectorConfigEntity {
+public class AddConnectorConfigDTO {
private List<ConfigEntity> sinkConnectorConfigs;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java
index f204296..e7ee5e4 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java
@@ -15,19 +15,21 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.dto.connection;
-import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectionEntity;
-import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectorConfigEntity;
-
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor
+@AllArgsConstructor
@Data
public class CreateConnectionDTO {
private Long clusterId;
- private AddConnectionEntity addConnectionEntity;
+ private AddConnectionDTO addConnectionDTO;
- private AddConnectorConfigEntity addConnectorConfigEntity;
+ private AddConnectorConfigDTO addConnectorConfigDTO;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/GetConnectionListDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/GetConnectionListDTO.java
index ea5936d..d6e0e31 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/GetConnectionListDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/GetConnectionListDTO.java
@@ -15,10 +15,15 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.dto.connection;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor
+@AllArgsConstructor
@Data
public class GetConnectionListDTO {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/log/GetLogListDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/log/GetLogListDTO.java
index cd086ba..bde8f81 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/log/GetLogListDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/log/GetLogListDTO.java
@@ -15,10 +15,15 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.dto.log;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor
+@AllArgsConstructor
@Data
public class GetLogListDTO {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/meta/NewMetaDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/meta/NewMetaDTO.java
index ff0888c..4430705 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/meta/NewMetaDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/meta/NewMetaDTO.java
@@ -15,10 +15,15 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.dto.meta;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor
+@AllArgsConstructor
@Data
public class NewMetaDTO {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/operation/OperationBaseDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/operation/OperationBaseDTO.java
new file mode 100644
index 0000000..0c084a5
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/operation/OperationBaseDTO.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.modle.dto.operation;
+
+import org.apache.eventmesh.dashboard.common.enums.MetadataType;
+import org.apache.eventmesh.dashboard.common.enums.OperationRange.OperationRangeType;
+import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 问题:数据关系。批量修改行为如何处理 比如:修改 runtime 的配置。用户行为如何。 具体数据由子类决定。 视图称提供多维度数据视图与操作 1. 添加 2. 删除 3. 修改 4. queue
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class OperationBaseDTO extends ClusterIdDTO {
+
+ private MetadataType rangeType;
+
+
+ /**
+ * 页面传递
+ */
+ private OperationRangeType operationRangeType;
+
+ /**
+ * 页面传递
+ */
+ private Long operationRangeId;
+
+ /**
+ * 操作目标 id , 修噶配置,重置offset,拷贝 metadata
+ */
+ private Long operationDataTypeId;
+
+ private Long operationDataId;
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/CreateTopicDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/CreateTopicDTO.java
index 15d9c8b..a6e3cb6 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/CreateTopicDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/CreateTopicDTO.java
@@ -15,19 +15,22 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.dto.topic;
+import org.apache.eventmesh.dashboard.console.modle.dto.operation.OperationBaseDTO;
+
import lombok.Data;
+import lombok.EqualsAndHashCode;
/**
* TODO this class is copied from storage plugin, needs update
*/
@Data
-public class CreateTopicDTO {
-
- private Long clusterId;
+@EqualsAndHashCode(callSuper = true)
+public class CreateTopicDTO extends OperationBaseDTO {
private String name;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/GetTopicListDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/GetTopicListDTO.java
index b365278..88f25db 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/GetTopicListDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/GetTopicListDTO.java
@@ -15,15 +15,16 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.dto.topic;
+import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
+
import lombok.Data;
@Data
-public class GetTopicListDTO {
-
- private Long clusterId;
+public class GetTopicListDTO extends ClusterIdDTO {
private String topicName;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/function/OverviewDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/function/OverviewDTO.java
index 1edd8df..d6b4980 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/function/OverviewDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/function/OverviewDTO.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.function;
import org.apache.eventmesh.dashboard.console.modle.IdDTO;
@@ -22,8 +23,10 @@
import javax.validation.constraints.NotNull;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
+@EqualsAndHashCode(callSuper = true)
public class OverviewDTO extends IdDTO {
@NotNull
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/function/OverviewType.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/function/OverviewType.java
index 3317244..7e10c85 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/function/OverviewType.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/function/OverviewType.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.function;
public enum OverviewType {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/QueryOffsetByMessageMetadataDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/QueryOffsetByMessageMetadataDTO.java
index 3e59a03..c9ac5bd 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/QueryOffsetByMessageMetadataDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/QueryOffsetByMessageMetadataDTO.java
@@ -15,14 +15,17 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.message.offset;
import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
+@EqualsAndHashCode(callSuper = true)
public class QueryOffsetByMessageMetadataDTO extends ClusterIdDTO {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/ResetOffsetDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/ResetOffsetDTO.java
index ca3b9d8..eb559a7 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/ResetOffsetDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/ResetOffsetDTO.java
@@ -16,24 +16,35 @@
*/
+
package org.apache.eventmesh.dashboard.console.modle.message.offset;
+import org.apache.eventmesh.dashboard.common.enums.OperationRange.OperationRangeType;
import org.apache.eventmesh.dashboard.common.enums.ResetOffsetMode;
import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
+import java.time.LocalDateTime;
+
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
+@EqualsAndHashCode(callSuper = true)
public class ResetOffsetDTO extends ClusterIdDTO {
- private Long groupId;
+ private OperationRangeType operationRangeType;
- private String groupName;
+ private Long rangeId;
- private Integer partitionId;
+ private Long subscribeId;
+
+ private Integer queueIndex;
private ResetOffsetMode resetOffsetMode;
- private String modeValue;
+ /**
+ *
+ */
+ private LocalDateTime resetTime;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/RuntimeIdDTO.java
similarity index 78%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/RuntimeIdDTO.java
index 268aeac..62fccd8 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/RuntimeIdDTO.java
@@ -15,11 +15,18 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.cluster.client;
+package org.apache.eventmesh.dashboard.console.modle.vo;
import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
-public class SelectByClusterIdDTO extends ClusterIdDTO {
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class RuntimeIdDTO extends ClusterIdDTO {
+
+ private Long runtimeId;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/GetClusterBaseMessageVO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/GetClusterBaseMessageVO.java
index fde7d2e..8652652 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/GetClusterBaseMessageVO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/GetClusterBaseMessageVO.java
@@ -15,10 +15,15 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.vo.cluster;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor
+@AllArgsConstructor
@Data
public class GetClusterBaseMessageVO {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/ResourceNumVO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/ResourceNumVO.java
index 95deb96..a7dab34 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/ResourceNumVO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/ResourceNumVO.java
@@ -15,10 +15,15 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.vo.cluster;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor
+@AllArgsConstructor
@Data
public class ResourceNumVO {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/connection/ConnectionListVO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/connection/ConnectionListVO.java
index 61846b9..495b338 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/connection/ConnectionListVO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/connection/ConnectionListVO.java
@@ -15,11 +15,16 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.vo.connection;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
@Data
+@AllArgsConstructor
+@NoArgsConstructor
public class ConnectionListVO {
private Long sinkConnectorId;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/health/InstanceLiveProportionVo.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/health/InstanceLiveProportionVo.java
index 9abd0d2..d11bd9e 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/health/InstanceLiveProportionVo.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/health/InstanceLiveProportionVo.java
@@ -15,10 +15,15 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.vo.health;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor
+@AllArgsConstructor
@Data
public class InstanceLiveProportionVo {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/topic/TopicDetailGroupVO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/topic/TopicDetailGroupVO.java
index 10581e5..d6f2a6d 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/topic/TopicDetailGroupVO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/topic/TopicDetailGroupVO.java
@@ -15,12 +15,17 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.modle.vo.topic;
import java.util.List;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor
+@AllArgsConstructor
@Data
public class TopicDetailGroupVO {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/DataServiceWrapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/DataServiceWrapper.java
deleted file mode 100644
index a687b3b..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/DataServiceWrapper.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.service;
-
-
-import org.apache.eventmesh.dashboard.console.service.cluster.ClientDataService;
-import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
-import org.apache.eventmesh.dashboard.console.service.cluster.ConnectionDataService;
-import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService;
-import org.apache.eventmesh.dashboard.console.service.connector.ConnectorDataService;
-import org.apache.eventmesh.dashboard.console.service.function.ConfigService;
-import org.apache.eventmesh.dashboard.console.service.function.HealthDataService;
-import org.apache.eventmesh.dashboard.console.service.message.GroupMemberService;
-import org.apache.eventmesh.dashboard.console.service.message.GroupService;
-import org.apache.eventmesh.dashboard.console.service.message.TopicService;
-import org.apache.eventmesh.dashboard.console.service.store.StoreService;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import lombok.Getter;
-
-/**
- * DataServiceWrapper is a wrapper class for all data services. It is used to inject all data services in spring environment.
- */
-@Component
-@Getter
-public class DataServiceWrapper {
-
- @Autowired
- private ClientDataService clientDataService;
-
- @Autowired
- private ClusterService clusterDataService;
-
- @Autowired
- private ConfigService configDataService;
-
- @Autowired
- private ConnectionDataService connectionDataService;
-
- @Autowired
- private ConnectorDataService connectorDataService;
-
- @Autowired
- private GroupService groupDataService;
-
- @Autowired
- private GroupMemberService groupMemberDataService;
-
- @Autowired
- private HealthDataService healthDataService;
-
- @Autowired
- private RuntimeService runtimeDataService;
-
- @Autowired
- private StoreService storeDataService;
-
- @Autowired
- private TopicService topicDataService;
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/OverviewService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/OverviewService.java
index cf919fd..6516540 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/OverviewService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/OverviewService.java
@@ -15,9 +15,10 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service;
-import org.apache.eventmesh.dashboard.console.modle.function.OverviewType;
+import org.apache.eventmesh.dashboard.console.modle.function.OverviewDTO;
/**
*
@@ -25,5 +26,5 @@
public interface OverviewService {
- Object overview(OverviewType overviewType);
+ Object overview(OverviewDTO overviewDTO);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/AclService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/AclService.java
index 8702d75..3504e74 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/AclService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/AclService.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.AclEntity;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClientDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClientDataService.java
index eb55545..bb8b753 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClientDataService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClientDataService.java
@@ -15,9 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.ClientEntity;
+import org.apache.eventmesh.dashboard.console.modle.cluster.client.QueryClientByUserFormDTO;
import java.util.List;
@@ -26,15 +28,9 @@
*/
public interface ClientDataService {
- Integer deActive(ClientEntity clientEntity);
+ List<ClientEntity> queryClientByUserForm(QueryClientByUserFormDTO queryClientByUserFormDTO);
- Integer deActiveByHostPort(ClientEntity clientEntity);
-
- void insertClient(ClientEntity clientEntity);
-
- Integer batchInsert(List<ClientEntity> clientEntityList);
-
- List<ClientEntity> selectByHostPort(ClientEntity clientEntity);
+ void batchInsert(List<ClientEntity> clientEntityList);
List<ClientEntity> selectByClusterId(ClientEntity clientEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterRelationshipService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterRelationshipService.java
index 18c2cb2..1523bb3 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterRelationshipService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterRelationshipService.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterAndRelationshipEntity;
@@ -28,7 +29,9 @@
public interface ClusterRelationshipService {
- void insertClusterRelationshipEntry(ClusterRelationshipEntity clusterRelationshipEntity);
+ Integer addClusterRelationshipEntry(ClusterRelationshipEntity clusterRelationshipEntity);
+
+ Integer addClusterRelationshipEntry(List<ClusterRelationshipEntity> clusterRelationshipList);
Integer relieveRelationship(ClusterRelationshipEntity clusterRelationshipEntity);
@@ -39,4 +42,7 @@
List<ClusterRelationshipEntity> selectNewlyIncreased(ClusterRelationshipEntity clusterRelationshipEntity);
+ List<ClusterRelationshipEntity> queryByUpdateTime(ClusterRelationshipEntity clusterRelationshipEntity);
+
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java
index 66ecfb6..a38ce54 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java
@@ -15,11 +15,15 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity;
+import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
import org.apache.eventmesh.dashboard.console.modle.vo.cluster.GetClusterBaseMessageVO;
+import java.util.Deque;
import java.util.List;
import java.util.Map;
@@ -29,14 +33,29 @@
public interface ClusterService {
+ boolean nameExist(ClusterEntity clusterEntity);
+
+ ClusterEntity queryClusterById(ClusterEntity clusterEntity);
+
+ List<ClusterEntity> queryClusterByOrganizationIdAndType(ClusterEntity clusterEntity);
+
+
+ List<ClusterEntity> queryRelationClusterByClusterIdAndType(ClusterEntity clusterEntity);
+
+ ClusterEntity queryRelationshipClusterByClusterIdAndType(ClusterEntity clusterEntity);
+
+ List<ClusterEntity> queryStorageByClusterId(ClusterEntity clusterEntity);
+
+ List<ClusterEntity> queryAllSubClusterByClusterId(ClusterEntity clusterEntity);
+
void createCluster(ClusterEntity clusterEntity);
- GetClusterBaseMessageVO selectClusterBaseMessage(Long clusterId);
+ GetClusterBaseMessageVO getClusterBaseMessage(ClusterIdDTO clusterIdDTO);
- Map<String, Integer> queryHomeClusterData(Long clusterId);
+ Map<String, Integer> queryHomeClusterData(ClusterIdDTO clusterIdDTO);
- Integer batchInsert(List<ClusterEntity> clusterEntities);
+ Integer batchInsert(List<ClusterEntity> clusterEntities, ClusterEntity clusterEntity);
List<ClusterEntity> selectAll();
@@ -44,11 +63,16 @@
void insertCluster(ClusterEntity cluster);
+ void insertClusterAndRelationship(ClusterEntity cluster, ClusterRelationshipEntity clusterRelationshipEntity);
+
List<ClusterEntity> selectAllCluster();
- ClusterEntity selectClusterById(ClusterEntity cluster);
Integer updateClusterById(ClusterEntity cluster);
Integer deactivate(ClusterEntity cluster);
+
+ List<ClusterEntity> queryByUpdateTime(ClusterEntity clusterEntity);
+
+ Deque<Integer> getIndex(ClusterEntity clusterEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java
index c1a6345..4533a2d 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java
@@ -15,23 +15,21 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.cluster;
-import org.apache.eventmesh.dashboard.console.entity.CreateConnectionEntity;
import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity;
import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO;
import org.apache.eventmesh.dashboard.console.modle.vo.connection.ConnectionListVO;
import java.util.List;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
/**
* Service providing ConnectionEntity data.
*/
-@Service
public interface ConnectionDataService {
ConnectorEntity getConnectorById(Long connectorId);
@@ -40,16 +38,13 @@
List<ConnectionEntity> getAllConnectionsByClusterId(Long clusterId);
- boolean createConnection(CreateConnectionEntity connectionEntity);
+ boolean createConnection(CreateConnectionDTO createConnectionDTO);
List<ConnectionEntity> getAllConnections();
- List<ConnectionListVO> getConnectionToFrontByCluster(ConnectionEntity connectionEntity);
-
- @Transactional
- void replaceAllConnections(List<ConnectionEntity> connectionEntityList);
+ List<ConnectionListVO> getConnectionToFrontByCluster(Long clusterId, GetConnectionListDTO getConnectionListDTO);
List<ConfigEntity> getConnectorConfigsByClassAndVersion(String classType, String version);
- void insert(ConnectionEntity connectionEntity);
+ Long insert(ConnectionEntity connectionEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/InstanceUserService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/InstanceUserService.java
deleted file mode 100644
index 6958480..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/InstanceUserService.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.service.cluster;
-
-import org.apache.eventmesh.dashboard.console.entity.cluster.InstanceUserEntity;
-
-import java.util.List;
-
-/**
- * InstanceUser data service
- */
-public interface InstanceUserService {
-
- void insert(InstanceUserEntity instanceuserEntity);
-
- void deleteInstanceUserByCluster(InstanceUserEntity instanceuserEntity);
-
- void updatePasswordById(InstanceUserEntity instanceuserentity);
-
- List<InstanceUserEntity> selectAll();
-
- InstanceUserEntity selectById(InstanceUserEntity instanceuserEntity);
-
- List<InstanceUserEntity> selectByName(InstanceUserEntity instanceuserEntity);
-
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/RuntimeService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/RuntimeService.java
index d801154..f0c68ba 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/RuntimeService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/RuntimeService.java
@@ -15,10 +15,13 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.cluster;
import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.modle.DO.runtime.QueryRuntimeByBigExpandClusterDO;
+import org.apache.eventmesh.dashboard.console.modle.deploy.ClusterAllMetadataDO;
import java.util.List;
@@ -29,19 +32,27 @@
RuntimeEntity queryRuntimeEntityById(RuntimeEntity runtimeEntity);
- List<RuntimeEntity> selectRuntimeToFrontByClusterId(RuntimeEntity runtimeEntity);
+ List<RuntimeEntity> queryRuntimeToFrontByClusterId(RuntimeEntity runtimeEntity);
- Integer batchInsert(List<RuntimeEntity> runtimeEntities);
+ List<RuntimeEntity> queryRuntimeByBigExpandCluster(QueryRuntimeByBigExpandClusterDO data);
+
+ List<RuntimeEntity> queryMetaRuntimeByStorageClusterId(QueryRuntimeByBigExpandClusterDO queryRuntimeByBigExpandClusterDO);
+
+ ClusterAllMetadataDO queryAllByClusterId(RuntimeEntity runtimeEntity, boolean isRuntime, boolean isRelationship);
+
+ void batchInsert(List<RuntimeEntity> runtimeEntities);
+
+ Integer batchUpdate(List<RuntimeEntity> runtimeEntities);
List<RuntimeEntity> selectAll();
- List<RuntimeEntity> selectByHostPort(RuntimeEntity runtimeEntity);
+ List<RuntimeEntity> queryByUpdateTime(RuntimeEntity runtimeEntity);
void insertRuntime(RuntimeEntity runtimeEntity);
- Integer updateRuntimeByCluster(RuntimeEntity runtimeEntity);
+ void updateRuntimeByCluster(RuntimeEntity runtimeEntity);
- Integer deleteRuntimeByCluster(RuntimeEntity runtimeEntity);
+ void deleteRuntimeByCluster(RuntimeEntity runtimeEntity);
- Integer deactivate(RuntimeEntity runtimeEntity);
+ void deactivate(RuntimeEntity runtimeEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/AclServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/AclServiceImpl.java
index 80fb074..6e555a8 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/AclServiceImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/AclServiceImpl.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.cluster.impl;
import org.apache.eventmesh.dashboard.console.entity.cluster.AclEntity;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClientDataServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClientDataServiceImpl.java
index c5f64fc..ad78f7f 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClientDataServiceImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClientDataServiceImpl.java
@@ -15,10 +15,12 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.cluster.impl;
import org.apache.eventmesh.dashboard.console.entity.cluster.ClientEntity;
import org.apache.eventmesh.dashboard.console.mapper.cluster.ClientMapper;
+import org.apache.eventmesh.dashboard.console.modle.cluster.client.QueryClientByUserFormDTO;
import org.apache.eventmesh.dashboard.console.service.cluster.ClientDataService;
import java.util.List;
@@ -32,31 +34,18 @@
@Autowired
private ClientMapper clientMapper;
- @Override
- public Integer deActive(ClientEntity clientEntity) {
- return clientMapper.deactivate(clientEntity);
- }
@Override
- public Integer deActiveByHostPort(ClientEntity clientEntity) {
- return clientMapper.deActiveByHostPort(clientEntity);
+ public List<ClientEntity> queryClientByUserForm(QueryClientByUserFormDTO queryClientByUserFormDTO) {
+ return this.clientMapper.queryClientByUserForm(queryClientByUserFormDTO);
}
- @SuppressWarnings("checkstyle:Indentation")
- @Override
- public void insertClient(ClientEntity clientEntity) {
- clientMapper.insert(clientEntity);
- }
@Override
- public Integer batchInsert(List<ClientEntity> clientEntityList) {
- return clientMapper.batchInsert(clientEntityList);
+ public void batchInsert(List<ClientEntity> clientEntityList) {
+ clientMapper.batchInsert(clientEntityList);
}
- @Override
- public List<ClientEntity> selectByHostPort(ClientEntity clientEntity) {
- return clientMapper.selectByHostPort(clientEntity);
- }
@Override
public List<ClientEntity> selectByClusterId(ClientEntity clientEntity) {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterRelationshipServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterRelationshipServiceImpl.java
index 171cafe..4ec0442 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterRelationshipServiceImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterRelationshipServiceImpl.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.cluster.impl;
import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterAndRelationshipEntity;
@@ -34,8 +35,13 @@
private ClusterRelationshipMapper clusterRelationshipMapper;
@Override
- public void insertClusterRelationshipEntry(ClusterRelationshipEntity clusterRelationshipEntity) {
- this.clusterRelationshipMapper.insertClusterRelationshipEntry(clusterRelationshipEntity);
+ public Integer addClusterRelationshipEntry(ClusterRelationshipEntity clusterRelationshipEntity) {
+ return this.clusterRelationshipMapper.insertClusterRelationshipEntry(clusterRelationshipEntity);
+ }
+
+ @Override
+ public Integer addClusterRelationshipEntry(List<ClusterRelationshipEntity> clusterRelationshipList) {
+ return this.clusterRelationshipMapper.batchClusterRelationshipEntry(clusterRelationshipList);
}
@Override
@@ -50,11 +56,16 @@
@Override
public List<ClusterRelationshipEntity> selectAll() {
- return this.clusterRelationshipMapper.selectAll();
+ return this.clusterRelationshipMapper.queryAll(null);
}
@Override
public List<ClusterRelationshipEntity> selectNewlyIncreased(ClusterRelationshipEntity clusterRelationshipEntity) {
- return this.clusterRelationshipMapper.selectNewlyIncreased();
+ return this.clusterRelationshipMapper.queryNewlyIncreased(clusterRelationshipEntity);
+ }
+
+ @Override
+ public List<ClusterRelationshipEntity> queryByUpdateTime(ClusterRelationshipEntity clusterRelationshipEntity) {
+ return null;
}
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java
index 3756faa..fb6a9eb 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java
@@ -15,23 +15,29 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.cluster.impl;
import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity;
import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity;
import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity;
import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity;
import org.apache.eventmesh.dashboard.console.mapper.cluster.ClusterMapper;
+import org.apache.eventmesh.dashboard.console.mapper.cluster.ClusterRelationshipMapper;
import org.apache.eventmesh.dashboard.console.mapper.cluster.ConnectionMapper;
import org.apache.eventmesh.dashboard.console.mapper.cluster.RuntimeMapper;
-import org.apache.eventmesh.dashboard.console.mapper.message.OprGroupMapper;
+import org.apache.eventmesh.dashboard.console.mapper.message.GroupMapper;
import org.apache.eventmesh.dashboard.console.mapper.message.TopicMapper;
-import org.apache.eventmesh.dashboard.console.modle.function.OverviewType;
+import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO;
+import org.apache.eventmesh.dashboard.console.modle.function.OverviewDTO;
import org.apache.eventmesh.dashboard.console.modle.vo.cluster.GetClusterBaseMessageVO;
import org.apache.eventmesh.dashboard.console.service.OverviewService;
import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
+import java.util.ArrayList;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -49,10 +55,13 @@
private ClusterMapper clusterMapper;
@Autowired
+ private ClusterRelationshipMapper clusterRelationshipMapper;
+
+ @Autowired
private RuntimeMapper runtimeMapper;
@Autowired
- private OprGroupMapper oprGroupMapper;
+ private GroupMapper groupMapper;
@Autowired
private TopicMapper topicMapper;
@@ -64,42 +73,99 @@
}
@Override
- public GetClusterBaseMessageVO selectClusterBaseMessage(Long clusterId) {
+ public ClusterEntity queryClusterById(ClusterEntity clusterEntity) {
+ return this.clusterMapper.queryByClusterId(clusterEntity);
+ }
+
+ @Override
+ public List<ClusterEntity> queryClusterByOrganizationIdAndType(ClusterEntity clusterEntity) {
+ return this.clusterMapper.queryClusterByOrganizationIdAndType(clusterEntity);
+ }
+
+ @Override
+ public List<ClusterEntity> queryRelationClusterByClusterIdAndType(ClusterEntity clusterEntity) {
+ return this.clusterMapper.queryRelationClusterByClusterIdAndType(clusterEntity);
+ }
+
+ @Override
+ public ClusterEntity queryRelationshipClusterByClusterIdAndType(ClusterEntity clusterEntity) {
+ List<ClusterEntity> queryData = new ArrayList<>();
+ queryData.add(clusterEntity);
+ List<ClusterEntity> clusterEntityList = this.clusterMapper.queryRelationshipClusterByClusterIdAndType(queryData);
+ return clusterEntityList.isEmpty() ? null : clusterEntityList.get(0);
+ }
+
+ @Override
+ public List<ClusterEntity> queryStorageByClusterId(ClusterEntity clusterEntity) {
+ List<ClusterEntity> clusterEntityList = new ArrayList<>();
+ this.clusterMapper.queryRelationshipClusterByClusterIdAndType(clusterEntityList).forEach(entity -> {
+ if (entity.getClusterType().isStorage()) {
+ clusterEntityList.add(entity);
+ }
+ });
+ return clusterEntityList;
+ }
+
+
+ @Override
+ public List<ClusterEntity> queryAllSubClusterByClusterId(ClusterEntity clusterEntity) {
+ return null;
+ }
+
+ @Override
+ public boolean nameExist(ClusterEntity clusterEntity) {
+ return true;
+ }
+
+ @Override
+ public GetClusterBaseMessageVO getClusterBaseMessage(ClusterIdDTO clusterIdDTO) {
+ Long clusterId = clusterIdDTO.getClusterId();
GetClusterBaseMessageVO getClusterBaseMessageVO = new GetClusterBaseMessageVO();
TopicEntity topicEntity = new TopicEntity();
topicEntity.setClusterId(clusterId);
getClusterBaseMessageVO.setTopicNum(topicMapper.selectTopicNumByCluster(topicEntity));
GroupEntity groupEntity = new GroupEntity();
groupEntity.setClusterId(clusterId);
- getClusterBaseMessageVO.setConsumerGroupNum(oprGroupMapper.selectConsumerNumByCluster(groupEntity));
+ getClusterBaseMessageVO.setConsumerGroupNum(groupMapper.getConsumerNumByCluster(groupEntity));
ConnectionEntity connectionEntity = new ConnectionEntity();
connectionEntity.setClusterId(clusterId);
getClusterBaseMessageVO.setConnectionNum(connectionMapper.selectConnectionNumByCluster(connectionEntity));
RuntimeEntity runtimeEntity = new RuntimeEntity();
runtimeEntity.setClusterId(clusterId);
- getClusterBaseMessageVO.setRuntimeNum(runtimeMapper.selectRuntimeNumByCluster(runtimeEntity));
+ getClusterBaseMessageVO.setRuntimeNum(runtimeMapper.getRuntimeNumByCluster(runtimeEntity));
return getClusterBaseMessageVO;
}
@Override
- public Map<String, Integer> queryHomeClusterData(Long clusterId) {
+ public Map<String, Integer> queryHomeClusterData(ClusterIdDTO clusterIdDTO) {
return null;
}
@Override
- public Integer batchInsert(List<ClusterEntity> clusterEntities) {
- return clusterMapper.batchInsert(clusterEntities);
+ public Integer batchInsert(List<ClusterEntity> clusterEntities, ClusterEntity clusterEntity) {
+ clusterMapper.batchInsert(clusterEntities);
+ List<ClusterRelationshipEntity> clusterRelationshipEntityList = new ArrayList<>();
+ clusterEntities.forEach(entity -> {
+ ClusterRelationshipEntity clusterRelationshipEntity = new ClusterRelationshipEntity();
+ clusterRelationshipEntityList.add(clusterRelationshipEntity);
+
+ clusterRelationshipEntityList.add(clusterRelationshipEntity);
+ clusterRelationshipEntity.setClusterId(clusterEntity.getId());
+ clusterRelationshipEntity.setClusterType(clusterEntity.getClusterType());
+ });
+ this.clusterRelationshipMapper.batchClusterRelationshipEntry(clusterRelationshipEntityList);
+ return 1;
}
@Override
public List<ClusterEntity> selectAll() {
- return clusterMapper.selectAllCluster();
+ return clusterMapper.queryAllCluster();
}
@Override
public List<ClusterEntity> selectNewlyIncreased(ClusterEntity clusterEntity) {
- return clusterMapper.selectAllCluster();
+ return clusterMapper.queryAllCluster();
}
@Override
@@ -108,13 +174,14 @@
}
@Override
- public List<ClusterEntity> selectAllCluster() {
- return clusterMapper.selectAllCluster();
+ public void insertClusterAndRelationship(ClusterEntity cluster, ClusterRelationshipEntity clusterRelationshipEntity) {
+ clusterMapper.insertCluster(cluster);
+ clusterRelationshipMapper.insertClusterRelationshipEntry(clusterRelationshipEntity);
}
@Override
- public ClusterEntity selectClusterById(ClusterEntity cluster) {
- return clusterMapper.selectClusterById(cluster);
+ public List<ClusterEntity> selectAllCluster() {
+ return clusterMapper.queryAllCluster();
}
@@ -129,7 +196,23 @@
}
@Override
- public Object overview(OverviewType overviewtype) {
+ public Object overview(OverviewDTO overviewDTO) {
return null;
}
+
+ @Override
+ public List<ClusterEntity> queryByUpdateTime(ClusterEntity clusterEntity) {
+ return null;
+ }
+
+ @Override
+ public LinkedList<Integer> getIndex(ClusterEntity clusterEntity) {
+ ClusterEntity before = this.clusterMapper.lockByClusterId(clusterEntity);
+ this.clusterMapper.updateNumByClusterId(clusterEntity);
+ LinkedList<Integer> indexList = new LinkedList<>();
+ for (int i = before.getRuntimeIndex(); i <= before.getRuntimeIndex() + clusterEntity.getRuntimeIndex(); i++) {
+ indexList.add(i);
+ }
+ return indexList;
+ }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ConnectionDataServiceDatabaseImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ConnectionDataServiceDatabaseImpl.java
deleted file mode 100644
index 2ba287a..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ConnectionDataServiceDatabaseImpl.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.service.cluster.impl;
-
-
-
-import org.apache.eventmesh.dashboard.console.annotation.EmLog;
-import org.apache.eventmesh.dashboard.console.entity.CreateConnectionEntity;
-import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity;
-import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectionEntity;
-import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
-import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
-import org.apache.eventmesh.dashboard.console.mapper.cluster.ConnectionMapper;
-import org.apache.eventmesh.dashboard.console.mapper.connector.ConnectorMapper;
-import org.apache.eventmesh.dashboard.console.mapper.function.ConfigMapper;
-import org.apache.eventmesh.dashboard.console.modle.vo.connection.ConnectionListVO;
-import org.apache.eventmesh.dashboard.console.service.cluster.ConnectionDataService;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-
-@Service
-public class ConnectionDataServiceDatabaseImpl implements ConnectionDataService {
-
- @Autowired
- private ConnectionMapper connectionMapper;
-
- @Autowired
- private ConnectorMapper connectorMapper;
-
- @Autowired
- private ConfigMapper configMapper;
-
-
- @Override
- public ConnectorEntity getConnectorById(Long connectorId) {
- ConnectorEntity connectorEntity = new ConnectorEntity();
- connectorEntity.setId(connectorId);
- return connectorMapper.selectById(connectorEntity);
- }
-
- @Override
- public List<String> getConnectorBusinessType(String type) {
- ConfigEntity config = new ConfigEntity();
- config.setBusinessType(type);
- return configMapper.selectConnectorBusinessType(config);
- }
-
- @Override
- public List<ConnectionEntity> getAllConnectionsByClusterId(Long clusterId) {
- ConnectionEntity connectionEntity = new ConnectionEntity();
- connectionEntity.setClusterId(clusterId);
- return connectionMapper.selectByClusterId(connectionEntity);
- }
-
- @Override
- public void insert(ConnectionEntity connectionEntity) {
- connectionMapper.insert(connectionEntity);
- }
-
-
- @EmLog(OprType = "add", OprTarget = "Connection")
- @Override
- public boolean createConnection(CreateConnectionEntity createConnectionEntity) {
- ConnectorEntity sinkConnector = this.createSinkConnector(createConnectionEntity.getClusterId(),
- createConnectionEntity.getAddConnectionEntity());
- ConnectorEntity sourceConnector = this.createSourceConnector(createConnectionEntity.getClusterId(),
- createConnectionEntity.getAddConnectionEntity());
- ConnectionEntity connectionEntity = this.setConnection(createConnectionEntity);
- connectionEntity.setSinkId(sinkConnector.getId());
- connectionEntity.setSourceId(sourceConnector.getId());
- connectionMapper.insert(connectionEntity);
- this.addConnectorConfigs(createConnectionEntity.getAddConnectorConfigEntity().getSinkConnectorConfigs(), sinkConnector);
- this.addConnectorConfigs(createConnectionEntity.getAddConnectorConfigEntity().getSourceConnectorConfigs(), sourceConnector);
- return false;
- }
-
- private ConnectionEntity setConnection(CreateConnectionEntity createConnectionEntity) {
- ConnectionEntity connectionEntity = new ConnectionEntity();
- connectionEntity.setClusterId(createConnectionEntity.getClusterId());
- connectionEntity.setSourceType("connector");
- connectionEntity.setSinkType("connector");
- connectionEntity.setRuntimeId(-1L);
- connectionEntity.setGroupId(createConnectionEntity.getAddConnectionEntity().getGroupId());
- connectionEntity.setStatus(1);
- connectionEntity.setDescription(createConnectionEntity.getAddConnectionEntity().getConnectionDescription());
- connectionEntity.setTopic(createConnectionEntity.getAddConnectionEntity().getTopicName());
- return connectionEntity;
- }
-
- public void addConnectorConfigs(List<ConfigEntity> configEntityList, ConnectorEntity connectorEntity) {
- configEntityList.forEach(n -> {
- n.setInstanceId(connectorEntity.getId());
- n.setIsDefault(0);
- n.setClusterId(connectorEntity.getClusterId());
- });
- configMapper.batchInsert(configEntityList);
- }
-
- public ConnectorEntity createSinkConnector(Long clusterId, AddConnectionEntity addConnectionEntity) {
- ConnectorEntity connectorEntity = new ConnectorEntity();
- connectorEntity.setName(addConnectionEntity.getSinkName());
- connectorEntity.setHost(addConnectionEntity.getSinkHost());
- connectorEntity.setClusterId(clusterId);
- connectorEntity.setClassName(addConnectionEntity.getSinkClass());
- connectorEntity.setType("Connector");
- connectorEntity.setStatus(1);
- connectorEntity.setPodState(0);
- connectorEntity.setPort(addConnectionEntity.getSinkPort());
- connectorMapper.insert(connectorEntity);
- return connectorEntity;
- }
-
- public ConnectorEntity createSourceConnector(Long clusterId, AddConnectionEntity addConnectionEntity) {
- ConnectorEntity connectorEntity = new ConnectorEntity();
- connectorEntity.setName(addConnectionEntity.getSourceName());
- connectorEntity.setHost(addConnectionEntity.getSourceHost());
- connectorEntity.setClusterId(clusterId);
- connectorEntity.setClassName(addConnectionEntity.getSourceClass());
- connectorEntity.setType("Connector");
- connectorEntity.setStatus(1);
- connectorEntity.setPodState(0);
- connectorEntity.setPort(addConnectionEntity.getSourcePort());
- connectorMapper.insert(connectorEntity);
- return connectorEntity;
- }
-
-
- @Override
- public List<ConnectionEntity> getAllConnections() {
- return connectionMapper.selectAll();
- }
-
- @Override
- public List<ConnectionListVO> getConnectionToFrontByCluster(ConnectionEntity connectionEntity) {
- List<ConnectionEntity> allConnectionsByClusterId = connectionMapper.selectToFrontByClusterId(connectionEntity);
- List<ConnectionListVO> connectionListVOs = new ArrayList<>();
- allConnectionsByClusterId.forEach(n -> {
- connectionListVOs.add(this.setConnectionListVO(n));
- });
- return connectionListVOs;
- }
-
- private ConnectionListVO setConnectionListVO(ConnectionEntity connectionEntity) {
- ConnectionListVO connectionListVO = new ConnectionListVO();
- ConnectorEntity connectorEntity = new ConnectorEntity();
- connectorEntity.setId(connectionEntity.getSinkId());
- ConnectorEntity sinkConnector = connectorMapper.selectById(connectorEntity);
- connectorEntity.setId(connectionEntity.getSourceId());
- ConnectorEntity sourceConnector = connectorMapper.selectById(connectorEntity);
- connectionListVO.setSinkClass(sinkConnector.getClassName());
- connectionListVO.setSourceClass(sourceConnector.getClassName());
- connectionListVO.setSinkConnectorId(sinkConnector.getId());
- connectionListVO.setSourceConnectorId(sourceConnector.getId());
- connectionListVO.setSinkConnectorName(sinkConnector.getName());
- connectionListVO.setSourceConnectorName(sourceConnector.getName());
- connectionListVO.setTopicName(connectionEntity.getTopic());
- connectionListVO.setStatus(connectionEntity.getStatus());
- return connectionListVO;
- }
-
- @Override
- @Transactional
- public void replaceAllConnections(List<ConnectionEntity> connectionEntityList) {
- Map<Long, List<ConnectionEntity>> connectionsGroupedByClusterId = connectionEntityList.stream()
- .collect(Collectors.groupingBy(ConnectionEntity::getClusterId));
-
- connectionsGroupedByClusterId.forEach((clusterId, newConnections) -> {
- ConnectionEntity connectionEntity = new ConnectionEntity();
- connectionEntity.setClusterId(clusterId);
- List<ConnectionEntity> existingConnections = connectionMapper.selectByClusterId(connectionEntity);
-
- // Collect connections that are not in the new list
- List<ConnectionEntity> connectionsToInactive = existingConnections.stream()
- .filter(existingConnection -> !newConnections.contains(existingConnection))
- .collect(Collectors.toList());
-
- // Collect new connections that are not in the existing list
- List<ConnectionEntity> connectionsToInsert = newConnections.stream()
- .filter(connection -> !existingConnections.contains(connection))
- .collect(Collectors.toList());
-
- // Delete connections in batch
- if (!connectionsToInactive.isEmpty()) {
- connectionMapper.batchEndConnectionById(connectionsToInactive);
- }
-
- // Insert new connections in batch
- if (!connectionsToInsert.isEmpty()) {
- connectionMapper.batchInsert(connectionsToInsert);
- }
- });
- }
-
-
- @Override
- public List<ConfigEntity> getConnectorConfigsByClassAndVersion(String classType, String version) {
- ConfigEntity config = new ConfigEntity();
- config.setBusinessType(classType);
- List<ConfigEntity> configEntityList = configMapper.selectConnectorConfigsByBusinessType(config);
- configEntityList.forEach(n -> {
- if (!n.matchVersion(version)) {
- configEntityList.remove(n);
- }
- });
- return configEntityList;
- }
-}
-
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/InstanceUserServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/InstanceUserServiceImpl.java
deleted file mode 100644
index 716e1d4..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/InstanceUserServiceImpl.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.service.cluster.impl;
-
-import org.apache.eventmesh.dashboard.console.entity.cluster.InstanceUserEntity;
-import org.apache.eventmesh.dashboard.console.mapper.cluster.InstanceUserMapper;
-import org.apache.eventmesh.dashboard.console.service.cluster.InstanceUserService;
-
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-
-@Service
-public class InstanceUserServiceImpl implements InstanceUserService {
-
- @Autowired
- private InstanceUserMapper instanceUserMapper;
-
- @Override
- public void insert(InstanceUserEntity instanceuserEntity) {
- instanceUserMapper.insert(instanceuserEntity);
- }
-
- @Override
- public void deleteInstanceUserByCluster(InstanceUserEntity instanceuserEntity) {
- instanceUserMapper.deleteInstanceUserById(instanceuserEntity);
- }
-
- @Override
- public void updatePasswordById(InstanceUserEntity instanceuserEntity) {
- instanceUserMapper.updatePasswordById(instanceuserEntity);
- }
-
- @Override
- public List<InstanceUserEntity> selectAll() {
- return instanceUserMapper.selectAll();
- }
-
- @Override
- public InstanceUserEntity selectById(InstanceUserEntity instanceuserEntity) {
- return instanceUserMapper.selectById(instanceuserEntity);
- }
-
- @Override
- public List<InstanceUserEntity> selectByName(InstanceUserEntity instanceuserEntity) {
- return instanceUserMapper.selectByName(instanceuserEntity);
- }
-
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/RuntimeServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/RuntimeServiceImpl.java
index d414d13..54d4849 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/RuntimeServiceImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/RuntimeServiceImpl.java
@@ -15,19 +15,29 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.cluster.impl;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity;
import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache;
+import org.apache.eventmesh.dashboard.console.mapper.cluster.ClusterMapper;
+import org.apache.eventmesh.dashboard.console.mapper.cluster.ClusterRelationshipMapper;
import org.apache.eventmesh.dashboard.console.mapper.cluster.RuntimeMapper;
import org.apache.eventmesh.dashboard.console.mapper.function.HealthCheckResultMapper;
+import org.apache.eventmesh.dashboard.console.modle.DO.clusterRelationship.QueryListByClusterIdAndTypeDO;
+import org.apache.eventmesh.dashboard.console.modle.DO.runtime.QueryRuntimeByBigExpandClusterDO;
+import org.apache.eventmesh.dashboard.console.modle.deploy.ClusterAllMetadataDO;
import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService;
+import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
@Service
public class RuntimeServiceImpl implements RuntimeService {
@@ -39,14 +49,74 @@
private HealthCheckResultMapper healthCheckResultMapper;
+ @Autowired
+ private ClusterMapper clusterMapper;
+
+
+ @Autowired
+ private ClusterRelationshipMapper clusterRelationshipMapper;
+
@Override
public RuntimeEntity queryRuntimeEntityById(RuntimeEntity runtimeEntity) {
return this.runtimeMapper.queryRuntimeEntityById(runtimeEntity);
}
+
@Override
- public List<RuntimeEntity> selectRuntimeToFrontByClusterId(RuntimeEntity runtimeEntity) {
- List<RuntimeEntity> runtimeByClusterId = runtimeMapper.selectRuntimesToFrontByCluster(runtimeEntity);
+ public List<RuntimeEntity> queryRuntimeByBigExpandCluster(QueryRuntimeByBigExpandClusterDO queryRuntimeByBigExpandClusterDO) {
+ return this.runtimeMapper.queryRuntimeByBigExpandCluster(queryRuntimeByBigExpandClusterDO);
+ }
+
+ @Override
+ public List<RuntimeEntity> queryMetaRuntimeByStorageClusterId(QueryRuntimeByBigExpandClusterDO queryRuntimeByBigExpandClusterDO) {
+ // 通过 storage cluster id , 获得 main cluster id
+ // 通过 子集群 id 获得 主(多) 集群 下面的其他集群
+ return this.runtimeMapper.queryClusterRuntimeOnClusterSpecifyByClusterId(queryRuntimeByBigExpandClusterDO);
+ }
+
+ @Override
+ @Transactional(readOnly = true)
+ public ClusterAllMetadataDO queryAllByClusterId(RuntimeEntity runtimeEntity, boolean isRuntime, boolean isRelationship) {
+
+ ClusterEntity clusterEntity = new ClusterEntity();
+ clusterEntity.setId(runtimeEntity.getClusterId());
+ clusterEntity = this.clusterMapper.queryByClusterId(clusterEntity);
+
+ List<ClusterEntity> clusterEntityList = new ArrayList<>();
+ List<ClusterEntity> definitionList = new ArrayList<>();
+ definitionList.add(clusterEntity);
+ for (int i = 0; i < 5; i++) {
+ List<ClusterEntity> relationshipList = this.clusterMapper.queryRelationshipClusterByClusterIdAndType(definitionList);
+ definitionList.clear();
+ relationshipList.forEach(entity -> {
+ if (entity.getClusterType().isRuntime()) {
+ definitionList.add(entity);
+ }
+ clusterEntityList.add(entity);
+ });
+ if (definitionList.isEmpty()) {
+ break;
+ }
+ }
+
+ ClusterAllMetadataDO clusterAllMetadata = new ClusterAllMetadataDO();
+ clusterAllMetadata.setClusterEntityList(clusterEntityList);
+ if (isRuntime) {
+ List<RuntimeEntity> runtimeEntityList = this.runtimeMapper.queryRuntimeByClusterId(clusterEntityList);
+ clusterAllMetadata.setRuntimeEntityList(runtimeEntityList);
+ }
+ if (isRelationship) {
+ QueryListByClusterIdAndTypeDO data = QueryListByClusterIdAndTypeDO.builder().build();
+ List<ClusterRelationshipEntity> relationshipEntityList =
+ this.clusterRelationshipMapper.queryClusterRelationshipEntityListByClusterId(data);
+ clusterAllMetadata.setClusterRelationshipEntityList(relationshipEntityList);
+ }
+ return clusterAllMetadata;
+ }
+
+ @Override
+ public List<RuntimeEntity> queryRuntimeToFrontByClusterId(RuntimeEntity runtimeEntity) {
+ List<RuntimeEntity> runtimeByClusterId = runtimeMapper.getRuntimesToFrontByCluster(runtimeEntity);
runtimeByClusterId.forEach(n -> {
n.setStatus(CheckResultCache.getINSTANCE().getLastHealthyCheckResult("runtime", n.getId()));
});
@@ -55,37 +125,43 @@
@Override
- public Integer batchInsert(List<RuntimeEntity> runtimeEntities) {
- return runtimeMapper.batchInsert(runtimeEntities);
+ public void batchInsert(List<RuntimeEntity> runtimeEntities) {
+ runtimeMapper.batchInsert(runtimeEntities);
+ }
+
+ @Override
+ public Integer batchUpdate(List<RuntimeEntity> runtimeEntities) {
+ return 0;
}
@Override
public List<RuntimeEntity> selectAll() {
- return runtimeMapper.selectAll();
+ return runtimeMapper.queryAll();
}
@Override
- public List<RuntimeEntity> selectByHostPort(RuntimeEntity runtimeEntity) {
- return runtimeMapper.selectByHostPort(runtimeEntity);
+ public List<RuntimeEntity> queryByUpdateTime(RuntimeEntity runtimeEntity) {
+ return runtimeMapper.queryByUpdateTime(runtimeEntity);
}
+
@Override
public void insertRuntime(RuntimeEntity runtimeEntity) {
runtimeMapper.insertRuntime(runtimeEntity);
}
@Override
- public Integer updateRuntimeByCluster(RuntimeEntity runtimeEntity) {
- return runtimeMapper.updateRuntimeByCluster(runtimeEntity);
+ public void updateRuntimeByCluster(RuntimeEntity runtimeEntity) {
+ runtimeMapper.updateRuntimeByCluster(runtimeEntity);
}
@Override
- public Integer deleteRuntimeByCluster(RuntimeEntity runtimeEntity) {
- return runtimeMapper.deleteRuntimeByCluster(runtimeEntity);
+ public void deleteRuntimeByCluster(RuntimeEntity runtimeEntity) {
+ runtimeMapper.deleteRuntimeByCluster(runtimeEntity);
}
@Override
- public Integer deactivate(RuntimeEntity runtimeEntity) {
- return runtimeMapper.deactivate(runtimeEntity);
+ public void deactivate(RuntimeEntity runtimeEntity) {
+ runtimeMapper.deactivate(runtimeEntity);
}
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ConnectorDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ConnectorDataService.java
index 227f1e9..c8d45c5 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ConnectorDataService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ConnectorDataService.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.connector;
import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
@@ -26,7 +27,7 @@
*/
public interface ConnectorDataService {
- void createConnector(ConnectorEntity connectorEntity);
+ Long createConnector(ConnectorEntity connectorEntity);
List<ConnectorEntity> selectAll();
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/Impl/ConnectorDataServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/Impl/ConnectorDataServiceImpl.java
index 12ac190..51ebb6f 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/Impl/ConnectorDataServiceImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/Impl/ConnectorDataServiceImpl.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.connector.Impl;
import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
@@ -33,8 +34,8 @@
private ConnectorMapper connectorMapper;
@Override
- public void createConnector(ConnectorEntity connectorEntity) {
- connectorMapper.insert(connectorEntity);
+ public Long createConnector(ConnectorEntity connectorEntity) {
+ return connectorMapper.insert(connectorEntity);
}
@Override
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/Impl/ResourcesConfigServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/Impl/ResourcesConfigServiceImpl.java
new file mode 100644
index 0000000..139eb3a
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/Impl/ResourcesConfigServiceImpl.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.service.connector.Impl;
+
+
+import org.apache.eventmesh.dashboard.console.entity.cases.ResourcesConfigEntity;
+import org.apache.eventmesh.dashboard.console.service.connector.ResourcesConfigService;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class ResourcesConfigServiceImpl implements ResourcesConfigService {
+
+
+
+ @Override
+ public void insertResources(ResourcesConfigEntity resourcesConfigEntity) {
+
+ }
+
+ @Override
+ public ResourcesConfigEntity queryResourcesById(ResourcesConfigEntity resourcesConfigEntity) {
+ return null;
+ }
+
+ @Override
+ public List<ResourcesConfigEntity> queryResourcesByOrganizationId(ResourcesConfigEntity resourcesConfigEntity) {
+ return List.of();
+ }
+
+ @Override
+ public void copyResources(ResourcesConfigEntity resourcesConfigEntity) {
+
+ }
+}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ResourcesConfigService.java
similarity index 60%
copy from eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ResourcesConfigService.java
index 2e63772..41c38e2 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ResourcesConfigService.java
@@ -15,21 +15,27 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.service.store;
-import org.apache.eventmesh.dashboard.service.dto.TopicProperties;
+package org.apache.eventmesh.dashboard.console.service.connector;
+
+import org.apache.eventmesh.dashboard.console.entity.cases.ResourcesConfigEntity;
import java.util.List;
/**
- * Manage topics of eventmesh-storage-plugin (EventMesh Store).
+ *
*/
+public interface ResourcesConfigService {
-public interface TopicCore {
- List<TopicProperties> getTopics();
- Boolean createTopic(String topicName);
+ void insertResources(ResourcesConfigEntity resourcesConfigEntity);
- Boolean deleteTopic(String topicName);
+
+ ResourcesConfigEntity queryResourcesById(ResourcesConfigEntity resourcesConfigEntity);
+
+
+ List<ResourcesConfigEntity> queryResourcesByOrganizationId(ResourcesConfigEntity resourcesConfigEntity);
+
+ void copyResources(ResourcesConfigEntity resourcesConfigEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/log/LogControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/deploy/DeployScriptService.java
similarity index 62%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/log/LogControllerMapper.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/deploy/DeployScriptService.java
index 03c5302..81616ce 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/log/LogControllerMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/deploy/DeployScriptService.java
@@ -15,24 +15,27 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.mapstruct.log;
-import org.apache.eventmesh.dashboard.console.entity.function.LogEntity;
-import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO;
+package org.apache.eventmesh.dashboard.console.service.deploy;
-
-import org.mapstruct.Mapper;
-import org.mapstruct.factory.Mappers;
+import org.apache.eventmesh.dashboard.console.entity.cases.DeployScriptEntity;
/**
*
*/
-@Mapper
-public interface LogControllerMapper {
-
- LogControllerMapper INSTANCE = Mappers.getMapper(LogControllerMapper.class);
+public interface DeployScriptService {
- LogEntity queryEntityByLog(GetLogListDTO getLogListDTO);
+ void insert(DeployScriptEntity deployScriptEntity);
+
+ void update(DeployScriptEntity deployScriptEntity);
+
+
+ void deleteById(DeployScriptEntity deployScriptEntity);
+
+
+ DeployScriptEntity queryById(DeployScriptEntity deployScriptEntity);
+
+ void queryByName(DeployScriptEntity deployScriptEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/deploy/PortService.java
similarity index 76%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/deploy/PortService.java
index 6dafeef..d5937eb 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/deploy/PortService.java
@@ -15,20 +15,19 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+
+package org.apache.eventmesh.dashboard.console.service.deploy;
+
+import org.apache.eventmesh.dashboard.console.modle.deploy.GetPortsDO;
+
+import java.util.List;
+
+/**
+ *
+ */
+public interface PortService {
-import lombok.Data;
-
-@Data
-public class UpdateConfigsLog {
-
- private Long instanceId;
-
- private Long clusterId;
-
- private String name;
-
- private String configProperties;
+ List<String> getPorts(GetPortsDO getPortsDO);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/deploy/impl/DeployScriptServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/deploy/impl/DeployScriptServiceImpl.java
new file mode 100644
index 0000000..ab9c129
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/deploy/impl/DeployScriptServiceImpl.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.service.deploy.impl;
+
+import org.apache.eventmesh.dashboard.console.entity.cases.DeployScriptEntity;
+import org.apache.eventmesh.dashboard.console.mapper.deploy.DeployScriptMapper;
+import org.apache.eventmesh.dashboard.console.service.deploy.DeployScriptService;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+
+@Service
+@Transactional
+public class DeployScriptServiceImpl implements DeployScriptService {
+
+ @Autowired
+ private DeployScriptMapper deployScriptMapper;
+
+ @Override
+ public void insert(DeployScriptEntity deployScriptEntity) {
+ this.deployScriptMapper.insert(deployScriptEntity);
+ }
+
+ @Override
+ public void update(DeployScriptEntity deployScriptEntity) {
+ this.deployScriptMapper.update(deployScriptEntity);
+ }
+
+ @Override
+ public void deleteById(DeployScriptEntity deployScriptEntity) {
+ this.deployScriptMapper.deleteById(deployScriptEntity);
+ }
+
+ @Override
+ public DeployScriptEntity queryById(DeployScriptEntity deployScriptEntity) {
+ return null;
+ }
+
+ @Override
+ public void queryByName(DeployScriptEntity deployScriptEntity) {
+ this.deployScriptMapper.queryByName(deployScriptEntity);
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/deploy/impl/PortServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/deploy/impl/PortServiceImpl.java
new file mode 100644
index 0000000..7099316
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/deploy/impl/PortServiceImpl.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.service.deploy.impl;
+
+import org.apache.eventmesh.dashboard.console.entity.cases.PortEntity;
+import org.apache.eventmesh.dashboard.console.mapper.deploy.PortMapper;
+import org.apache.eventmesh.dashboard.console.modle.deploy.GetPortsDO;
+import org.apache.eventmesh.dashboard.console.service.deploy.PortService;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class PortServiceImpl implements PortService {
+
+ @Autowired
+ private PortMapper portMapper;
+
+ @Override
+ public List<String> getPorts(GetPortsDO getPortsDO) {
+ PortEntity portEntity = new PortEntity();
+ portEntity.setClusterId(getPortsDO.getClusterId());
+ PortEntity newPort = this.portMapper.lockPort(portEntity);
+ if (Objects.isNull(newPort)) {
+ portEntity.setCurrentPort(2000);
+ this.portMapper.insertPort(portEntity);
+ newPort = this.portMapper.lockPort(portEntity);
+ }
+ List<String> ports = new ArrayList<>();
+ this.portMapper.updatePort(portEntity);
+ for (int i = 1; i <= getPortsDO.getPortNum(); i++) {
+ ports.add((newPort.getCurrentPort() + i) + "");
+ }
+ return ports;
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java
index c619bd1..5b3ab84 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java
@@ -15,11 +15,13 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.function;
import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
-import org.apache.eventmesh.dashboard.console.modle.config.ChangeConfigEntity;
+import org.apache.eventmesh.dashboard.console.modle.dto.config.ChangeConfigDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO;
import java.util.List;
import java.util.Map;
@@ -30,18 +32,19 @@
*/
public interface ConfigService {
- List<ConfigEntity> selectToFront(ConfigEntity configEntity);
+ List<ConfigEntity> queryByClusterAndInstanceId(ConfigEntity configEntity);
- void updateConfigsByInstanceId(String name, Long clusterId, Integer instanceType, Long instanceId,
- List<ChangeConfigEntity> changeConfigEntityList);
+ List<ConfigEntity> selectToFront(Long instanceId, Integer type, GetConfigsListDTO getConfigsListDTO);
+
+ void updateConfigsByInstanceId(String name, Long clusterId, Integer instanceType, Long instanceId, List<ChangeConfigDTO> changeConfigDTOList);
List<ConfigEntity> selectAll();
- Integer batchInsert(List<ConfigEntity> configEntityList);
+ void batchInsert(List<ConfigEntity> configEntityList);
- String mapToYaml(Map<String, String> stringMap);
+ void copyConfig(Long sourceId, Long targetId);
- void insertConfig(ConfigEntity configEntity);
+ void restoreConfig(Long sourceId, Long targetId);
Integer deleteConfig(ConfigEntity configEntity);
@@ -51,7 +54,7 @@
List<ConfigEntity> selectByInstanceIdAndType(Long instanceId, Integer type);
- Map<String, String> selectDefaultConfig(String businessType);
+ Map<String, String> selectDefaultConfig(String version, Long instanceId, Integer instanceType);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataService.java
index 2b7f370..d37d587 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataService.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.function;
import org.apache.eventmesh.dashboard.console.entity.function.HealthCheckResultEntity;
@@ -29,24 +30,24 @@
*/
public interface HealthDataService {
- InstanceLiveProportionVo selectInstanceLiveProportion(Long clusterId, Integer instanceType);
+ InstanceLiveProportionVo getInstanceLiveProportion(Long clusterId, Integer instanceType);
- List<HealthCheckResultEntity> selectInstanceLiveStatusHistory(Integer type, Long clusterId, LocalDateTime startTime);
+ List<HealthCheckResultEntity> getInstanceLiveStatusHistory(Integer type, Long clusterId, LocalDateTime startTime);
HealthCheckResultEntity insertHealthCheckResult(HealthCheckResultEntity healthCheckResultEntity);
- Integer batchInsertHealthCheckResult(List<HealthCheckResultEntity> healthCheckResultEntityList);
+ void batchInsertHealthCheckResult(List<HealthCheckResultEntity> healthCheckResultEntityList);
/**
* New check results have state 4: SDK client not created or connected
*/
- Integer batchInsertNewCheckResult(List<HealthCheckResultEntity> healthCheckResultEntityList);
+ void batchInsertNewCheckResult(List<HealthCheckResultEntity> healthCheckResultEntityList);
List<HealthCheckResultEntity> selectAll();
List<HealthCheckResultEntity> queryHealthCheckResultByClusterIdAndTypeAndTypeId(HealthCheckResultEntity entity);
- Integer batchUpdateCheckResult(List<HealthCheckResultEntity> healthCheckResultEntityList);
+ void batchUpdateCheckResult(List<HealthCheckResultEntity> healthCheckResultEntityList);
void batchUpdateCheckResultByClusterIdAndTypeAndTypeId(List<HealthCheckResultEntity> healthCheckResultEntityList);
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataServiceMemoryStorage.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataServiceMemoryStorage.java
index 43b9976..319b2aa 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataServiceMemoryStorage.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataServiceMemoryStorage.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.function;
import org.apache.eventmesh.dashboard.console.entity.function.HealthCheckResultEntity;
@@ -28,6 +29,7 @@
import org.springframework.stereotype.Component;
@Component
+@Deprecated
public class HealthDataServiceMemoryStorage {
private static final List<HealthCheckResultEntity> cache = new ArrayList<>();
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/ConfigServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/ConfigServiceImpl.java
index b6b42c1..38b19c5 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/ConfigServiceImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/ConfigServiceImpl.java
@@ -15,14 +15,16 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.function.Impl;
import org.apache.eventmesh.dashboard.console.annotation.EmLog;
import org.apache.eventmesh.dashboard.console.entity.DefaultConfigKey;
import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
import org.apache.eventmesh.dashboard.console.mapper.function.ConfigMapper;
-import org.apache.eventmesh.dashboard.console.modle.config.ChangeConfigEntity;
-import org.apache.eventmesh.dashboard.console.modle.config.UpdateConfigsLog;
+import org.apache.eventmesh.dashboard.console.modle.dto.config.ChangeConfigDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.config.UpdateConfigsLog;
import org.apache.eventmesh.dashboard.console.service.function.ConfigService;
import java.util.Arrays;
@@ -48,10 +50,10 @@
@EmLog(OprTarget = "Runtime", OprType = "UpdateConfigs")
- public void logUpdateRuntimeConfigs(UpdateConfigsLog updateConfigsLog, List<ChangeConfigEntity> changeConfigEntityList) {
- changeConfigEntityList.forEach(n -> {
+ public void logUpdateRuntimeConfigs(UpdateConfigsLog updateConfigsLog, List<ChangeConfigDTO> changeConfigDTOList) {
+ changeConfigDTOList.forEach(n -> {
ConfigEntity config = new ConfigEntity();
- config.setInstanceType(0);
+ config.setInstanceType(null);
config.setInstanceId(updateConfigsLog.getInstanceId());
config.setConfigName(n.getConfigName());
config.setConfigValue(n.getConfigValue());
@@ -62,10 +64,10 @@
@EmLog(OprTarget = "store", OprType = "UpdateConfigs")
- public void logUpdateStoreConfigs(UpdateConfigsLog updateConfigsLog, List<ChangeConfigEntity> changeConfigEntityList) {
- changeConfigEntityList.forEach(n -> {
+ public void logUpdateStoreConfigs(UpdateConfigsLog updateConfigsLog, List<ChangeConfigDTO> changeConfigDTOList) {
+ changeConfigDTOList.forEach(n -> {
ConfigEntity config = new ConfigEntity();
- config.setInstanceType(1);
+ config.setInstanceType(null);
config.setInstanceId(updateConfigsLog.getInstanceId());
config.setConfigName(n.getConfigName());
config.setConfigValue(n.getConfigValue());
@@ -76,10 +78,10 @@
@EmLog(OprTarget = "Connector", OprType = "UpdateConfigs")
- public void logUpdateConnectorConfigs(UpdateConfigsLog updateConfigsLog, List<ChangeConfigEntity> changeConfigEntityList) {
- changeConfigEntityList.forEach(n -> {
+ public void logUpdateConnectorConfigs(UpdateConfigsLog updateConfigsLog, List<ChangeConfigDTO> changeConfigDTOList) {
+ changeConfigDTOList.forEach(n -> {
ConfigEntity config = new ConfigEntity();
- config.setInstanceType(2);
+ config.setInstanceType(null);
config.setInstanceId(updateConfigsLog.getInstanceId());
config.setConfigName(n.getConfigName());
config.setConfigValue(n.getConfigValue());
@@ -90,10 +92,10 @@
@EmLog(OprTarget = "Topic", OprType = "UpdateConfigs")
- public void logUpdateTopicConfigs(UpdateConfigsLog updateConfigsLog, List<ChangeConfigEntity> changeConfigEntityList) {
- changeConfigEntityList.forEach(n -> {
+ public void logUpdateTopicConfigs(UpdateConfigsLog updateConfigsLog, List<ChangeConfigDTO> changeConfigDTOList) {
+ changeConfigDTOList.forEach(n -> {
ConfigEntity config = new ConfigEntity();
- config.setInstanceType(3);
+ config.setInstanceType(null);
config.setInstanceId(updateConfigsLog.getInstanceId());
config.setConfigName(n.getConfigName());
config.setConfigValue(n.getConfigValue());
@@ -104,40 +106,51 @@
@Override
public void updateConfigsByInstanceId(String name, Long clusterId, Integer instanceType, Long instanceId,
- List<ChangeConfigEntity> changeConfigEntityList) {
+ List<ChangeConfigDTO> changeConfigDTOList) {
ConcurrentHashMap<String, String> stringStringConcurrentHashMap = new ConcurrentHashMap<>();
- changeConfigEntityList.forEach(n -> {
+ changeConfigDTOList.forEach(n -> {
stringStringConcurrentHashMap.put(n.getConfigName(), n.getConfigValue());
});
- UpdateConfigsLog updateConfigsLog = new UpdateConfigsLog();
- updateConfigsLog.setInstanceId(instanceId);
- updateConfigsLog.setClusterId(clusterId);
- updateConfigsLog.setName(name);
- updateConfigsLog.setConfigProperties(this.mapToProperties(stringStringConcurrentHashMap));
+ UpdateConfigsLog updateConfigsLog =
+ new UpdateConfigsLog(instanceId, clusterId, name, this.mapToProperties(stringStringConcurrentHashMap));
ConfigServiceImpl service = (ConfigServiceImpl) AopContext.currentProxy();
if (instanceType == 0) {
- service.logUpdateRuntimeConfigs(updateConfigsLog, changeConfigEntityList);
+ service.logUpdateRuntimeConfigs(updateConfigsLog, changeConfigDTOList);
} else if (instanceType == 1) {
- service.logUpdateStoreConfigs(updateConfigsLog, changeConfigEntityList);
+ service.logUpdateStoreConfigs(updateConfigsLog, changeConfigDTOList);
} else if (instanceType == 2) {
- service.logUpdateConnectorConfigs(updateConfigsLog, changeConfigEntityList);
+ service.logUpdateConnectorConfigs(updateConfigsLog, changeConfigDTOList);
} else if (instanceType == 3) {
- service.logUpdateTopicConfigs(updateConfigsLog, changeConfigEntityList);
+ service.logUpdateTopicConfigs(updateConfigsLog, changeConfigDTOList);
}
}
@Override
+ public List<ConfigEntity> queryByClusterAndInstanceId(ConfigEntity configEntity) {
+ return null;
+ }
+
+ @Override
public List<ConfigEntity> selectAll() {
return configMapper.selectAll();
}
@Override
- public Integer batchInsert(List<ConfigEntity> configEntityList) {
- return configMapper.batchInsert(configEntityList);
+ public void batchInsert(List<ConfigEntity> configEntityList) {
+ configMapper.batchInsert(configEntityList);
}
@Override
+ public void copyConfig(Long sourceId, Long targetId) {
+ configMapper.copyConfig(sourceId, targetId);
+ }
+
+ @Override
+ public void restoreConfig(Long sourceId, Long targetId) {
+
+ }
+
public String mapToYaml(Map<String, String> stringMap) {
Yaml yaml = new Yaml();
return yaml.dumpAsMap(stringMap);
@@ -165,9 +178,9 @@
return stringStringConcurrentHashMap;
}
- @Override
- public void insertConfig(ConfigEntity configEntity) {
- configMapper.insertConfig(configEntity);
+
+ public Integer addConfig(ConfigEntity configEntity) {
+ return configMapper.addConfig(configEntity);
}
@Override
@@ -179,31 +192,47 @@
public List<ConfigEntity> selectByInstanceIdAndType(Long instanceId, Integer type) {
ConfigEntity config = new ConfigEntity();
config.setInstanceId(instanceId);
- config.setInstanceType(type);
+ config.setInstanceType(null);
return configMapper.selectByInstanceId(config);
}
-
- @Override
- public List<ConfigEntity> selectToFront(ConfigEntity config) {
- return configMapper.selectConfigsToFrontWithDynamic(config);
+ public ConfigEntity setSearchCriteria(GetConfigsListDTO getConfigsListDTO, ConfigEntity configEntity) {
+ if (getConfigsListDTO != null) {
+ if (getConfigsListDTO.getConfigName() != null) {
+ configEntity.setConfigName(getConfigsListDTO.getConfigName());
+ }
+ if (getConfigsListDTO.getIsModify() != null) {
+ configEntity.setIsModify(getConfigsListDTO.getIsModify());
+ }
+ if (getConfigsListDTO.getAlreadyUpdate() != null) {
+ configEntity.setAlreadyUpdate(getConfigsListDTO.getAlreadyUpdate());
+ }
+ }
+ return configEntity;
}
- public void insertDefaultConfigToCache() {
+ @Override
+ public List<ConfigEntity> selectToFront(Long instanceId, Integer type, GetConfigsListDTO getConfigsListDTO) {
+ ConfigEntity config = new ConfigEntity();
+ config.setInstanceId(instanceId);
+ config.setInstanceType(null);
+ config = this.setSearchCriteria(getConfigsListDTO, config);
+ return configMapper.getConfigsToFrontWithDynamic(config);
+ }
+
+ public void addDefaultConfigToCache() {
List<ConfigEntity> configEntityList = configMapper.selectAllDefaultConfig();
configEntityList.forEach(n -> {
- DefaultConfigKey defaultConfigKey = new DefaultConfigKey();
- defaultConfigKey.setConfigName(n.getConfigName());
- defaultConfigKey.setBusinessType(n.getBusinessType());
+ DefaultConfigKey defaultConfigKey = new DefaultConfigKey(n.getBusinessType(), n.getConfigName());
defaultConfigCache.putIfAbsent(defaultConfigKey, n.getConfigValue());
});
}
@Override
- public Map<String, String> selectDefaultConfig(String businessType) {
+ public Map<String, String> selectDefaultConfig(String businessType, Long instanceId, Integer instanceType) {
if (defaultConfigCache.size() == 0) {
- this.insertDefaultConfigToCache();
+ this.addDefaultConfigToCache();
}
ConcurrentHashMap<String, String> stringStringConcurrentHashMap = new ConcurrentHashMap<>();
defaultConfigCache.forEach((k, v) -> {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java
index 2b315ae..973e582 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.function.Impl;
import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
@@ -48,14 +49,14 @@
@Override
- public InstanceLiveProportionVo selectInstanceLiveProportion(Long clusterId, Integer instanceType) {
+ public InstanceLiveProportionVo getInstanceLiveProportion(Long clusterId, Integer instanceType) {
InstanceLiveProportionVo instanceLiveProportionVo = new InstanceLiveProportionVo();
switch (instanceType) {
case 2:
- instanceLiveProportionVo = this.selectRuntimeLiveProportion(clusterId);
+ instanceLiveProportionVo = this.getRuntimeLiveProportion(clusterId);
break;
case 3:
- instanceLiveProportionVo = this.selectTopicLiveProportion(clusterId);
+ instanceLiveProportionVo = this.getTopicLiveProportion(clusterId);
break;
default:
break;
@@ -63,7 +64,7 @@
return instanceLiveProportionVo;
}
- public InstanceLiveProportionVo selectTopicLiveProportion(Long clusterId) {
+ public InstanceLiveProportionVo getTopicLiveProportion(Long clusterId) {
TopicEntity topicEntity = new TopicEntity();
topicEntity.setClusterId(clusterId);
Integer topicNum = topicMapper.selectTopicNumByCluster(topicEntity);
@@ -74,17 +75,14 @@
abnormalNum++;
}
}
- InstanceLiveProportionVo instanceLiveProportionVo = new InstanceLiveProportionVo();
- instanceLiveProportionVo.setAbnormalNum(abnormalNum);
- instanceLiveProportionVo.setAllNum(topicNum);
- return instanceLiveProportionVo;
+ return new InstanceLiveProportionVo(abnormalNum, topicNum);
}
- public InstanceLiveProportionVo selectRuntimeLiveProportion(Long clusterId) {
+ public InstanceLiveProportionVo getRuntimeLiveProportion(Long clusterId) {
RuntimeEntity runtimeEntity = new RuntimeEntity();
runtimeEntity.setClusterId(clusterId);
- Integer topicNum = runtimeMapper.selectRuntimeNumByCluster(runtimeEntity);
+ Integer topicNum = runtimeMapper.getRuntimeNumByCluster(runtimeEntity);
List<RuntimeEntity> runtimeEntities = runtimeMapper.selectRuntimeByCluster(runtimeEntity);
int abnormalNum = 0;
for (RuntimeEntity n : runtimeEntities) {
@@ -92,15 +90,12 @@
abnormalNum++;
}
}
- InstanceLiveProportionVo instanceLiveProportionVo = new InstanceLiveProportionVo();
- instanceLiveProportionVo.setAbnormalNum(abnormalNum);
- instanceLiveProportionVo.setAllNum(topicNum);
- return instanceLiveProportionVo;
+ return new InstanceLiveProportionVo(abnormalNum, topicNum);
}
@Override
- public List<HealthCheckResultEntity> selectInstanceLiveStatusHistory(Integer type, Long instanceId, LocalDateTime startTime) {
+ public List<HealthCheckResultEntity> getInstanceLiveStatusHistory(Integer type, Long instanceId, LocalDateTime startTime) {
HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity();
healthCheckResultEntity.setType(type);
healthCheckResultEntity.setTypeId(instanceId);
@@ -115,19 +110,19 @@
}
@Override
- public Integer batchInsertHealthCheckResult(List<HealthCheckResultEntity> healthCheckResultEntityList) {
+ public void batchInsertHealthCheckResult(List<HealthCheckResultEntity> healthCheckResultEntityList) {
if (healthCheckResultEntityList.isEmpty()) {
- return 0;
+ return;
}
- return healthCheckResultMapper.batchInsert(healthCheckResultEntityList);
+ healthCheckResultMapper.batchInsert(healthCheckResultEntityList);
}
@Override
- public Integer batchInsertNewCheckResult(List<HealthCheckResultEntity> healthCheckResultEntityList) {
+ public void batchInsertNewCheckResult(List<HealthCheckResultEntity> healthCheckResultEntityList) {
if (healthCheckResultEntityList.isEmpty()) {
- return 0;
+ return;
}
- return healthCheckResultMapper.insertNewChecks(healthCheckResultEntityList);
+ healthCheckResultMapper.insertNewChecks(healthCheckResultEntityList);
}
@Override
@@ -141,8 +136,8 @@
}
@Override
- public Integer batchUpdateCheckResult(List<HealthCheckResultEntity> healthCheckResultEntityList) {
- return healthCheckResultMapper.batchUpdate(healthCheckResultEntityList);
+ public void batchUpdateCheckResult(List<HealthCheckResultEntity> healthCheckResultEntityList) {
+ healthCheckResultMapper.batchUpdate(healthCheckResultEntityList);
}
@Override
@@ -150,7 +145,7 @@
if (healthCheckResultEntityList.isEmpty()) {
return;
}
- List<HealthCheckResultEntity> entitiesNeedToBeUpdate = healthCheckResultMapper.selectIdsNeedToBeUpdateByClusterIdAndTypeAndTypeId(
+ List<HealthCheckResultEntity> entitiesNeedToBeUpdate = healthCheckResultMapper.getIdsNeedToBeUpdateByClusterIdAndTypeAndTypeId(
healthCheckResultEntityList);
if (entitiesNeedToBeUpdate.isEmpty()) {
return;
@@ -159,7 +154,7 @@
healthCheckResultEntityList.forEach(updateEntity -> {
if (entity.getClusterId().equals(updateEntity.getClusterId()) && entity.getType().equals(updateEntity.getType())
&& entity.getTypeId().equals(updateEntity.getTypeId())) {
- entity.setState(updateEntity.getState());
+ entity.setStatus(updateEntity.getStatus());
entity.setResultDesc(updateEntity.getResultDesc());
}
});
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/LogServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/LogServiceImpl.java
index cc4ea33..b2a320d 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/LogServiceImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/LogServiceImpl.java
@@ -15,10 +15,12 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.function.Impl;
import org.apache.eventmesh.dashboard.console.entity.function.LogEntity;
import org.apache.eventmesh.dashboard.console.mapper.function.OprLogMapper;
+import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO;
import org.apache.eventmesh.dashboard.console.service.function.LogService;
import java.util.List;
@@ -33,14 +35,20 @@
OprLogMapper oprLogMapper;
@Override
- public List<LogEntity> selectLogListByCluster(LogEntity logEntity) {
- return oprLogMapper.selectLogListToFront(logEntity);
+ public List<LogEntity> getLogListByCluster(GetLogListDTO getLogListDTO) {
+ LogEntity logEntity = new LogEntity();
+ logEntity.setClusterId(getLogListDTO.getClusterId());
+ logEntity.setTargetType(getLogListDTO.getTargetType());
+ logEntity.setOperationType(getLogListDTO.getOperationType());
+ logEntity.setState(getLogListDTO.getState());
+ logEntity.setOperationUser(getLogListDTO.getOperationUser());
+ return oprLogMapper.getLogListToFront(logEntity);
}
@Override
- public void insertLog(LogEntity logEntity) {
+ public Long addLog(LogEntity logEntity) {
- oprLogMapper.insertLog(logEntity);
+ return oprLogMapper.addLog(logEntity);
}
@Override
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/MetadataSyncResultServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/MetadataSyncResultServiceImpl.java
new file mode 100644
index 0000000..60b7809
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/MetadataSyncResultServiceImpl.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.service.function.Impl;
+
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.entity.function.MetadataSyncResultEntity;
+import org.apache.eventmesh.dashboard.console.service.function.MetadataSyncResultService;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class MetadataSyncResultServiceImpl implements MetadataSyncResultService {
+
+ @Override
+ public void bachMetadataSyncResult(List<MetadataSyncResultEntity> healthCheckResultEntityList, List<RuntimeEntity> runtimeList,
+ List<ClusterEntity> clusterEntityList) {
+
+ }
+
+ @Override
+ public List<MetadataSyncResultEntity> queueHealthCheckResultEntityList(MetadataSyncResultEntity healthCheckResultEntity) {
+ return Collections.emptyList();
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/LogService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/LogService.java
index dd9b993..454ad53 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/LogService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/LogService.java
@@ -15,10 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.function;
import org.apache.eventmesh.dashboard.console.entity.function.LogEntity;
-
+import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO;
import java.util.List;
@@ -31,9 +32,9 @@
@Service
public interface LogService {
- List<LogEntity> selectLogListByCluster(LogEntity logEntity);
+ List<LogEntity> getLogListByCluster(GetLogListDTO getLogListDTO);
- void insertLog(LogEntity logEntity);
+ Long addLog(LogEntity logEntity);
Integer updateLog(LogEntity logEntity);
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/MetadataSyncResultService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/MetadataSyncResultService.java
new file mode 100644
index 0000000..756e247
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/MetadataSyncResultService.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.service.function;
+
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.entity.function.MetadataSyncResultEntity;
+
+import java.util.List;
+
+
+/**
+ *
+ */
+public interface MetadataSyncResultService {
+
+
+ void bachMetadataSyncResult(List<MetadataSyncResultEntity> healthCheckResultEntityList, List<RuntimeEntity> runtimeList,
+ List<ClusterEntity> clusterEntityList);
+
+
+ List<MetadataSyncResultEntity> queueHealthCheckResultEntityList(MetadataSyncResultEntity healthCheckResultEntity);
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupMemberService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupMemberService.java
index a92cc34..1071001 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupMemberService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupMemberService.java
@@ -15,10 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.message;
import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity;
-import org.apache.eventmesh.dashboard.console.entity.message.GroupMemberEntity;
+import org.apache.eventmesh.dashboard.console.entity.message.SubscriptionEntity;
import java.util.List;
@@ -27,22 +28,22 @@
*/
public interface GroupMemberService {
- List<GroupMemberEntity> selectAll();
+ List<SubscriptionEntity> selectAll();
- Integer batchInsert(List<GroupMemberEntity> groupMemberEntities);
+ void batchInsert(List<SubscriptionEntity> groupMemberEntities);
- List<GroupMemberEntity> selectGroupMemberByClusterId(GroupMemberEntity groupMemberEntity);
+ List<SubscriptionEntity> getGroupMemberByClusterId(SubscriptionEntity subscriptionEntity);
- void insertGroupMember(GroupMemberEntity groupMemberEntity);
+ void addGroupMember(SubscriptionEntity subscriptionEntity);
- Integer updateGroupMember(GroupMemberEntity groupMemberEntity);
+ void updateGroupMember(SubscriptionEntity subscriptionEntity);
- Integer deleteGroupMember(GroupMemberEntity groupMemberEntity);
+ SubscriptionEntity deleteGroupMember(SubscriptionEntity subscriptionEntity);
- GroupMemberEntity selectGroupMemberById(GroupMemberEntity groupMemberEntity);
+ SubscriptionEntity selectGroupMemberById(SubscriptionEntity subscriptionEntity);
- List<GroupMemberEntity> selectGroupMemberByGroup(GroupEntity groupEntity);
+ List<SubscriptionEntity> selectGroupMemberByGroup(GroupEntity groupEntity);
- List<GroupMemberEntity> selectAllMemberByTopic(GroupMemberEntity groupMemberEntity);
+ List<SubscriptionEntity> selectAllMemberByTopic(SubscriptionEntity subscriptionEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupService.java
index a2bd08f..3d5b7a1 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupService.java
@@ -15,10 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.message;
import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity;
-import org.apache.eventmesh.dashboard.console.entity.message.GroupMemberEntity;
+import org.apache.eventmesh.dashboard.console.entity.message.SubscriptionEntity;
import java.util.List;
@@ -28,21 +29,26 @@
public interface GroupService {
+ @Deprecated
List<GroupEntity> selectAll();
- Integer batchInsert(List<GroupEntity> groupEntities);
+ void batchInsert(List<GroupEntity> groupEntities);
- List<GroupEntity> selectGroupByClusterId(GroupEntity groupEntity);
+ List<GroupEntity> getGroupByClusterId(GroupEntity groupEntity);
- void insertGroup(GroupEntity groupEntity);
+ void addGroup(GroupEntity groupEntity);
+ @Deprecated
void updateGroup(GroupEntity groupEntity);
Integer deleteGroup(GroupEntity groupEntity);
+ @Deprecated
GroupEntity selectGroup(GroupEntity groupEntity);
- Integer insertMemberToGroup(GroupMemberEntity groupMemberEntity);
+ @Deprecated
+ Integer insertMemberToGroup(SubscriptionEntity subscriptionEntity);
- Integer deleteMemberFromGroup(GroupMemberEntity groupMemberEntity);
+ @Deprecated
+ Integer deleteMemberFromGroup(SubscriptionEntity subscriptionEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/TopicService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/TopicService.java
index 714be9d..94446aa 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/TopicService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/TopicService.java
@@ -15,8 +15,10 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.message;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity;
import org.apache.eventmesh.dashboard.console.modle.vo.topic.TopicDetailGroupVO;
@@ -27,25 +29,28 @@
*/
public interface TopicService {
- List<TopicDetailGroupVO> selectTopicDetailGroups(Long topicId);
+ List<TopicDetailGroupVO> getTopicDetailGroups(Long topicId);
void createTopic(TopicEntity topicEntity);
+
void batchInsert(List<TopicEntity> topicEntities);
+ List<RuntimeEntity> queryRuntimeByBaseSyncEntity(List<TopicEntity> topicName);
+
List<TopicEntity> selectAll();
- void insertTopic(TopicEntity topicEntity);
+ void addTopic(TopicEntity topicEntity);
- Integer updateTopic(TopicEntity topicEntity);
+ void updateTopic(TopicEntity topicEntity);
- void deleteTopicById(TopicEntity topicEntity);
+ Integer deleteTopicById(TopicEntity topicEntity);
TopicEntity selectTopicById(TopicEntity topicEntity);
- Integer deleteTopic(TopicEntity topicEntity);
+ Integer deleteTopicByRuntimeIdAndTopicName(List<TopicEntity> topicEntity);
List<TopicEntity> selectTopiByCluster(TopicEntity topicEntity);
- List<TopicEntity> selectTopicListToFront(TopicEntity topicEntity);
+ List<TopicEntity> getTopicListToFront(TopicEntity topicEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupMemberServiceImp.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupMemberServiceImp.java
index bbb46b3..b3c6a80 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupMemberServiceImp.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupMemberServiceImp.java
@@ -15,11 +15,12 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.message.impl;
import org.apache.eventmesh.dashboard.console.annotation.EmLog;
import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity;
-import org.apache.eventmesh.dashboard.console.entity.message.GroupMemberEntity;
+import org.apache.eventmesh.dashboard.console.entity.message.SubscriptionEntity;
import org.apache.eventmesh.dashboard.console.mapper.message.OprGroupMemberMapper;
import org.apache.eventmesh.dashboard.console.service.message.GroupMemberService;
@@ -35,54 +36,54 @@
OprGroupMemberMapper oprGroupMemberMapper;
@Override
- public List<GroupMemberEntity> selectAll() {
+ public List<SubscriptionEntity> selectAll() {
return oprGroupMemberMapper.selectAll();
}
@Override
- public Integer batchInsert(List<GroupMemberEntity> groupMemberEntities) {
- return oprGroupMemberMapper.batchInsert(groupMemberEntities);
+ public void batchInsert(List<SubscriptionEntity> groupMemberEntities) {
+ oprGroupMemberMapper.batchInsert(groupMemberEntities);
}
@Override
@EmLog(OprType = "View", OprTarget = "GroupMember")
- public List<GroupMemberEntity> selectGroupMemberByClusterId(GroupMemberEntity groupMemberEntity) {
- return oprGroupMemberMapper.selectGroupByClusterId(groupMemberEntity);
+ public List<SubscriptionEntity> getGroupMemberByClusterId(SubscriptionEntity subscriptionEntity) {
+ return oprGroupMemberMapper.getGroupByClusterId(subscriptionEntity);
}
@Override
@EmLog(OprType = "add", OprTarget = "GroupMember")
- public void insertGroupMember(GroupMemberEntity groupMemberEntity) {
- oprGroupMemberMapper.insertGroupMember(groupMemberEntity);
+ public void addGroupMember(SubscriptionEntity subscriptionEntity) {
+ oprGroupMemberMapper.addGroupMember(subscriptionEntity);
}
@Override
- public Integer updateGroupMember(GroupMemberEntity groupMemberEntity) {
- return oprGroupMemberMapper.updateGroupMember(groupMemberEntity);
+ public void updateGroupMember(SubscriptionEntity subscriptionEntity) {
+ oprGroupMemberMapper.updateGroupMember(subscriptionEntity);
}
@Override
- public Integer deleteGroupMember(GroupMemberEntity groupMemberEntity) {
- return oprGroupMemberMapper.deleteGroupMember(groupMemberEntity);
+ public SubscriptionEntity deleteGroupMember(SubscriptionEntity subscriptionEntity) {
+ return oprGroupMemberMapper.deleteGroupMember(subscriptionEntity);
}
@Override
- public GroupMemberEntity selectGroupMemberById(GroupMemberEntity groupMemberEntity) {
- return oprGroupMemberMapper.selectGroupMemberById(groupMemberEntity);
+ public SubscriptionEntity selectGroupMemberById(SubscriptionEntity subscriptionEntity) {
+ return oprGroupMemberMapper.selectGroupMemberById(subscriptionEntity);
}
@Override
- public List<GroupMemberEntity> selectGroupMemberByGroup(GroupEntity groupEntity) {
- GroupMemberEntity groupMemberEntity = new GroupMemberEntity();
- groupMemberEntity.setGroupName(groupEntity.getName());
- groupMemberEntity.setClusterId(groupEntity.getClusterId());
+ public List<SubscriptionEntity> selectGroupMemberByGroup(GroupEntity groupEntity) {
+ SubscriptionEntity subscriptionEntity = new SubscriptionEntity();
+ subscriptionEntity.setGroupName(groupEntity.getName());
+ subscriptionEntity.setClusterId(groupEntity.getClusterId());
//Obtain a member who meets the conditions of a group
- return oprGroupMemberMapper.selectMember(groupMemberEntity);
+ return oprGroupMemberMapper.selectMember(subscriptionEntity);
}
@Override
- public List<GroupMemberEntity> selectAllMemberByTopic(GroupMemberEntity groupMemberEntity) {
- List<GroupMemberEntity> groupMemberEntities = oprGroupMemberMapper.selectMember(groupMemberEntity);
+ public List<SubscriptionEntity> selectAllMemberByTopic(SubscriptionEntity subscriptionEntity) {
+ List<SubscriptionEntity> groupMemberEntities = oprGroupMemberMapper.selectMember(subscriptionEntity);
return groupMemberEntities;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupServiceImpl.java
index 4199715..6c74490 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupServiceImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupServiceImpl.java
@@ -15,12 +15,13 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.message.impl;
import org.apache.eventmesh.dashboard.console.annotation.EmLog;
import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity;
-import org.apache.eventmesh.dashboard.console.entity.message.GroupMemberEntity;
-import org.apache.eventmesh.dashboard.console.mapper.message.OprGroupMapper;
+import org.apache.eventmesh.dashboard.console.entity.message.SubscriptionEntity;
+import org.apache.eventmesh.dashboard.console.mapper.message.GroupMapper;
import org.apache.eventmesh.dashboard.console.service.message.GroupMemberService;
import org.apache.eventmesh.dashboard.console.service.message.GroupService;
@@ -34,78 +35,78 @@
public class GroupServiceImpl implements GroupService {
@Autowired
- private OprGroupMapper oprGroupMapper;
+ private GroupMapper groupMapper;
@Autowired
private GroupMemberService groupMemberService;
@Override
public List<GroupEntity> selectAll() {
- return oprGroupMapper.selectAll();
+ return groupMapper.selectAll();
}
@Override
- public Integer batchInsert(List<GroupEntity> groupEntities) {
- return oprGroupMapper.batchInsert(groupEntities);
+ public void batchInsert(List<GroupEntity> groupEntities) {
+ groupMapper.batchInsert(groupEntities);
}
@EmLog(OprType = "search", OprTarget = "Group")
@Override
- public List<GroupEntity> selectGroupByClusterId(GroupEntity groupEntity) {
- return oprGroupMapper.selectGroup(groupEntity);
+ public List<GroupEntity> getGroupByClusterId(GroupEntity groupEntity) {
+ return groupMapper.selectGroup(groupEntity);
}
@EmLog(OprType = "add", OprTarget = "Group")
@Override
- public void insertGroup(GroupEntity groupEntity) {
- oprGroupMapper.insertGroup(groupEntity);
+ public void addGroup(GroupEntity groupEntity) {
+ groupMapper.addGroup(groupEntity);
}
@Override
public void updateGroup(GroupEntity groupEntity) {
- oprGroupMapper.updateGroup(groupEntity);
+ groupMapper.updateGroup(groupEntity);
}
@Override
public Integer deleteGroup(GroupEntity groupEntity) {
- return oprGroupMapper.deleteGroup(groupEntity);
+ return groupMapper.deleteGroup(groupEntity);
}
@Override
public GroupEntity selectGroup(GroupEntity groupEntity) {
- return oprGroupMapper.selectGroupById(groupEntity);
+ return groupMapper.selectGroupById(groupEntity);
}
@Override
- public Integer insertMemberToGroup(GroupMemberEntity groupMemberEntity) {
- groupMemberService.insertGroupMember(groupMemberEntity);
+ public Integer insertMemberToGroup(SubscriptionEntity subscriptionEntity) {
+ groupMemberService.addGroupMember(subscriptionEntity);
GroupEntity groupEntity = new GroupEntity();
- groupEntity.setName(groupMemberEntity.getGroupName());
- groupEntity.setClusterId(groupMemberEntity.getClusterId());
- GroupEntity groupEntity1 = oprGroupMapper.selectGroupByUnique(groupEntity);
+ groupEntity.setName(subscriptionEntity.getGroupName());
+ groupEntity.setClusterId(subscriptionEntity.getClusterId());
+ GroupEntity groupEntity1 = groupMapper.selectGroupByUnique(groupEntity);
//^Obtain the group to which the member belongs
- groupEntity1.setMembers(groupMemberEntity.getId() + "" + "," + groupEntity1.getMembers());
+ groupEntity1.setMembers(subscriptionEntity.getId() + "" + "," + groupEntity1.getMembers());
//Concatenate the members of the group
groupEntity1.setMemberCount(groupEntity1.getMemberCount() + 1);
groupEntity1.setUpdateTime(LocalDateTime.now());
- oprGroupMapper.updateGroup(groupEntity1);
+ groupMapper.updateGroup(groupEntity1);
return 1;
//Modify the group member information
}
@Override
- public Integer deleteMemberFromGroup(GroupMemberEntity groupMemberEntity) {
- groupMemberService.deleteGroupMember(groupMemberEntity);
+ public Integer deleteMemberFromGroup(SubscriptionEntity subscriptionEntity) {
+ groupMemberService.deleteGroupMember(subscriptionEntity);
GroupEntity groupEntity = new GroupEntity();
- groupEntity.setName(groupMemberEntity.getGroupName());
- groupEntity.setClusterId(groupMemberEntity.getClusterId());
- GroupEntity groupEntity1 = oprGroupMapper.selectGroupByUnique(groupEntity);
+ groupEntity.setName(subscriptionEntity.getGroupName());
+ groupEntity.setClusterId(subscriptionEntity.getClusterId());
+ GroupEntity groupEntity1 = groupMapper.selectGroupByUnique(groupEntity);
//^Obtain the group to which the member belongs
- groupEntity1.setMembers(groupEntity1.getMembers().replaceAll(groupMemberEntity.getId() + "" + ",", ""));
+ groupEntity1.setMembers(groupEntity1.getMembers().replaceAll(subscriptionEntity.getId() + "" + ",", ""));
groupEntity1.setMemberCount(groupEntity1.getMemberCount() - 1);
groupEntity1.setUpdateTime(LocalDateTime.now());
- oprGroupMapper.updateGroup(groupEntity1);
+ groupMapper.updateGroup(groupEntity1);
return 1;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/TopicServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/TopicServiceImpl.java
index 45f5c4c..ec47164 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/TopicServiceImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/TopicServiceImpl.java
@@ -15,21 +15,22 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.message.impl;
import org.apache.eventmesh.dashboard.console.annotation.EmLog;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity;
-import org.apache.eventmesh.dashboard.console.entity.message.GroupMemberEntity;
+import org.apache.eventmesh.dashboard.console.entity.message.SubscriptionEntity;
import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity;
-import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache;
import org.apache.eventmesh.dashboard.console.mapper.cluster.RuntimeMapper;
import org.apache.eventmesh.dashboard.console.mapper.function.ConfigMapper;
import org.apache.eventmesh.dashboard.console.mapper.function.HealthCheckResultMapper;
-import org.apache.eventmesh.dashboard.console.mapper.message.OprGroupMapper;
+import org.apache.eventmesh.dashboard.console.mapper.message.GroupMapper;
import org.apache.eventmesh.dashboard.console.mapper.message.OprGroupMemberMapper;
import org.apache.eventmesh.dashboard.console.mapper.message.TopicMapper;
-import org.apache.eventmesh.dashboard.console.mapper.storage.StoreMapper;
+import org.apache.eventmesh.dashboard.console.modle.dto.topic.GetTopicListDTO;
import org.apache.eventmesh.dashboard.console.modle.vo.topic.TopicDetailGroupVO;
import org.apache.eventmesh.dashboard.console.service.message.TopicService;
@@ -58,35 +59,32 @@
RuntimeMapper runtimeMapper;
@Autowired
- StoreMapper storeMapper;
-
- @Autowired
- OprGroupMapper groupMapper;
+ GroupMapper groupMapper;
@Override
- public List<TopicDetailGroupVO> selectTopicDetailGroups(Long topicId) {
+ public List<TopicDetailGroupVO> getTopicDetailGroups(Long topicId) {
TopicEntity topicEntity = new TopicEntity();
topicEntity.setId(topicId);
topicEntity = this.selectTopicById(topicEntity);
- GroupMemberEntity groupMemberEntity = new GroupMemberEntity();
- groupMemberEntity.setClusterId(topicEntity.getClusterId());
- groupMemberEntity.setTopicName(topicEntity.getTopicName());
- List<String> groupNamelist = oprGroupMemberMapper.selectGroupNameByTopicName(groupMemberEntity);
+ SubscriptionEntity subscriptionEntity = new SubscriptionEntity();
+ subscriptionEntity.setClusterId(topicEntity.getClusterId());
+ subscriptionEntity.setTopicName(topicEntity.getTopicName());
+ List<String> groupNamelist = oprGroupMemberMapper.selectGroupNameByTopicName(subscriptionEntity);
ArrayList<TopicDetailGroupVO> topicDetailGroupVOList = new ArrayList<>();
TopicEntity finalTopicEntity = topicEntity;
groupNamelist.forEach(n -> {
TopicDetailGroupVO topicDetailGroupVO = new TopicDetailGroupVO();
topicDetailGroupVO.setGroupName(n);
- groupMemberEntity.setGroupName(n);
- List<String> list = oprGroupMemberMapper.selectTopicsByGroupNameAndClusterId(groupMemberEntity);
+ subscriptionEntity.setGroupName(n);
+ List<String> list = oprGroupMemberMapper.selectTopicsByGroupNameAndClusterId(subscriptionEntity);
topicDetailGroupVO.setTopics(list);
GroupEntity groupEntity = new GroupEntity();
groupEntity.setClusterId(finalTopicEntity.getClusterId());
groupEntity.setName(n);
GroupEntity group = groupMapper.selectGroupByNameAndClusterId(groupEntity);
topicDetailGroupVO.setMemberNum(group.getMemberCount());
- topicDetailGroupVO.setState(group.getState());
+
topicDetailGroupVOList.add(topicDetailGroupVO);
});
return topicDetailGroupVOList;
@@ -99,11 +97,18 @@
topicMapper.insertTopic(topicEntity);
}
+
@Override
public void batchInsert(List<TopicEntity> topicEntities) {
topicMapper.batchInsert(topicEntities);
}
+ public List<RuntimeEntity> queryRuntimeByBaseSyncEntity(List<TopicEntity> topicName) {
+
+ return null;
+ }
+
+
@Override
public List<TopicEntity> selectAll() {
return topicMapper.selectAll();
@@ -111,33 +116,32 @@
@Override
- public void insertTopic(TopicEntity topicEntity) {
- GroupMemberEntity groupMemberEntity = new GroupMemberEntity();
- groupMemberEntity.setTopicName(topicEntity.getTopicName());
- groupMemberEntity.setState("active");
- oprGroupMemberMapper.updateMemberByTopic(groupMemberEntity);
+ public void addTopic(TopicEntity topicEntity) {
+ SubscriptionEntity subscriptionEntity = new SubscriptionEntity();
+ subscriptionEntity.setTopicName(topicEntity.getTopicName());
+ oprGroupMemberMapper.updateMemberByTopic(subscriptionEntity);
topicMapper.insertTopic(topicEntity);
}
@Override
- public Integer updateTopic(TopicEntity topicEntity) {
- return topicMapper.updateTopic(topicEntity);
+ public void updateTopic(TopicEntity topicEntity) {
+ topicMapper.updateTopic(topicEntity);
}
@Override
- public void deleteTopicById(TopicEntity topicEntity) {
- topicMapper.deleteTopic(topicEntity);
+ public Integer deleteTopicById(TopicEntity topicEntity) {
+ return topicMapper.deleteTopicById(topicEntity);
}
@Override
public TopicEntity selectTopicById(TopicEntity topicEntity) {
- return topicMapper.selectTopicById(topicEntity);
+ return topicMapper.queryTopicById(topicEntity);
}
@Override
- public Integer deleteTopic(TopicEntity topicEntity) {
- return topicMapper.deleteTopic(topicEntity);
+ public Integer deleteTopicByRuntimeIdAndTopicName(List<TopicEntity> topicEntity) {
+ return topicMapper.deleteTopicByIds(topicEntity);
}
@Override
@@ -145,12 +149,15 @@
return topicMapper.selectTopicByCluster(topicEntity);
}
+
+ public TopicEntity setSearchCriteria(GetTopicListDTO getTopicListDTO, TopicEntity topicEntity) {
+ topicEntity.setTopicName(getTopicListDTO.getTopicName());
+ return topicEntity;
+ }
+
@Override
- public List<TopicEntity> selectTopicListToFront(TopicEntity topicEntity) {
+ public List<TopicEntity> getTopicListToFront(TopicEntity topicEntity) {
List<TopicEntity> topicEntityList = topicMapper.queryTopicsToFrontByClusterId(topicEntity);
- topicEntityList.forEach(n -> {
- n.setStatus(CheckResultCache.getINSTANCE().getLastHealthyCheckResult("topic", n.getId()));
- });
return topicEntityList;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/AbstractDBDataMetadataHandler.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/AbstractDBDataMetadataHandler.java
new file mode 100644
index 0000000..3ba3152
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/AbstractDBDataMetadataHandler.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.service.metadata;
+
+import org.apache.eventmesh.dashboard.console.entity.base.BaseRuntimeIdEntity;
+import org.apache.eventmesh.dashboard.console.mapper.SyncDataHandlerMapper;
+import org.apache.eventmesh.dashboard.core.metadata.DataMetadataHandler;
+
+import org.apache.commons.lang3.reflect.FieldUtils;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Type;
+import java.time.LocalDateTime;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+import javax.annotation.PostConstruct;
+
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.support.AbstractApplicationContext;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public abstract class AbstractDBDataMetadataHandler<T extends BaseRuntimeIdEntity> implements DataMetadataHandler<T>, ApplicationContextAware {
+
+ private static final Map<Type, Object> CLASS_SYNC_DATA_HANDLER_MAPPER_MAP = new HashMap<>();
+
+ private AbstractApplicationContext applicationContext;
+
+ private T baseRuntimeIdBase;
+
+ private SyncDataHandlerMapper<T> syncDataHandlerMapper;
+
+ /**
+ * TODO
+ * 初始化时间有问题,
+ * 1. 是否需要 check 两端数据,
+ * 1. 如果 check 第一次全量加载
+ * 2. 如果 不 check , 不需要全量加载
+ */
+ @PostConstruct
+ public void init() {
+ Type superClass = getClass().getGenericSuperclass();
+ Type type = ((ParameterizedType) superClass).getActualTypeArguments()[0];
+ try {
+ this.baseRuntimeIdBase = (T) ((Class<?>) type).newInstance();
+ LocalDateTime date = LocalDateTime.of(2000, 1, 1, 0, 0, 0, 0);
+ baseRuntimeIdBase.setUpdateTime(date);
+ if (CLASS_SYNC_DATA_HANDLER_MAPPER_MAP.isEmpty()) {
+ this.applicationContext.getBeansOfType(SyncDataHandlerMapper.class).values().forEach(syncDataHandlerMapper -> {
+ try {
+ Object proxyObject = Proxy.getInvocationHandler(syncDataHandlerMapper);
+ Class<?> mapperInterface = (Class<?>) FieldUtils.readField(proxyObject, "mapperInterface", true);
+ for (Type mapperType : mapperInterface.getGenericInterfaces()) {
+ Class<?> mapperClass = (Class<?>) ((ParameterizedType) mapperType).getRawType();
+ if (Objects.equals(mapperClass, SyncDataHandlerMapper.class)) {
+ Type syncType = ((ParameterizedType) mapperType).getActualTypeArguments()[0];
+ CLASS_SYNC_DATA_HANDLER_MAPPER_MAP.put(syncType, syncDataHandlerMapper);
+ }
+ }
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ });
+ }
+ this.syncDataHandlerMapper = (SyncDataHandlerMapper<T>) CLASS_SYNC_DATA_HANDLER_MAPPER_MAP.get(type);
+ if (Objects.isNull(syncDataHandlerMapper)) {
+ log.error("syncDataHandlerMapper is null, type is {}", type);
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+ this.applicationContext = (AbstractApplicationContext) applicationContext;
+ }
+
+ public T getEntity() {
+ return this.baseRuntimeIdBase;
+ }
+
+ public void handleAll(List<T> addData, List<T> updateData, List<T> deleteData) {
+
+ }
+
+ public List<T> getData() {
+ LocalDateTime date = LocalDateTime.now();
+ try {
+
+ //this.syncDataHandlerMapper.syncGet(this.baseRuntimeIdBase);
+ return this.doGetData();
+ } finally {
+ this.baseRuntimeIdBase.setUpdateTime(date);
+ }
+ }
+
+ abstract List<T> doGetData();
+
+
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/InstanceUserFromClusterService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/ClientDataMetadataHandler.java
similarity index 60%
copy from eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/InstanceUserFromClusterService.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/ClientDataMetadataHandler.java
index 5d6ddb8..3b53207 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/InstanceUserFromClusterService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/ClientDataMetadataHandler.java
@@ -15,11 +15,29 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.core.metadata.cluster;
+
+package org.apache.eventmesh.dashboard.console.service.metadata;
+
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClientEntity;
+
+import java.util.List;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
@Service
-public class InstanceUserFromClusterService {
+@Transactional
+public class ClientDataMetadataHandler extends AbstractDBDataMetadataHandler<ClientEntity> {
+
+ @Override
+ public void handleAll(List<ClientEntity> addData, List<ClientEntity> updateData, List<ClientEntity> deleteData) {
+
+ }
+
+
+ @Override
+ List<ClientEntity> doGetData() {
+ return List.of();
+ }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/ConfigDataMetadataHandler.java
similarity index 64%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/ConfigDataMetadataHandler.java
index 291fe8c..5366614 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/ConfigDataMetadataHandler.java
@@ -15,19 +15,24 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.connection;
+
+package org.apache.eventmesh.dashboard.console.service.metadata;
import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
+import org.apache.eventmesh.dashboard.core.metadata.DataMetadataHandler;
+import java.util.Collections;
import java.util.List;
-import lombok.Data;
+public class ConfigDataMetadataHandler implements DataMetadataHandler<ConfigEntity> {
-@Data
-public class AddConnectorConfigEntity {
+ @Override
+ public void handleAll(List<ConfigEntity> addData, List<ConfigEntity> updateData, List<ConfigEntity> deleteData) {
- private List<ConfigEntity> sinkConnectorConfigs;
+ }
- private List<ConfigEntity> sourceConnectorConfigs;
-
+ @Override
+ public List<ConfigEntity> getData() {
+ return Collections.emptyList();
+ }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/ConsumeOffsetDataMetadataHandler.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/ConsumeOffsetDataMetadataHandler.java
new file mode 100644
index 0000000..bd2123e
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/ConsumeOffsetDataMetadataHandler.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.service.metadata;
+
+import org.apache.eventmesh.dashboard.console.entity.message.ConsumeOffsetEntity;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class ConsumeOffsetDataMetadataHandler extends AbstractDBDataMetadataHandler<ConsumeOffsetEntity> {
+
+
+ @Override
+ public void handleAll(List<ConsumeOffsetEntity> addData, List<ConsumeOffsetEntity> updateData, List<ConsumeOffsetEntity> deleteData) {
+
+
+ }
+
+
+ @Override
+ List<ConsumeOffsetEntity> doGetData() {
+ return List.of();
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/InstanceUserFromClusterService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/GroupDataMetadataHandler.java
similarity index 60%
rename from eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/InstanceUserFromClusterService.java
rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/GroupDataMetadataHandler.java
index 5d6ddb8..171d299 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/InstanceUserFromClusterService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/GroupDataMetadataHandler.java
@@ -15,11 +15,30 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.core.metadata.cluster;
+
+package org.apache.eventmesh.dashboard.console.service.metadata;
+
+import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity;
+
+import java.util.List;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
@Service
-public class InstanceUserFromClusterService {
+@Transactional
+public class GroupDataMetadataHandler extends AbstractDBDataMetadataHandler<GroupEntity> {
+
+ @Override
+ public void handleAll(List<GroupEntity> addData, List<GroupEntity> updateData, List<GroupEntity> deleteData) {
+
+
+ }
+
+
+ @Override
+ List<GroupEntity> doGetData() {
+ return List.of();
+ }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/NetConnectionDataMetadataHandler.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/NetConnectionDataMetadataHandler.java
new file mode 100644
index 0000000..e7a70a4
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/NetConnectionDataMetadataHandler.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.service.metadata;
+
+import org.apache.eventmesh.dashboard.console.entity.cluster.NetConnectionEntity;
+import org.apache.eventmesh.dashboard.core.metadata.DataMetadataHandler;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class NetConnectionDataMetadataHandler implements DataMetadataHandler<NetConnectionEntity> {
+
+ @Override
+ public void handleAll(List<NetConnectionEntity> addData, List<NetConnectionEntity> updateData, List<NetConnectionEntity> deleteData) {
+
+ }
+
+ @Override
+ public List<NetConnectionEntity> getData() {
+ return Collections.emptyList();
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/RuntimeDataMetadataHandler.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/RuntimeDataMetadataHandler.java
new file mode 100644
index 0000000..bc1efe1
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/RuntimeDataMetadataHandler.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.service.metadata;
+
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.mapper.cluster.RuntimeMapper;
+import org.apache.eventmesh.dashboard.core.metadata.DataMetadataHandler;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class RuntimeDataMetadataHandler implements DataMetadataHandler<RuntimeEntity> {
+
+ private RuntimeMapper runtimeMapper;
+
+ @Override
+ public void handleAll(List<RuntimeEntity> addData, List<RuntimeEntity> updateData, List<RuntimeEntity> deleteData) {
+
+ }
+
+ /**
+ * 不存在查询
+ *
+ * @return
+ */
+ @Override
+ public List<RuntimeEntity> getData() {
+ return Collections.emptyList();
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/TopicDataMetadataHandler.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/TopicDataMetadataHandler.java
new file mode 100644
index 0000000..463ef5c
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/TopicDataMetadataHandler.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.service.metadata;
+
+import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity;
+import org.apache.eventmesh.dashboard.console.mapper.message.TopicMapper;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class TopicDataMetadataHandler extends AbstractDBDataMetadataHandler<TopicEntity> {
+
+ @Autowired
+ private TopicMapper topicMapper;
+
+ @Override
+ public void handleAll(List<TopicEntity> addData, List<TopicEntity> updateData, List<TopicEntity> deleteData) {
+ topicMapper.batchInsert(addData);
+
+ }
+
+
+ @Override
+ List<TopicEntity> doGetData() {
+ TopicEntity topicEntity = this.getEntity();
+ return List.of();
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/TopicOffsetDataMetadataHandler.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/TopicOffsetDataMetadataHandler.java
new file mode 100644
index 0000000..3ca44c3
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/metadata/TopicOffsetDataMetadataHandler.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.service.metadata;
+
+import org.apache.eventmesh.dashboard.console.entity.message.TopicOffsetEntity;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class TopicOffsetDataMetadataHandler extends AbstractDBDataMetadataHandler<TopicOffsetEntity> {
+
+
+ @Override
+ public void handleAll(List<TopicOffsetEntity> addData, List<TopicOffsetEntity> updateData, List<TopicOffsetEntity> deleteData) {
+
+
+ }
+
+
+ @Override
+ List<TopicOffsetEntity> doGetData() {
+ return List.of();
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java
deleted file mode 100644
index f95aed8..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.service.store.Impl;
-
-import org.apache.eventmesh.dashboard.console.entity.StoreEntity;
-import org.apache.eventmesh.dashboard.console.mapper.storage.StoreMapper;
-import org.apache.eventmesh.dashboard.console.service.store.StoreService;
-
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-public class StoreServiceImpl implements StoreService {
-
- @Autowired
- private StoreMapper storeMapper;
-
- @Override
- public StoreEntity selectStoreToFrontListByCluster(Long clusterId) {
- StoreEntity storeEntity = new StoreEntity();
- storeEntity.setClusterId(clusterId);
- return storeMapper.selectStoreByCluster(storeEntity);
- }
-
-
- @Override
- public List<StoreEntity> selectAll() {
- return storeMapper.selectAll();
- }
-
- @Override
- public StoreEntity selectById(Long storeId) {
- StoreEntity query = new StoreEntity();
- query.setId(storeId);
- return storeMapper.selectById(query);
- }
-
- @Override
- public StoreEntity selectByHostPort(String host, Integer port) {
- StoreEntity query = new StoreEntity();
- query.setHost(host);
- query.setPort(port);
- return storeMapper.selectByHostPort(query);
- }
-
- @Override
- public Integer batchInsert(List<StoreEntity> storeEntities) {
- return storeMapper.batchInsert(storeEntities);
- }
-
- @Override
- public void insertStore(StoreEntity storeEntity) {
- storeMapper.insertStore(storeEntity);
- }
-
- @Override
- public Integer deleteStoreByUnique(StoreEntity storeEntity) {
- return storeMapper.deleteStoreByUnique(storeEntity);
- }
-
- @Override
- public StoreEntity selectStoreByCluster(Long clusterId) {
- StoreEntity storeEntity = new StoreEntity();
- storeEntity.setClusterId(clusterId);
- return storeMapper.selectStoreByCluster(storeEntity);
- }
-
- @Override
- public Integer updateStoreByUnique(StoreEntity storeEntity) {
- return storeMapper.updateStoreByUnique(storeEntity);
- }
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/StoreService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/StoreService.java
deleted file mode 100644
index 6528241..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/StoreService.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.service.store;
-
-import org.apache.eventmesh.dashboard.console.entity.StoreEntity;
-
-import java.util.List;
-
-/**
- * store data service
- */
-public interface StoreService {
-
- StoreEntity selectStoreToFrontListByCluster(Long clusterId);
-
- List<StoreEntity> selectAll();
-
- StoreEntity selectById(Long storeId);
-
- StoreEntity selectByHostPort(String host, Integer port);
-
- Integer batchInsert(List<StoreEntity> storeEntities);
-
- void insertStore(StoreEntity storeEntity);
-
- Integer deleteStoreByUnique(StoreEntity storeEntity);
-
- StoreEntity selectStoreByCluster(Long clusterId);
-
- Integer updateStoreByUnique(StoreEntity storeEntity);
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/DefaultDataHandler.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/DefaultDataHandler.java
new file mode 100644
index 0000000..3cc2dc1
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/DefaultDataHandler.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.spring.support;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterSyncMetadataEnum;
+import org.apache.eventmesh.dashboard.common.model.ClusterSyncMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
+import org.apache.eventmesh.dashboard.console.domain.metadata.ClusterMetadataDomain.DataHandler;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.function.health.Health2Service;
+import org.apache.eventmesh.dashboard.console.spring.support.metadata.convert.RuntimeConvertMetaData;
+import org.apache.eventmesh.dashboard.core.cluster.ClusterDO;
+import org.apache.eventmesh.dashboard.core.cluster.ColonyDO;
+import org.apache.eventmesh.dashboard.core.cluster.RuntimeDO;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKManage;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
+import org.apache.eventmesh.dashboard.core.metadata.MetadataSyncManage;
+
+import lombok.Setter;
+
+@Setter
+public class DefaultDataHandler implements DataHandler<RuntimeDO, ClusterDO> {
+
+
+ private MetadataSyncManage metadataSyncManage;
+
+
+ private Health2Service healthService;
+
+
+ @Override
+ public void registerRuntime(RuntimeEntity runtimeEntity, RuntimeDO runtimeDO, ColonyDO<ClusterDO> colonyDO) {
+ RuntimeMetadata runtimeMetadata = RuntimeConvertMetaData.INSTANCE.toMetaData(runtimeEntity);
+ SDKManage.getInstance().createClient(SDKTypeEnum.ADMIN, runtimeMetadata, runtimeDO.getCreateSDKConfig(), runtimeMetadata.getClusterType());
+ healthService.register(runtimeDO.getRuntimeMetadata());
+ metadataSyncManage.register(runtimeDO.getRuntimeMetadata());
+ }
+
+ @Override
+ public void unRegisterRuntime(RuntimeEntity runtimeEntity, RuntimeDO runtimeDO, ColonyDO<ClusterDO> colonyDO) {
+ RuntimeMetadata runtimeMetadata = RuntimeConvertMetaData.INSTANCE.toMetaData(runtimeEntity);
+ healthService.unRegister(runtimeMetadata);
+ metadataSyncManage.unRegister(runtimeMetadata);
+ }
+
+ @Override
+ public void registerCluster(ClusterEntity clusterEntity, ClusterDO clusterDO, ColonyDO<ClusterDO> colonyDO) {
+ ClusterSyncMetadata clusterSyncMetadata = ClusterSyncMetadataEnum.getClusterSyncMetadata(clusterEntity.getClusterType());
+ if (!clusterSyncMetadata.getClusterFramework().isCAP()) {
+ return;
+ }
+ SDKManage.getInstance().createClient(SDKTypeEnum.ADMIN, clusterDO.getClusterInfo(), clusterDO.getMultiCreateSDKConfig(),
+ clusterDO.getClusterInfo().getClusterType());
+ healthService.register(clusterDO.getClusterInfo());
+ metadataSyncManage.register(clusterDO.getClusterInfo());
+ }
+
+ @Override
+ public void unRegisterCluster(ClusterEntity clusterEntity, ClusterDO clusterDO, ColonyDO<ClusterDO> colonyDO) {
+ healthService.unRegisterCluster(clusterEntity.getClusterId());
+
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManage.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManage.java
new file mode 100644
index 0000000..356d067
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManage.java
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.spring.support;
+
+import org.apache.eventmesh.dashboard.common.model.DatabaseAndMetadataMapper;
+import org.apache.eventmesh.dashboard.console.domain.metadata.ClusterMetadataDomain;
+import org.apache.eventmesh.dashboard.console.domain.metadata.MetadataAllDO;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.function.health.Health2Service;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterRelationshipService;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
+import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService;
+import org.apache.eventmesh.dashboard.console.service.function.HealthDataService;
+import org.apache.eventmesh.dashboard.console.spring.support.metadata.DatabaseAndMetadataType;
+import org.apache.eventmesh.dashboard.console.spring.support.metadata.DefaultMetadataSyncResultHandler;
+import org.apache.eventmesh.dashboard.core.metadata.DataMetadataHandler;
+import org.apache.eventmesh.dashboard.core.metadata.MetadataSyncManage;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * FunctionManager is in charge of tasks such as scheduled health checks
+ */
+@Slf4j
+@Component
+public class FunctionManage {
+
+
+ @Autowired
+ private RuntimeService runtimeService;
+
+
+ @Autowired
+ private ClusterService clusterService;
+
+ @Autowired
+ private ClusterRelationshipService clusterRelationshipService;
+
+
+ @Autowired
+ private DefaultMetadataSyncResultHandler defaultMetadataSyncResultHandler;
+
+ @Autowired
+ private HealthDataService dataService;
+
+ @Autowired
+ private List<DataMetadataHandler> dataMetadataHandlerList;
+
+
+ private final MetadataSyncManage metadataSyncManage = new MetadataSyncManage();
+
+ private final Health2Service healthService = new Health2Service();
+
+ private final ClusterMetadataDomain clusterMetadataDomain = new ClusterMetadataDomain();
+
+ private final RuntimeEntity runtimeEntity = new RuntimeEntity();
+
+ private final ClusterEntity clusterEntity = new ClusterEntity();
+
+ private final ClusterRelationshipEntity clusterRelationshipEntity = new ClusterRelationshipEntity();
+
+ @Value("${function.enabled:false}")
+ private boolean enabled;
+
+ @PostConstruct
+ private void init() {
+ if (!this.enabled) {
+ return;
+ }
+ clusterMetadataDomain.rootClusterDHO();
+ this.initQueueData();
+ this.createHandler();
+ this.buildMetadataSyncManage();
+ }
+
+ private void initQueueData() {
+ LocalDateTime date = LocalDateTime.of(2000, 1, 1, 0, 0, 0, 0);
+ runtimeEntity.setUpdateTime(date);
+ clusterEntity.setCreateTime(date);
+ clusterRelationshipEntity.setUpdateTime(date);
+ }
+
+ private void buildMetadataSyncManage() {
+ List<DatabaseAndMetadataMapper> databaseAndMetadataMapperList = new ArrayList<>();
+ for (DatabaseAndMetadataType databaseAndMetadataType : DatabaseAndMetadataType.values()) {
+ databaseAndMetadataMapperList.add(databaseAndMetadataType.getDatabaseAndMetadataMapper());
+ }
+ this.metadataSyncManage.setMetadataSyncResultHandler(this.defaultMetadataSyncResultHandler);
+ this.metadataSyncManage.setDataMetadataHandlerList((List<DataMetadataHandler<Object>>) ((Object) this.dataMetadataHandlerList));
+
+ this.metadataSyncManage.init(5000, 100, databaseAndMetadataMapperList);
+ }
+
+ /**
+ * TODO 核心逻辑在这里
+ */
+ private void createHandler() {
+ DefaultDataHandler defaultDataHandler = new DefaultDataHandler();
+ defaultDataHandler.setHealthService(healthService);
+ defaultDataHandler.setMetadataSyncManage(metadataSyncManage);
+ this.clusterMetadataDomain.setHandler(defaultDataHandler);
+ }
+
+ @Bean
+ public ClusterMetadataDomain registerBean() {
+ return this.clusterMetadataDomain;
+ }
+
+ /**
+ * meta 同步 只获得 实例 实例 同步 kubernetes 数据 全量读取数据 ,创建对应的 meta 对象
+ * <p>
+ * 然后 然后日常
+ */
+ @Scheduled(fixedRate = 5000)
+ public void initFunctionManager() {
+ if (!this.enabled) {
+ return;
+ }
+ healthService.executeAll();
+
+ }
+
+ @Scheduled(initialDelay = 500L, fixedDelay = 100)
+ public void sync() {
+ if (!this.enabled) {
+ return;
+ }
+ LocalDateTime date = LocalDateTime.now();
+ List<RuntimeEntity> runtimeEntityList = this.runtimeService.queryByUpdateTime(runtimeEntity);
+ List<ClusterEntity> clusterEntityList = this.clusterService.queryByUpdateTime(clusterEntity);
+ List<ClusterRelationshipEntity> clusterRelationshipEntityList =
+ this.clusterRelationshipService.queryByUpdateTime(clusterRelationshipEntity);
+ if (runtimeEntityList.isEmpty() && clusterEntityList.isEmpty() && clusterRelationshipEntityList.isEmpty()) {
+ log.info("No runtime entities found");
+ }
+ runtimeEntity.setUpdateTime(date);
+ clusterEntity.setUpdateTime(date);
+ clusterRelationshipEntity.setUpdateTime(date);
+
+ MetadataAllDO metadataAll =
+ MetadataAllDO.builder().clusterEntityList(clusterEntityList).clusterRelationshipEntityList(clusterRelationshipEntityList)
+ .runtimeEntityList(runtimeEntityList).build();
+ this.clusterMetadataDomain.handlerMetadata(metadataAll);
+
+ }
+
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManager.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManager.java
deleted file mode 100644
index 9a785fb..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManager.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.spring.support;
-
-import org.apache.eventmesh.dashboard.console.config.FunctionManagerConfigs;
-import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache;
-import org.apache.eventmesh.dashboard.console.function.health.HealthService;
-
-import lombok.Getter;
-import lombok.Setter;
-import lombok.extern.slf4j.Slf4j;
-
-/**
- * FunctionManager is in charge of tasks such as scheduled health checks
- */
-@Slf4j
-public class FunctionManager {
-
- @Setter
- private FunctionManagerProperties properties;
-
- @Setter
- private FunctionManagerConfigs configs;
-
- @Setter
- @Getter
- private HealthService healthService;
-
- public void initFunctionManager() {
- //Health Check
- healthService = new HealthService();
- healthService.createExecutor(properties.getDataServiceContainer().getHealthDataService(), CheckResultCache.getINSTANCE());
- healthService.startScheduledUpdateConfig(configs.getHealthCheck().getUpdateConfig().getInitialDelay(),
- configs.getHealthCheck().getUpdateConfig().getPeriod(), properties.getDataServiceContainer());
- healthService.startScheduledExecution(configs.getHealthCheck().getDoCheck().getInitialDelay(),
- configs.getHealthCheck().getDoCheck().getPeriod());
- }
-
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManagerLoader.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManagerLoader.java
deleted file mode 100644
index 2ffa3c7..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManagerLoader.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.spring.support;
-
-import org.apache.eventmesh.dashboard.console.config.FunctionManagerConfigs;
-import org.apache.eventmesh.dashboard.console.function.health.HealthService;
-import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandlerWrapper;
-import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.SyncDataServiceWrapper;
-import org.apache.eventmesh.dashboard.console.service.DataServiceWrapper;
-
-import javax.annotation.PostConstruct;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Profile;
-import org.springframework.stereotype.Component;
-
-@Profile("!test")
-@Component
-public class FunctionManagerLoader {
-
- private FunctionManager functionManager;
-
- private FunctionManagerProperties properties;
-
- @Autowired
- private DataServiceWrapper dataServiceContainer;
- @Autowired
- private SyncDataServiceWrapper syncDataServiceWrapper;
- @Autowired
- private MetadataHandlerWrapper metadataHandlerWrapper;
-
- @Autowired
- private FunctionManagerConfigs functionManagerConfigs;
-
- @Bean
- public HealthService getHealthService() {
- return functionManager.getHealthService();
- }
-
-
- @PostConstruct
- void initManager() {
- functionManager = new FunctionManager();
- properties = new FunctionManagerProperties();
- properties.setDataServiceContainer(
- dataServiceContainer);
- properties.setSyncDataServiceWrapper(
- syncDataServiceWrapper);
- properties.setMetadataHandlerWrapper(metadataHandlerWrapper);
-
- functionManager.setProperties(properties);
- functionManager.setConfigs(functionManagerConfigs);
- functionManager.initFunctionManager();
- }
-
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManagerProperties.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManagerProperties.java
deleted file mode 100644
index 62693a0..0000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManagerProperties.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.spring.support;
-
-import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandlerWrapper;
-import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.SyncDataServiceWrapper;
-import org.apache.eventmesh.dashboard.console.service.DataServiceWrapper;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@SuperBuilder
-public class FunctionManagerProperties {
-
- private DataServiceWrapper dataServiceContainer;
- private SyncDataServiceWrapper syncDataServiceWrapper;
- private MetadataHandlerWrapper metadataHandlerWrapper;
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/RuntimeDeployService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/RuntimeDeployService.java
new file mode 100644
index 0000000..92b028a
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/RuntimeDeployService.java
@@ -0,0 +1,422 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.spring.support;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterFramework;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.DeployStatusType;
+import org.apache.eventmesh.dashboard.common.enums.MetadataType;
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
+import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata;
+import org.apache.eventmesh.dashboard.common.port.PortValidate;
+import org.apache.eventmesh.dashboard.console.entity.cases.DeployScriptEntity;
+import org.apache.eventmesh.dashboard.console.entity.cases.ResourcesConfigEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.modle.DO.runtime.QueryRuntimeByBigExpandClusterDO;
+import org.apache.eventmesh.dashboard.console.modle.deploy.GetPortsDO;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterRelationshipService;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
+import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService;
+import org.apache.eventmesh.dashboard.console.service.connector.ResourcesConfigService;
+import org.apache.eventmesh.dashboard.console.service.deploy.DeployScriptService;
+import org.apache.eventmesh.dashboard.console.service.deploy.PortService;
+import org.apache.eventmesh.dashboard.console.service.function.ConfigService;
+import org.apache.eventmesh.dashboard.console.spring.support.register.BuildMetadata;
+import org.apache.eventmesh.dashboard.console.spring.support.register.BuildMetadataManage;
+import org.apache.eventmesh.dashboard.console.spring.support.register.ScriptBuildData;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKManage;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import io.fabric8.kubernetes.client.KubernetesClient;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 不会处理 关联
+ */
+@Slf4j
+@Component
+public class RuntimeDeployService {
+
+ private static final Map<DeployStatusType, DeployStatusType> DEPLOY_FAIL_STATUS = new HashMap<>();
+
+ private static final Map<DeployStatusType, DeployStatusType> DEPLOY_ING_STATUS = new HashMap<>();
+
+ private static final Map<DeployStatusType, DeployStatusType> DEPLOY_SUCCESS_STATUS = new HashMap<>();
+
+ static {
+ DEPLOY_FAIL_STATUS.put(DeployStatusType.CREATE_WAIT, DeployStatusType.CREATE_FAIL);
+ DEPLOY_FAIL_STATUS.put(DeployStatusType.CREATE_FULL_WAIT, DeployStatusType.CREATE_FULL_FAIL);
+ DEPLOY_FAIL_STATUS.put(DeployStatusType.CREATE_CAP_UPDATE_WAIT, DeployStatusType.CREATE_CAP_UPDATE_FAIL);
+ DEPLOY_FAIL_STATUS.put(DeployStatusType.UPDATE_WAIT, DeployStatusType.UPDATE_FAIL);
+ DEPLOY_FAIL_STATUS.put(DeployStatusType.UPDATE_FULL_WAIT, DeployStatusType.UPDATE_FULL_FAIL);
+ DEPLOY_FAIL_STATUS.put(DeployStatusType.PAUSE_WAIT, DeployStatusType.UPDATE_FAIL);
+ DEPLOY_FAIL_STATUS.put(DeployStatusType.PAUSE_FULL_WAIT, DeployStatusType.PAUSE_FULL_FAIL);
+ DEPLOY_FAIL_STATUS.put(DeployStatusType.RESET_WAIT, DeployStatusType.RESET_FAIL);
+ DEPLOY_FAIL_STATUS.put(DeployStatusType.UNINSTALL, DeployStatusType.UNINSTALL_FAIL);
+
+ DEPLOY_SUCCESS_STATUS.put(DeployStatusType.CREATE_WAIT, DeployStatusType.CREATE_SUCCESS);
+ DEPLOY_SUCCESS_STATUS.put(DeployStatusType.CREATE_FULL_WAIT, DeployStatusType.CREATE_FULL_SUCCESS);
+ DEPLOY_SUCCESS_STATUS.put(DeployStatusType.CREATE_CAP_UPDATE_WAIT, DeployStatusType.CREATE_CAP_UPDATE_SUCCESS);
+ DEPLOY_SUCCESS_STATUS.put(DeployStatusType.UPDATE_WAIT, DeployStatusType.UPDATE_SUCCESS);
+ DEPLOY_SUCCESS_STATUS.put(DeployStatusType.UPDATE_FULL_WAIT, DeployStatusType.UPDATE_FULL_SUCCESS);
+ DEPLOY_SUCCESS_STATUS.put(DeployStatusType.PAUSE_WAIT, DeployStatusType.UPDATE_SUCCESS);
+ DEPLOY_SUCCESS_STATUS.put(DeployStatusType.PAUSE_FULL_WAIT, DeployStatusType.PAUSE_FULL_SUCCESS);
+ DEPLOY_SUCCESS_STATUS.put(DeployStatusType.RESET_WAIT, DeployStatusType.RESET_SUCCESS);
+ DEPLOY_SUCCESS_STATUS.put(DeployStatusType.UNINSTALL, DeployStatusType.UNINSTALL_SUCCESS);
+
+ DEPLOY_ING_STATUS.put(DeployStatusType.CREATE_WAIT, DeployStatusType.CREATE_ING);
+ DEPLOY_ING_STATUS.put(DeployStatusType.CREATE_FULL_WAIT, DeployStatusType.CREATE_FULL_ING);
+ DEPLOY_ING_STATUS.put(DeployStatusType.CREATE_CAP_UPDATE_WAIT, DeployStatusType.CREATE_CAP_UPDATE_ING);
+ DEPLOY_ING_STATUS.put(DeployStatusType.UPDATE_WAIT, DeployStatusType.UPDATE_ING);
+ DEPLOY_ING_STATUS.put(DeployStatusType.UPDATE_FULL_WAIT, DeployStatusType.UPDATE_FULL_ING);
+ DEPLOY_ING_STATUS.put(DeployStatusType.PAUSE_WAIT, DeployStatusType.UPDATE_ING);
+ DEPLOY_ING_STATUS.put(DeployStatusType.PAUSE_FULL_WAIT, DeployStatusType.PAUSE_FULL_ING);
+ DEPLOY_ING_STATUS.put(DeployStatusType.RESET_WAIT, DeployStatusType.RESET_ING);
+ DEPLOY_ING_STATUS.put(DeployStatusType.UNINSTALL, DeployStatusType.UNINSTALL_ING);
+
+ }
+
+ static DeployStatusType getFailedType(DeployStatusType deployStatusType) {
+ return DEPLOY_FAIL_STATUS.get(deployStatusType);
+ }
+
+ static DeployStatusType getIngType(DeployStatusType deployStatusType) {
+ return DEPLOY_ING_STATUS.get(deployStatusType);
+ }
+
+ static DeployStatusType getSuccess(DeployStatusType deployStatusType) {
+ return DEPLOY_ING_STATUS.get(deployStatusType);
+ }
+
+ @Autowired
+ private ClusterService clusterService;
+
+ @Autowired
+ private RuntimeService runtimeService;
+
+ @Autowired
+ private ClusterRelationshipService clusterRelationshipService;
+
+ @Autowired
+ private DeployScriptService deployScriptService;
+
+ @Autowired
+ private ResourcesConfigService resourcesConfigService;
+
+ @Autowired
+ private ConfigService configService;
+
+ @Autowired
+ private PortService portService;
+
+
+ private final BuildMetadataManage buildMetadataManage = new BuildMetadataManage();
+
+ private final ThreadPoolExecutor deployThreadPoolExecutor = new ThreadPoolExecutor(10, 10, 20, TimeUnit.SECONDS, new LinkedBlockingDeque<>(),
+ new ThreadFactory() {
+ final AtomicInteger counter = new AtomicInteger(0);
+
+ @Override
+ public Thread newThread(Runnable r) {
+ return new Thread(r, "deploy-" + counter.incrementAndGet());
+ }
+ });
+
+
+ @Scheduled(initialDelay = 100, fixedDelay = 100)
+ public void deploy() {
+ RuntimeEntity runtimeEntity = new RuntimeEntity();
+ runtimeEntity.setUpdateTime(LocalDateTime.now().minusMinutes(500));
+ List<RuntimeEntity> runtimeEntityList = this.runtimeService.queryByUpdateTime(runtimeEntity);
+
+ runtimeEntityList.forEach(entity -> {
+ AbstractRuntimeServiceTask abstractRuntimeServiceTask = this.createTask(entity);
+ if (Objects.isNull(abstractRuntimeServiceTask)) {
+ return;
+ }
+ abstractRuntimeServiceTask.runtimeEntity = entity;
+ deployThreadPoolExecutor.execute(abstractRuntimeServiceTask);
+ });
+ }
+
+
+ public AbstractRuntimeServiceTask createTask(RuntimeEntity entity) {
+ switch (entity.getDeployStatusType()) {
+ case CREATE_WAIT, CREATE_FULL_WAIT, CREATE_CAP_UPDATE_WAIT, UPDATE_WAIT -> {
+ return new RuntimeCreateDeploy();
+ }
+ case PAUSE_ING, PAUSE_FULL_WAIT -> {
+ return new RuntimePauseDeploy();
+ }
+ case UNINSTALL -> {
+ return new RuntimeUninstallDeploy();
+ }
+ default -> {
+ return null;
+ }
+ }
+ }
+
+ public abstract class AbstractRuntimeServiceTask implements Runnable {
+
+ protected RuntimeEntity runtimeEntity;
+
+ protected ClusterEntity clusterEntity;
+
+ protected ClusterType clusterType;
+
+ protected ClusterFramework clusterFramework;
+
+ protected ClusterEntity kubeClusterEntity;
+
+ protected KubernetesClient kubernetesClient;
+
+ protected List<RuntimeEntity> metaAndRuntimeList;
+
+ protected List<RuntimeEntity> updateRuntimeList = new ArrayList<>();
+
+ protected ScriptBuildData scriptBuildData = new ScriptBuildData();
+
+ protected BuildMetadata buildMetadata;
+
+
+ public void queryHandlerData() {
+ this.clusterType = this.runtimeEntity.getClusterType();
+ ClusterEntity clusterEntity = new ClusterEntity();
+ clusterEntity.setId(this.runtimeEntity.getClusterId());
+ this.clusterEntity = clusterService.queryClusterById(clusterEntity);
+ /*
+ * 查询 kubernetes cluster
+ * TODO 目前无法处理 多 kubernetes 的问题
+ */
+ this.kubeClusterEntity = clusterService.queryRelationshipClusterByClusterIdAndType(clusterEntity);
+ BaseSyncBase base = new ClusterMetadata();
+ base.setId(this.kubeClusterEntity.getId());
+ this.kubernetesClient = SDKManage.getInstance().getClient(SDKTypeEnum.ADMIN, base.getUnique());
+ this.buildMetadata = buildMetadataManage.getBuildMetaAddress(this.runtimeEntity.getClusterType());
+ }
+
+ public void buildOperationMetaData() {
+ scriptBuildData.put("namespace", runtimeEntity.getClusterId());
+ scriptBuildData.put("name", runtimeEntity.getId());
+
+ scriptBuildData.put("clusterType", runtimeEntity.getClusterType());
+ scriptBuildData.put("clusterId", runtimeEntity.getClusterId());
+ scriptBuildData.put("runtimeId", runtimeEntity.getId());
+ }
+
+ public void buildMetaAddress() {
+ if (!Objects.equals(RuntimeCreateDeploy.class, this.getClass())) {
+ return;
+ }
+ // TODO 非 mate 都需要 meta,
+ if (!this.clusterType.isMeta() && !this.clusterType.isMetaAndRuntime()) {
+ // 存储节点必须要 meta信息
+
+ QueryRuntimeByBigExpandClusterDO queryRuntimeByBigExpandClusterDO = QueryRuntimeByBigExpandClusterDO.builder()
+ .followClusterId(clusterEntity.getId()).queryClusterTypeList(this.clusterType.getMetaClusterType()).build();
+
+ List<RuntimeEntity> newRuntimeEntityList = runtimeService.queryMetaRuntimeByStorageClusterId(queryRuntimeByBigExpandClusterDO);
+ this.buildMetadata.buildMetaAddress(this.scriptBuildData, runtimeEntity, newRuntimeEntityList);
+ }
+ // 如果是创建 runtime , 需要得到 所有存储的 runtime
+ if (Objects.equals(this.clusterType, ClusterType.EVENTMESH_RUNTIME)) {
+ QueryRuntimeByBigExpandClusterDO data = QueryRuntimeByBigExpandClusterDO.builder().followClusterId(this.clusterEntity.getId())
+ .mainClusterType(ClusterType.EVENTMESH_CLUSTER).storageClusterTypeList(ClusterType.getStorageCluster())
+ .storageMetaClusterTypeList(ClusterType.getStorageMetaCluster()).build();
+
+ List<RuntimeEntity> storageMetaRuntimeList = runtimeService.queryRuntimeByBigExpandCluster(data);
+ this.buildMetadata.buildMetaAddress(this.scriptBuildData, runtimeEntity, storageMetaRuntimeList);
+ }
+ if (this.clusterType.isMetaAndRuntime() || (this.clusterType.isMeta() && this.clusterFramework.isCAP())) {
+ // CAP 模式 需要得到本集群里面所有 runtime
+ List<RuntimeEntity> metaAndRuntimeList = runtimeService.queryRuntimeToFrontByClusterId(runtimeEntity);
+ this.buildMetadata.buildMetaAddress(this.scriptBuildData, runtimeEntity, metaAndRuntimeList);
+ }
+ }
+
+
+
+ /**
+ * runtime 进行操作的时候,会影响 当前集群 或则 依赖菊琴
+ *
+ * <ol>
+ * <li> CAP 集群修改,集群内所有节点都必须修改,同时 依赖集群同时也要修改 </li>
+ * <li> TODO CAP 集群是 批量创建创建 @see PAUSE_FULL_WAIT CREATE_FULL_WAIT , 不会影响</li>
+ * </ol>
+ */
+ public void influence() {
+ if (Objects.equals(this.runtimeEntity.getDeployStatusType(), DeployStatusType.PAUSE_FULL_WAIT) || Objects.equals(
+ this.runtimeEntity.getDeployStatusType(), DeployStatusType.CREATE_FULL_WAIT)) {
+ return;
+ }
+
+ if (this.clusterType.isMetaAndRuntime() && Objects.equals(this.runtimeEntity.getDeployStatusType(),
+ DeployStatusType.CREATE_WAIT)) {
+ // 修改数据
+ this.metaAndRuntimeList.forEach((value) -> {
+ value.setDeployStatusType(DeployStatusType.CREATE_CAP_UPDATE_WAIT);
+ this.updateRuntimeList.add(value);
+ });
+ }
+ if (this.clusterType.isMeta()) {
+ // 查询 当前集群下 所有 节点, 然后更新这些节点的内容
+ runtimeService.queryRuntimeToFrontByClusterId(this.runtimeEntity).forEach((value) -> {
+ if (Objects.equals(this.runtimeEntity.getId(), value.getId())) {
+ return;
+ }
+ value.setDeployStatusType(DeployStatusType.UPDATE_WAIT);
+ this.updateRuntimeList.add(runtimeEntity);
+ });
+ }
+
+ }
+
+ @Override
+ public void run() {
+ try {
+ this.queryHandlerData();
+ this.buildOperationMetaData();
+ if (Objects.equals(this.runtimeEntity.getDeployStatusType(), DeployStatusType.UNINSTALL)) {
+ this.handler();
+ return;
+ }
+ this.buildMetaAddress();
+ this.handler();
+ this.influence();
+ this.runtimeEntity.setDeployStatusType(getSuccess(runtimeEntity.getDeployStatusType()));
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+ this.runtimeEntity.setDeployStatusType(getFailedType(runtimeEntity.getDeployStatusType()));
+ }
+ this.updateRuntimeList.add(this.runtimeEntity);
+
+ try {
+ runtimeService.batchUpdate(this.updateRuntimeList);
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+ }
+ }
+
+ abstract void handler();
+ }
+
+ class RuntimeUninstallDeploy extends AbstractRuntimeServiceTask {
+
+
+ @Override
+ void handler() {
+ // 直接从 云 or 容器 删除资源
+ }
+
+ }
+
+ class RuntimePauseDeploy extends AbstractRuntimeServiceTask {
+
+ @Override
+ void handler() {
+
+ }
+ }
+
+
+ class RuntimeCreateCheckDeploy extends AbstractRuntimeServiceTask {
+
+ @Override
+ void handler() {
+
+ }
+ }
+
+ class RuntimeCreateDeploy extends AbstractRuntimeServiceTask {
+
+ private DeployScriptEntity deployScriptEntity;
+
+
+ @Override
+ void handler() {
+ runtimeEntity.setKubernetesClusterId(this.kubeClusterEntity.getId());
+ deployScriptEntity = new DeployScriptEntity();
+ deployScriptEntity.setId(this.clusterEntity.getDeployScriptId());
+ this.deployScriptEntity = deployScriptService.queryById(deployScriptEntity);
+
+ ResourcesConfigEntity resourcesConfigEntity = new ResourcesConfigEntity();
+ resourcesConfigEntity.setId(this.clusterEntity.getResourcesConfigId());
+
+ resourcesConfigEntity = resourcesConfigService.queryResourcesById(resourcesConfigEntity);
+ this.scriptBuildData.setResourcesConfigEntity(resourcesConfigEntity);
+
+ ConfigEntity configEntity = new ConfigEntity();
+ configEntity.setClusterId(this.clusterEntity.getId());
+ configEntity.setInstanceId(this.clusterEntity.getId());
+ configEntity.setInstanceType(MetadataType.CLUSTER);
+ List<ConfigEntity> configEntityList = configService.queryByClusterAndInstanceId(configEntity);
+
+ this.scriptBuildData.setConfigEntityList(configEntityList);
+ this.buildMetadata.buildConfig(this.scriptBuildData, this.runtimeEntity);
+ this.applyPort();
+ this.kubernetesClient.resource(this.buildScriptContent()).serverSideApply();
+
+ //kubernetesClient.load(new ByteArrayInputStream(this.buildScriptContent().getBytes())).serverSideApply().
+
+ }
+
+ private void applyPort() {
+ PortValidate portValidate = this.buildMetadata.portValidate();
+ portValidate.portRules();
+ GetPortsDO getPortsDO = new GetPortsDO();
+ getPortsDO.setClusterId(this.clusterEntity.getId());
+ getPortsDO.setPortNum(portValidate.portRules().size());
+ List<String> port = portService.getPorts(getPortsDO);
+ for (int i = 0; i < port.size(); i++) {
+ this.scriptBuildData.put(portValidate.portRules().get(i).getName(), port.get(i));
+ }
+ }
+
+ private String buildScriptContent() {
+ String scriptContent = this.deployScriptEntity.getContent();
+
+ for (Entry<String, Object> entity : this.scriptBuildData.getData().entrySet()) {
+ scriptContent = scriptContent.replace("${" + entity.getKey() + "}", entity.getValue().toString());
+ }
+
+ return scriptContent;
+ }
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/DatabaseAndMetadataType.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/DatabaseAndMetadataType.java
new file mode 100644
index 0000000..92aa46d
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/DatabaseAndMetadataType.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.spring.support.metadata;
+
+import org.apache.eventmesh.dashboard.common.enums.MetadataType;
+import org.apache.eventmesh.dashboard.common.model.DatabaseAndMetadataMapper;
+import org.apache.eventmesh.dashboard.console.service.metadata.ClientDataMetadataHandler;
+import org.apache.eventmesh.dashboard.console.service.metadata.ConfigDataMetadataHandler;
+import org.apache.eventmesh.dashboard.console.service.metadata.ConsumeOffsetDataMetadataHandler;
+import org.apache.eventmesh.dashboard.console.service.metadata.GroupDataMetadataHandler;
+import org.apache.eventmesh.dashboard.console.service.metadata.RuntimeDataMetadataHandler;
+import org.apache.eventmesh.dashboard.console.service.metadata.TopicDataMetadataHandler;
+import org.apache.eventmesh.dashboard.console.service.metadata.TopicOffsetDataMetadataHandler;
+import org.apache.eventmesh.dashboard.console.spring.support.metadata.convert.ConfigConvertMetaData;
+import org.apache.eventmesh.dashboard.console.spring.support.metadata.convert.ConsumeOffsetConvertMetaData;
+import org.apache.eventmesh.dashboard.console.spring.support.metadata.convert.GroupConvertMetaData;
+import org.apache.eventmesh.dashboard.console.spring.support.metadata.convert.RuntimeConvertMetaData;
+import org.apache.eventmesh.dashboard.console.spring.support.metadata.convert.TopicOffsetConvertMetaData;
+import org.apache.eventmesh.dashboard.service.remoting.ClientRemotingService;
+import org.apache.eventmesh.dashboard.service.remoting.ConfigRemotingService;
+import org.apache.eventmesh.dashboard.service.remoting.ConsumeOffsetRemotingService;
+import org.apache.eventmesh.dashboard.service.remoting.GroupRemotingService;
+import org.apache.eventmesh.dashboard.service.remoting.MetaRemotingService;
+import org.apache.eventmesh.dashboard.service.remoting.TopicOffsetRemotingService;
+import org.apache.eventmesh.dashboard.service.remoting.TopicRemotingService;
+
+import lombok.Getter;
+
+@Getter
+public enum DatabaseAndMetadataType {
+
+ RUNTIME(DatabaseAndMetadataMapper.builder().metaType(MetadataType.RUNTIME).databaseHandlerClass(RuntimeDataMetadataHandler.class)
+ .metadataHandlerClass(MetaRemotingService.class).convertMetaData(RuntimeConvertMetaData.INSTANCE).build()),
+
+ TOPIC(DatabaseAndMetadataMapper.builder().metaType(MetadataType.TOPIC).databaseHandlerClass(TopicDataMetadataHandler.class)
+ .metadataHandlerClass(TopicRemotingService.class).convertMetaData(RuntimeConvertMetaData.INSTANCE).build()),
+
+
+ TOPIC_OFFSET(DatabaseAndMetadataMapper.builder().metaType(MetadataType.TOPIC_OFFSET).databaseHandlerClass(TopicOffsetDataMetadataHandler.class)
+ .metadataHandlerClass(TopicOffsetRemotingService.class).convertMetaData(TopicOffsetConvertMetaData.INSTANCE).build()),
+
+ CONSUME_OFFSET(
+ DatabaseAndMetadataMapper.builder().metaType(MetadataType.CONSUME_OFFSET).databaseHandlerClass(ConsumeOffsetDataMetadataHandler.class)
+ .metadataHandlerClass(ConsumeOffsetRemotingService.class).convertMetaData(ConsumeOffsetConvertMetaData.INSTANCE).build()),
+
+ GROUP(DatabaseAndMetadataMapper.builder().metaType(MetadataType.GROUP).databaseHandlerClass(GroupDataMetadataHandler.class)
+ .metadataHandlerClass(GroupRemotingService.class).convertMetaData(GroupConvertMetaData.INSTANCE).build()),
+
+ CONFIG(DatabaseAndMetadataMapper.builder().metaType(MetadataType.CONFIG).databaseHandlerClass(ConfigDataMetadataHandler.class)
+ .metadataHandlerClass(ConfigRemotingService.class).convertMetaData(ConfigConvertMetaData.INSTANCE).build()),
+
+ CLIENT(DatabaseAndMetadataMapper.builder().metaType(MetadataType.CLIENT).databaseHandlerClass(ClientDataMetadataHandler.class)
+ .metadataHandlerClass(ClientRemotingService.class).convertMetaData(ConfigConvertMetaData.INSTANCE).build()),
+ ;
+
+
+ private DatabaseAndMetadataMapper databaseAndMetadataMapper;
+
+
+ DatabaseAndMetadataType(DatabaseAndMetadataMapper databaseAndMetadataMapper) {
+ this.databaseAndMetadataMapper = databaseAndMetadataMapper;
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/DefaultMetadataSyncResultHandler.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/DefaultMetadataSyncResultHandler.java
new file mode 100644
index 0000000..b0c4c59
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/DefaultMetadataSyncResultHandler.java
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.spring.support.metadata;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType.FirstToWhom;
+import org.apache.eventmesh.dashboard.common.enums.MetadataType;
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
+import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseSyncEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.entity.function.MetadataSyncResultEntity;
+import org.apache.eventmesh.dashboard.console.service.function.MetadataSyncResultService;
+import org.apache.eventmesh.dashboard.console.spring.support.metadata.convert.ClusterConvertMetaData;
+import org.apache.eventmesh.dashboard.console.spring.support.metadata.convert.RuntimeConvertMetaData;
+import org.apache.eventmesh.dashboard.core.metadata.result.MetadataSyncResult;
+import org.apache.eventmesh.dashboard.core.metadata.result.MetadataSyncResultHandler;
+
+import org.apache.commons.collections4.MapUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class DefaultMetadataSyncResultHandler implements MetadataSyncResultHandler {
+
+
+ private final Map<String, Dimension> dimensionMap = new ConcurrentHashMap<>();
+
+ private final Object recordLock = new Object();
+
+ private List<MetadataSyncResultEntity> record = new ArrayList<>();
+
+ private final Object runtimeLock = new Object();
+
+ private List<RuntimeEntity> runtimeList = new ArrayList<>();
+
+ private final Object clusterLock = new Object();
+
+ private List<ClusterEntity> clusterList = new ArrayList<>();
+
+
+ @Autowired
+ private MetadataSyncResultService metadataSyncResultService;
+
+
+ /**
+ * TODO
+ * 1. 如何优化这里的持久。只保存错误记录还是全量报错
+ * 2. 保存 FirstToWhom 处理结果
+ * 3. 保存 节点异常状态
+ */
+ @Override
+ public void persistence() {
+ List<MetadataSyncResultEntity> record = null;
+ if (!this.record.isEmpty()) {
+ synchronized (recordLock) {
+ record = this.record;
+ this.record = new ArrayList<>();
+ }
+ }
+
+ List<RuntimeEntity> runtimeList = null;
+ if (!this.runtimeList.isEmpty()) {
+ synchronized (runtimeLock) {
+ runtimeList = this.runtimeList;
+ this.runtimeList = new ArrayList<>();
+ }
+ }
+
+ List<ClusterEntity> clusterList = null;
+ if (!this.clusterList.isEmpty()) {
+ synchronized (clusterLock) {
+ clusterList = this.clusterList;
+ this.clusterList = new ArrayList<>();
+ }
+ }
+ metadataSyncResultService.bachMetadataSyncResult(record, runtimeList, clusterList);
+ }
+
+
+ @Override
+ public void register(List<MetadataSyncResult> metadataSyncResults) {
+ MetadataSyncResult metadataSyncResult = metadataSyncResults.get(0);
+ Dimension dimension = new Dimension();
+ dimensionMap.put(metadataSyncResult.getBaseSyncBase().getUnique(), dimension);
+
+ metadataSyncResults.forEach((value) -> {
+ dimension.metadataTypeMap.put(value.getMetadataType(), 1);
+ });
+ dimension.baseSyncBase = metadataSyncResult.getBaseSyncBase();
+ }
+
+ @Override
+ public void unregister(BaseSyncBase baseSyncBase) {
+ dimensionMap.remove(baseSyncBase.getUnique());
+ }
+
+ /**
+ * 分为正常同步,校验校验 ruguo
+ *
+ * @param metadataSyncResult
+ */
+ @Override
+ public void handleMetadataSyncResult(MetadataSyncResult metadataSyncResult) {
+ Dimension dimension = this.dimensionMap.get(metadataSyncResult.getBaseSyncBase().getUnique());
+ if (!metadataSyncResult.isSuccess()) {
+ MetadataSyncResultEntity metadataSyncResultEntity = getMetadataSyncResultEntity(metadataSyncResult, dimension);
+ synchronized (record) {
+ record.add(metadataSyncResultEntity);
+ }
+ BaseSyncEntity baseSyncEntity = dimension.getBaseSyncEntity();
+ baseSyncEntity.setSyncErrorType(metadataSyncResult.getSyncErrorType());
+
+ }
+ if (Objects.equals(dimension.baseSyncBase.getFirstToWhom(), FirstToWhom.COMPLETE)) {
+ return;
+ }
+ dimension.metadataTypeMap.remove(metadataSyncResult.getMetadataType());
+ if (MapUtils.isEmpty(dimension.metadataTypeMap)) {
+ dimension.baseSyncBase.setFirstSyncState(FirstToWhom.COMPLETE);
+ BaseSyncEntity baseSyncEntity = dimension.getBaseSyncEntity();
+ baseSyncEntity.setFirstSyncState(FirstToWhom.COMPLETE);
+ }
+ }
+
+ private static MetadataSyncResultEntity getMetadataSyncResultEntity(MetadataSyncResult metadataSyncResult, Dimension dimension) {
+ BaseSyncEntity baseSyncEntity = dimension.getBaseSyncEntity();
+
+ MetadataSyncResultEntity metadataSyncResultEntity = new MetadataSyncResultEntity();
+ metadataSyncResultEntity.setClusterId(baseSyncEntity.getClusterId());
+ metadataSyncResultEntity.setSyncId(baseSyncEntity.getId());
+ metadataSyncResultEntity.setMetadataType(metadataSyncResult.getMetadataType());
+ metadataSyncResultEntity.setSyncErrorType(metadataSyncResult.getSyncErrorType());
+ metadataSyncResultEntity.setResultData(metadataSyncResultEntity.getResultData());
+ return metadataSyncResultEntity;
+ }
+
+
+ /**
+ *
+ */
+ public class Dimension {
+
+ /**
+ * 如果第一次同步,需要修改对应的, dimension 对象。runtime cluster
+ *
+ * @see org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType.FirstToWhom
+ * <p>
+ * 每次完成同步,进行整理,如果有失败的,进行记录并且对 dimension 队形进行标记
+ */
+ private BaseSyncBase baseSyncBase;
+
+
+ private Map<MetadataType, Integer> metadataTypeMap = new ConcurrentHashMap<>();
+
+
+ public BaseSyncEntity getBaseSyncEntity() {
+ return Objects.equals(ClusterMetadata.class, baseSyncBase.getClass()) ? this.getClusterEntity() : this.getRuntimeEntity();
+ }
+
+ public RuntimeEntity getRuntimeEntity() {
+ RuntimeEntity runtimeEntity = RuntimeConvertMetaData.INSTANCE.toEntity((RuntimeMetadata) baseSyncBase);
+ synchronized (DefaultMetadataSyncResultHandler.this.runtimeLock) {
+ DefaultMetadataSyncResultHandler.this.runtimeList.add(runtimeEntity);
+ }
+ return runtimeEntity;
+ }
+
+ private ClusterEntity getClusterEntity() {
+ ClusterEntity clusterEntity = ClusterConvertMetaData.INSTANCE.toEntity((ClusterMetadata) this.baseSyncBase);
+ synchronized (DefaultMetadataSyncResultHandler.this.clusterLock) {
+ DefaultMetadataSyncResultHandler.this.clusterList.add(clusterEntity);
+ }
+ return clusterEntity;
+ }
+
+ public boolean isCluster() {
+ return Objects.equals(ClusterMetadata.class, baseSyncBase.getClass());
+ }
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/ClientConvertMetaData.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/ClientConvertMetaData.java
new file mode 100644
index 0000000..db44aff
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/ClientConvertMetaData.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.spring.support.metadata.convert;
+
+import org.apache.eventmesh.dashboard.common.model.ConvertMetaData;
+import org.apache.eventmesh.dashboard.common.model.metadata.ClientMetadata;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClientEntity;
+
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+/**
+ *
+ */
+@Mapper
+public interface ClientConvertMetaData extends ConvertMetaData<ClientEntity, ClientMetadata> {
+
+ ClientConvertMetaData INSTANCE = Mappers.getMapper(ClientConvertMetaData.class);
+
+ @Override
+ ClientEntity toEntity(ClientMetadata meta);
+
+ @Override
+ ClientMetadata toMetaData(ClientEntity entity);
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/ClusterConvertMetaData.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/ClusterConvertMetaData.java
new file mode 100644
index 0000000..9b3be65
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/ClusterConvertMetaData.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.spring.support.metadata.convert;
+
+import org.apache.eventmesh.dashboard.common.model.ConvertMetaData;
+import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+/**
+ *
+ */
+@Mapper
+public interface ClusterConvertMetaData extends ConvertMetaData<ClusterEntity, ClusterMetadata> {
+
+ ClusterConvertMetaData INSTANCE = Mappers.getMapper(ClusterConvertMetaData.class);
+
+ @Override
+ ClusterEntity toEntity(ClusterMetadata meta);
+
+ @Override
+ ClusterMetadata toMetaData(ClusterEntity entity);
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/ConfigConvertMetaData.java
similarity index 64%
rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java
rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/ConfigConvertMetaData.java
index 2afd16c..51e783e 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/ConfigConvertMetaData.java
@@ -15,11 +15,12 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.mapstruct.config;
+package org.apache.eventmesh.dashboard.console.spring.support.metadata.convert;
+import org.apache.eventmesh.dashboard.common.model.ConvertMetaData;
+import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata;
import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
-import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@@ -27,11 +28,14 @@
/**
*
*/
-
@Mapper
-public interface ConfigControllerMapper {
+public interface ConfigConvertMetaData extends ConvertMetaData<ConfigEntity, ConfigMetadata> {
- ConfigControllerMapper INSTANCE = Mappers.getMapper(ConfigControllerMapper.class);
+ ConfigConvertMetaData INSTANCE = Mappers.getMapper(ConfigConvertMetaData.class);
- public ConfigEntity queryEntityByConfig(GetConfigsListDTO getConfigsListDTO);
+ @Override
+ ConfigEntity toEntity(ConfigMetadata meta);
+
+ @Override
+ ConfigMetadata toMetaData(ConfigEntity entity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/ConsumeOffsetConvertMetaData.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/ConsumeOffsetConvertMetaData.java
new file mode 100644
index 0000000..e47a722
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/ConsumeOffsetConvertMetaData.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.spring.support.metadata.convert;
+
+import org.apache.eventmesh.dashboard.common.model.ConvertMetaData;
+import org.apache.eventmesh.dashboard.common.model.metadata.ConsumeOffsetMetadata;
+import org.apache.eventmesh.dashboard.console.entity.message.ConsumeOffsetEntity;
+
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+/**
+ *
+ */
+@Mapper
+public interface ConsumeOffsetConvertMetaData extends ConvertMetaData<ConsumeOffsetEntity, ConsumeOffsetMetadata> {
+
+ ConsumeOffsetConvertMetaData INSTANCE = Mappers.getMapper(ConsumeOffsetConvertMetaData.class);
+
+ @Override
+ ConsumeOffsetEntity toEntity(ConsumeOffsetMetadata meta);
+
+ @Override
+ ConsumeOffsetMetadata toMetaData(ConsumeOffsetEntity entity);
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/GroupConvertMetaData.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/GroupConvertMetaData.java
new file mode 100644
index 0000000..3192db3
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/GroupConvertMetaData.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.spring.support.metadata.convert;
+
+import org.apache.eventmesh.dashboard.common.model.ConvertMetaData;
+import org.apache.eventmesh.dashboard.common.model.metadata.GroupMetadata;
+import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity;
+
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+
+/**
+ *
+ */
+@Mapper
+public interface GroupConvertMetaData extends ConvertMetaData<GroupEntity, GroupMetadata> {
+
+ GroupConvertMetaData INSTANCE = Mappers.getMapper(GroupConvertMetaData.class);
+
+ @Override
+ GroupEntity toEntity(GroupMetadata meta);
+
+ @Override
+ GroupMetadata toMetaData(GroupEntity entity);
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/RuntimeConvertMetaData.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/RuntimeConvertMetaData.java
new file mode 100644
index 0000000..d7bfdec
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/RuntimeConvertMetaData.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.spring.support.metadata.convert;
+
+import org.apache.eventmesh.dashboard.common.model.ConvertMetaData;
+import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+
+
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+
+/**
+ *
+ */
+@Mapper
+public interface RuntimeConvertMetaData extends ConvertMetaData<RuntimeEntity, RuntimeMetadata> {
+
+ RuntimeConvertMetaData INSTANCE = Mappers.getMapper(RuntimeConvertMetaData.class);
+
+ @Override
+ RuntimeEntity toEntity(RuntimeMetadata meta);
+
+ @Override
+ RuntimeMetadata toMetaData(RuntimeEntity entity);
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/TopicConvertMetaData.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/TopicConvertMetaData.java
new file mode 100644
index 0000000..d9f751c
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/TopicConvertMetaData.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.spring.support.metadata.convert;
+
+import org.apache.eventmesh.dashboard.common.model.ConvertMetaData;
+import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata;
+import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity;
+
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+/**
+ *
+ */
+@Mapper
+public interface TopicConvertMetaData extends ConvertMetaData<TopicEntity, TopicMetadata> {
+
+ TopicConvertMetaData INSTANCE = Mappers.getMapper(TopicConvertMetaData.class);
+
+ @Override
+ TopicEntity toEntity(TopicMetadata meta);
+
+ @Override
+ TopicMetadata toMetaData(TopicEntity entity);
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/TopicOffsetConvertMetaData.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/TopicOffsetConvertMetaData.java
new file mode 100644
index 0000000..66c64b7
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/TopicOffsetConvertMetaData.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.spring.support.metadata.convert;
+
+import org.apache.eventmesh.dashboard.common.model.ConvertMetaData;
+import org.apache.eventmesh.dashboard.common.model.metadata.TopicOffsetMetadata;
+import org.apache.eventmesh.dashboard.console.entity.message.TopicOffsetEntity;
+
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+/**
+ *
+ */
+@Mapper
+public interface TopicOffsetConvertMetaData extends ConvertMetaData<TopicOffsetEntity, TopicOffsetMetadata> {
+
+ TopicOffsetConvertMetaData INSTANCE = Mappers.getMapper(TopicOffsetConvertMetaData.class);
+
+ @Override
+ TopicOffsetEntity toEntity(TopicOffsetMetadata meta);
+
+ @Override
+ TopicOffsetMetadata toMetaData(TopicOffsetEntity entity);
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/AbstractBuildMetadata.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/AbstractBuildMetadata.java
new file mode 100644
index 0000000..08e0aae
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/AbstractBuildMetadata.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.spring.support.register;
+
+import org.apache.eventmesh.dashboard.common.port.PortValidate;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ *
+ */
+public abstract class AbstractBuildMetadata implements BuildMetadata {
+
+ private PortValidate portValidate;
+
+
+ protected void setPortValidate(PortValidate portValidate) {
+ this.portValidate = portValidate;
+ }
+
+ @Override
+ public PortValidate portValidate() {
+ return this.portValidate;
+ }
+
+ public char separator() {
+ return ';';
+ }
+
+
+ public String buildRuntime(RuntimeEntity target, RuntimeEntity runtimeEntity) {
+ if (Objects.equals(target.getKubernetesClusterId(), runtimeEntity.getKubernetesClusterId())) {
+ return runtimeEntity.getHost() + ":" + runtimeEntity.getPort() + this.separator();
+ } else {
+ return runtimeEntity.getHost() + ":" + runtimeEntity.getPort() + this.separator();
+ }
+ }
+
+ public String standardRuntime(ScriptBuildData data, RuntimeEntity target, List<RuntimeEntity> runtimeEntityList) {
+ StringBuffer nameService = new StringBuffer();
+ runtimeEntityList.forEach(runtimeEntity -> {
+ nameService.append(this.buildRuntime(target, runtimeEntity));
+ });
+ data.put("metaService", nameService.toString());
+ return nameService.toString();
+ }
+
+ public String generatePropertiesConfig(ScriptBuildData data) {
+ StringBuffer config = new StringBuffer();
+ data.getConfigEntityList().forEach(configEntity -> {
+ config.append(configEntity.getConfigName()).append("=").append(configEntity.getConfigValue()).append(System.lineSeparator());
+ });
+ String runtimeConfig = config.toString();
+ data.put("runtimeConfig", runtimeConfig);
+ return runtimeConfig;
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/BuildMetadata.java
similarity index 61%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/BuildMetadata.java
index 2102c5c..6050e05 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/BuildMetadata.java
@@ -15,36 +15,31 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.cluster;
+package org.apache.eventmesh.dashboard.console.spring.support.register;
-import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.port.PortValidate;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
-import javax.validation.constraints.NotNull;
+import java.util.List;
-import lombok.Data;
-
-@Data
-public class CreateClusterDTO {
-
- @NotNull
- private String name;
-
- @NotNull
- private ClusterTrusteeshipType trusteeshipType;
-
- @NotNull
- private ClusterType clusterType;
-
- @NotNull
- private String version;
+/**
+ *
+ */
+public interface BuildMetadata {
- private String jmxProperties = "";
-
- private String description = "";
+ boolean isMeta();
- private Integer authType = 0;
+ PortValidate portValidate();
+
+
+ List<ClusterType> runtimeTypes();
+
+ void buildMetaAddress(ScriptBuildData data, RuntimeEntity target, List<RuntimeEntity> runtimeMetadataList);
+
+
+ void buildConfig(ScriptBuildData data, RuntimeEntity target);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/BuildMetadataManage.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/BuildMetadataManage.java
new file mode 100644
index 0000000..366edbd
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/BuildMetadataManage.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.spring.support.register;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.port.PortValidate;
+import org.apache.eventmesh.dashboard.common.util.ClasspathScanner;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
+public class BuildMetadataManage {
+
+ private final Map<ClusterType, BuildMetadata> buildMetadataMap = new HashMap<>();
+
+ {
+ Set<Class<?>> interfaceSet = new HashSet<>();
+ interfaceSet.add(BuildMetadata.class);
+ ClasspathScanner classpathScanner =
+ ClasspathScanner.builder().base(BuildMetadata.class).subPath("/**").interfaceSet(interfaceSet).build();
+ try {
+ List<Class<?>> classList = classpathScanner.getClazz();
+ classList.forEach(this::register);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void register(Class<?> clazz) {
+ try {
+ BuildMetadata buildMetadata = (BuildMetadata) clazz.getConstructor().newInstance();
+ buildMetadata.runtimeTypes().forEach(clusterType -> {
+ buildMetadataMap.put(clusterType, buildMetadata);
+ });
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public BuildMetadata getBuildMetaAddress(ClusterType clusterType) {
+ BuildMetadata buildMetadata = this.buildMetadataMap.get(clusterType);
+ if (Objects.isNull(buildMetadata)) {
+ buildMetadata = this.buildMetadataMap.get(clusterType.getAssemblyBusiness());
+ }
+ return buildMetadata;
+ }
+
+
+ public void buildMetaAddress(ScriptBuildData data, RuntimeEntity target, List<RuntimeEntity> runtimeMetadataList) {
+ this.getBuildMetaAddress(target.getClusterType()).buildMetaAddress(data, target, runtimeMetadataList);
+ }
+
+ public void buildConfig(ScriptBuildData data, RuntimeEntity target) {
+ this.getBuildMetaAddress(target.getClusterType()).buildConfig(data, target);
+ }
+
+ public PortValidate getPortValidate(RuntimeEntity target) {
+ return this.getBuildMetaAddress(target.getClusterType()).portValidate();
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/ScriptBuildData.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/ScriptBuildData.java
new file mode 100644
index 0000000..207c481
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/ScriptBuildData.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.spring.support.register;
+
+import org.apache.eventmesh.dashboard.console.entity.cases.ResourcesConfigEntity;
+import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+
+import lombok.Data;
+
+@Data
+public class ScriptBuildData {
+
+ private Map<String, Object> data = new HashMap<String, Object>();
+
+
+ private List<ConfigEntity> configEntityList = new ArrayList<ConfigEntity>();
+
+ public void put(String key, Object value) {
+ data.put(key, value);
+ }
+
+ public void setResourcesConfigEntity(ResourcesConfigEntity resourcesConfigEntity) {
+ JSONObject jsonObject = (JSONObject) JSON.toJSON(resourcesConfigEntity);
+ this.data.putAll(jsonObject);
+ }
+
+ public void setConfigEntityList(List<ConfigEntity> configEntityList) {
+ this.configEntityList.addAll(configEntityList);
+ }
+
+ public void setConfigEntity(ConfigEntity configEntity) {
+ this.configEntityList.add(configEntity);
+ }
+
+}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshException.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/meta/AbstractMetaBuildMetadata.java
similarity index 71%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshException.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/meta/AbstractMetaBuildMetadata.java
index 444e530..c200a36 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshException.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/meta/AbstractMetaBuildMetadata.java
@@ -15,17 +15,19 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.exception;
+package org.apache.eventmesh.dashboard.console.spring.support.register.meta;
+
+import org.apache.eventmesh.dashboard.console.spring.support.register.AbstractBuildMetadata;
/**
- * EventMesh Runtime side exception
+ *
*/
+public abstract class AbstractMetaBuildMetadata extends AbstractBuildMetadata {
-public class EventMeshException extends BaseException {
- private static final long serialVersionUID = 5648256502005456586L;
-
- public EventMeshException(String message) {
- super(message);
+ @Override
+ public boolean isMeta() {
+ return true;
}
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/meta/RocketNameServiceBuildMetadata.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/meta/RocketNameServiceBuildMetadata.java
new file mode 100644
index 0000000..0bb964c
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/meta/RocketNameServiceBuildMetadata.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.spring.support.register.meta;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.port.AbstractPortValidate;
+import org.apache.eventmesh.dashboard.common.port.PortRule;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.spring.support.register.ScriptBuildData;
+
+import java.util.List;
+
+public class RocketNameServiceBuildMetadata extends AbstractMetaBuildMetadata {
+
+
+ {
+ this.setPortValidate(new RocketMQNamePortValidate());
+ }
+
+ @Override
+ public List<ClusterType> runtimeTypes() {
+ return List.of(ClusterType.STORAGE_ROCKETMQ_NAMESERVER);
+ }
+
+
+ @Override
+ public void buildMetaAddress(ScriptBuildData data, RuntimeEntity target, List<RuntimeEntity> runtimeMetadataList) {
+
+ }
+
+ @Override
+ public void buildConfig(ScriptBuildData data, RuntimeEntity target) {
+
+ }
+
+
+ static class RocketMQNamePortValidate extends AbstractPortValidate {
+
+ {
+ PortRule portRule = PortRule.builder().valid(false).build();
+ this.setPortRules(portRule);
+ }
+
+ @Override
+ public boolean validate(PortRule lastPortRule, Integer lastPort, PortRule current, Integer port, List<PortRule> portRules) {
+ return true;
+ }
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/meta/ZookeeperBuildMetadata.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/meta/ZookeeperBuildMetadata.java
new file mode 100644
index 0000000..093e570
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/meta/ZookeeperBuildMetadata.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.spring.support.register.meta;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.port.PortValidate;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.spring.support.register.ScriptBuildData;
+
+import java.util.List;
+
+public class ZookeeperBuildMetadata extends AbstractMetaBuildMetadata {
+
+
+ @Override
+ public PortValidate portValidate() {
+ return null;
+ }
+
+ @Override
+ public List<ClusterType> runtimeTypes() {
+ return List.of(ClusterType.META_TYPE_ZK);
+ }
+
+
+ @Override
+ public void buildMetaAddress(ScriptBuildData data, RuntimeEntity target, List<RuntimeEntity> runtimeMetadataList) {
+
+ }
+
+ @Override
+ public void buildConfig(ScriptBuildData data, RuntimeEntity target) {
+
+ }
+}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshException.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/runtime/AbstractRuntimeBuildMetadata.java
similarity index 71%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshException.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/runtime/AbstractRuntimeBuildMetadata.java
index 444e530..68abe5d 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/exception/EventMeshException.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/runtime/AbstractRuntimeBuildMetadata.java
@@ -15,17 +15,18 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.exception;
+package org.apache.eventmesh.dashboard.console.spring.support.register.runtime;
+
+import org.apache.eventmesh.dashboard.console.spring.support.register.AbstractBuildMetadata;
/**
- * EventMesh Runtime side exception
+ *
*/
+public abstract class AbstractRuntimeBuildMetadata extends AbstractBuildMetadata {
-public class EventMeshException extends BaseException {
-
- private static final long serialVersionUID = 5648256502005456586L;
-
- public EventMeshException(String message) {
- super(message);
+ @Override
+ public boolean isMeta() {
+ return false;
}
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/runtime/EventMethRuntimeBuildMetadata.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/runtime/EventMethRuntimeBuildMetadata.java
new file mode 100644
index 0000000..1b3aaef
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/runtime/EventMethRuntimeBuildMetadata.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.spring.support.register.runtime;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.port.AbstractPortValidate;
+import org.apache.eventmesh.dashboard.common.port.PortRule;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.spring.support.register.ScriptBuildData;
+
+import java.util.List;
+import java.util.Objects;
+
+public class EventMethRuntimeBuildMetadata extends AbstractRuntimeBuildMetadata {
+
+ {
+ EventmeshPortValidate runTimeValidate = new EventmeshPortValidate();
+ setPortValidate(runTimeValidate);
+ }
+
+ @Override
+ public List<ClusterType> runtimeTypes() {
+ return List.of(ClusterType.EVENTMESH_RUNTIME);
+ }
+
+
+ @Override
+ public void buildMetaAddress(ScriptBuildData data, RuntimeEntity target, List<RuntimeEntity> runtimeMetadataList) {
+ ClusterType clusterType = runtimeMetadataList.get(0).getClusterType();
+ if (clusterType.isEventMethMeta()) {
+ StringBuffer nameService = new StringBuffer();
+ runtimeMetadataList.forEach(runtimeMetadata -> {
+ if (Objects.equals(target.getKubernetesClusterId(), runtimeMetadata.getKubernetesClusterId())) {
+ nameService.append(runtimeMetadata.getHost()).append(":").append(runtimeMetadata.getPort()).append(";");
+ } else {
+ nameService.append(runtimeMetadata.getHost()).append(":").append(runtimeMetadata.getPort()).append(";");
+ }
+ });
+ data.put("metaService", nameService.toString());
+ }
+ if (clusterType.isStorageMeta()) {
+ //
+ }
+ }
+
+ @Override
+ public void buildConfig(ScriptBuildData data, RuntimeEntity target) {
+ this.generatePropertiesConfig(data);
+ }
+
+ static class EventmeshPortValidate extends AbstractPortValidate {
+
+
+ {
+ this.createNotValid(List.of("tcpPort", "httpPort", "grpcPort", "adminPort"));
+ }
+
+ @Override
+ public boolean validate(PortRule lastPortRule, Integer lastPort, PortRule current, Integer port, List<PortRule> portRules) {
+ return true;
+ }
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/runtime/RocketMQBuildMetadata.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/runtime/RocketMQBuildMetadata.java
new file mode 100644
index 0000000..e9bd729
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/register/runtime/RocketMQBuildMetadata.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.spring.support.register.runtime;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.port.AbstractPortValidate;
+import org.apache.eventmesh.dashboard.common.port.PortRule;
+import org.apache.eventmesh.dashboard.common.port.PortValidate;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.spring.support.register.ScriptBuildData;
+
+import java.util.List;
+import java.util.Objects;
+
+public class RocketMQBuildMetadata extends AbstractRuntimeBuildMetadata {
+
+ {
+ PortValidate portValidate = new RocketMQBrokerPortValidate();
+ this.setPortValidate(portValidate);
+ }
+
+ @Override
+ public List<ClusterType> runtimeTypes() {
+ return List.of(ClusterType.STORAGE_ROCKETMQ_BROKER_MAIN_SLAVE, ClusterType.STORAGE_ROCKETMQ_BROKER_RAFT);
+ }
+
+
+ @Override
+ public void buildMetaAddress(ScriptBuildData data, RuntimeEntity target, List<RuntimeEntity> runtimeMetadataList) {
+ this.standardRuntime(data, target, runtimeMetadataList);
+ }
+
+ @Override
+ public void buildConfig(ScriptBuildData data, RuntimeEntity target) {
+
+ }
+
+ static class RocketMQBrokerPortValidate extends AbstractPortValidate {
+
+
+ {
+ PortRule portRule = PortRule.builder().valid(true).index(1).name("fastPort").build();
+ this.setPortRules(portRule);
+ portRule = PortRule.builder().valid(true).index(2).name("nullPort").spanValue(1).build();
+ this.setPortRules(portRule);
+ portRule = PortRule.builder().valid(true).index(3).name("port").spanValue(1).build();
+ this.setPortRules(portRule);
+ }
+
+ @Override
+ public boolean validate(PortRule lastPortRule, Integer lastPort, PortRule current, Integer port, List<PortRule> portRules) {
+ if (Objects.equals(lastPortRule.getIndex(), 1)) {
+ return true;
+ }
+ return true;
+ }
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/utils/RuntimeUtils.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/utils/RuntimeUtils.java
new file mode 100644
index 0000000..87ea33e
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/utils/RuntimeUtils.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.utils;
+
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class RuntimeUtils {
+
+
+ public Map<Long, List<RuntimeEntity>> groupByClusterId(List<RuntimeEntity> runtimeEntityList) {
+ Map<Long, List<RuntimeEntity>> runtimeEntityMap = new HashMap<Long, List<RuntimeEntity>>();
+ runtimeEntityList.forEach(entity -> {
+ runtimeEntityMap.computeIfAbsent(entity.getClusterId(), k -> new ArrayList<>()).add(entity);
+ });
+ return runtimeEntityMap;
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/main/resources/RENAME.md b/eventmesh-dashboard-console/src/main/resources/RENAME.md
new file mode 100644
index 0000000..fe5c9b4
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/resources/RENAME.md
@@ -0,0 +1,38 @@
+
+无法进行确认,支持同类型修改
+
+1. 用户进来,是进入默认组织 首页
+2. 通过左上角切换
+3. 组织视图与 cluster 共存,这样是否会出现三级路由
+4. 人员添加,可以从组织添加,也可以从 cluster 里面添加。如果从 cluster 里面添加,是否就属于合格组织一员?
+5. 资源维度,是否是cluster 的
+
+6. 删除 topic 之后,同时需要作废对应的 订阅吗?
+7. 删除 group 之后,同时需要作废对应的 订阅吗?
+8. 删除 cluster 或则 runtime 之后对应的信息是否全部作废。
+9. 暂停状态数据如何标记,激活 对应的 metadata 之前相关的数据是否启动
+10. 删除 cluster 之前之后校验 关联。如何关联存在是否允许删除
+11. kafka 的查询维度全是 cluster
+12. RocketMQ 大集群查询,是否支持 metadata 数据查询,如何对数据进行展示? 是否现实差异化,是否提示差异字段
+ 1. 那些 topic 有差异?
+ 2. 是否配置 不允许有差异?
+ 3. 如果不允许有差异, console 进行处理的 metadata 是否要进行具体标识
+14. RocketMQ 支持大集群,小集群,runtime 维度的展示
+
+
+项目发起人,项目架构师,项目设计师,项目经理,
+交互设计师,半个ui设计
+前端,后台,运维,产品,测试,
+
+
+## 用户域
+### 用户首页
+1. 查看 组织
+
+### 组织首页
+1. 左边是一级菜单:
+ 1. 工作台
+ 2. eventmesh集群
+ 3.
+1. 集群信息
+ 2. 集群列表
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/main/resources/application-dev.yml b/eventmesh-dashboard-console/src/main/resources/application-dev.yml
index 6ebdf9c..b5f7118 100644
--- a/eventmesh-dashboard-console/src/main/resources/application-dev.yml
+++ b/eventmesh-dashboard-console/src/main/resources/application-dev.yml
@@ -17,6 +17,8 @@
server:
port: 9898
+ servlet:
+ context-path: "/eventmesh/dashboard"
spring:
servlet:
@@ -32,7 +34,7 @@
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${DB_ADDRESS:localhost:3306}/eventmesh_dashboard?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true
username: ${DB_USERNAME:root}
- password: ${DB_PASSWORD:password}
+ password: ${DB_PASSWORD:Ab123123@}
initial-size: 1
max-active: 50
@@ -62,17 +64,4 @@
function:
- healthCheck:
- doCheck:
- initialDelay: 60
- period: 60
- updateConfig:
- initialDelay: 30
- period: 60
- sync:
- enable: true
- initialDelay: 120
- period: 60
- toDb:
- runtime: true
-
+ enabled: false
diff --git a/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.jmx b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.jmx
new file mode 100644
index 0000000..2422678
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.jmx
@@ -0,0 +1,271 @@
+
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<?xml version="1.0" encoding="UTF-8"?>
+<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.1.1 r1855137">
+ <hashTree>
+ <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="测试计划" enabled="true">
+ <stringProp name="TestPlan.comments"></stringProp>
+ <boolProp name="TestPlan.functional_mode">false</boolProp>
+ <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
+ <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
+ <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="用户定义的变量" enabled="true">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="TestPlan.user_define_classpath"></stringProp>
+ </TestPlan>
+ <hashTree>
+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="线程组" enabled="true">
+ <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
+ <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="循环控制器" enabled="true">
+ <boolProp name="LoopController.continue_forever">false</boolProp>
+ <stringProp name="LoopController.loops">1</stringProp>
+ </elementProp>
+ <stringProp name="ThreadGroup.num_threads">1</stringProp>
+ <stringProp name="ThreadGroup.ramp_time">1</stringProp>
+ <boolProp name="ThreadGroup.scheduler">false</boolProp>
+ <stringProp name="ThreadGroup.duration"></stringProp>
+ <stringProp name="ThreadGroup.delay"></stringProp>
+ </ThreadGroup>
+ <hashTree>
+ <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="用户定义的变量" enabled="true">
+ <collectionProp name="Arguments.arguments">
+ <elementProp name="host" elementType="Argument">
+ <stringProp name="Argument.name">host</stringProp>
+ <stringProp name="Argument.value">127.0.0.1</stringProp>
+ <stringProp name="Argument.metadata">=</stringProp>
+ </elementProp>
+ <elementProp name="port" elementType="Argument">
+ <stringProp name="Argument.name">port</stringProp>
+ <stringProp name="Argument.value">9898</stringProp>
+ <stringProp name="Argument.metadata">=</stringProp>
+ </elementProp>
+ <elementProp name="path" elementType="Argument">
+ <stringProp name="Argument.name">path</stringProp>
+ <stringProp name="Argument.value">/eventmesh/dashboard/</stringProp>
+ <stringProp name="Argument.metadata">=</stringProp>
+ </elementProp>
+ </collectionProp>
+ </Arguments>
+ <hashTree/>
+ <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP信息头管理器" enabled="true">
+ <collectionProp name="HeaderManager.headers">
+ <elementProp name="" elementType="Header">
+ <stringProp name="Header.name">content-type</stringProp>
+ <stringProp name="Header.value">application/json</stringProp>
+ </elementProp>
+ <elementProp name="" elementType="Header">
+ <stringProp name="Header.name">queryClause</stringProp>
+ <stringProp name="Header.value">{"limitPageNum":1,limitSize:10}</stringProp>
+ </elementProp>
+ </collectionProp>
+ </HeaderManager>
+ <hashTree/>
+ <TestFragmentController guiclass="TestFragmentControllerGui" testclass="TestFragmentController" testname="Runtime " enabled="false"/>
+ <hashTree>
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="通过 clusterId 查询runtime" enabled="true">
+ <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
+ <collectionProp name="Arguments.arguments">
+ <elementProp name="" elementType="HTTPArgument">
+ <boolProp name="HTTPArgument.always_encode">false</boolProp>
+ <stringProp name="Argument.value">{
+ "clusterId":1
+}</stringProp>
+ <stringProp name="Argument.metadata">=</stringProp>
+ </elementProp>
+ </collectionProp>
+ </elementProp>
+ <stringProp name="HTTPSampler.domain">${host}</stringProp>
+ <stringProp name="HTTPSampler.port">${port}</stringProp>
+ <stringProp name="HTTPSampler.protocol"></stringProp>
+ <stringProp name="HTTPSampler.contentEncoding"></stringProp>
+ <stringProp name="HTTPSampler.path">${path}/runtime/queryRuntimeListByClusterId</stringProp>
+ <stringProp name="HTTPSampler.method">POST</stringProp>
+ <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
+ <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
+ <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
+ <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
+ <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
+ <stringProp name="HTTPSampler.connect_timeout"></stringProp>
+ <stringProp name="HTTPSampler.response_timeout"></stringProp>
+ </HTTPSamplerProxy>
+ <hashTree/>
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="通过 runtimeId 查询runtime" enabled="true">
+ <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
+ <collectionProp name="Arguments.arguments">
+ <elementProp name="" elementType="HTTPArgument">
+ <boolProp name="HTTPArgument.always_encode">false</boolProp>
+ <stringProp name="Argument.value">{
+ "id":1
+}</stringProp>
+ <stringProp name="Argument.metadata">=</stringProp>
+ </elementProp>
+ </collectionProp>
+ </elementProp>
+ <stringProp name="HTTPSampler.domain">${host}</stringProp>
+ <stringProp name="HTTPSampler.port">${port}</stringProp>
+ <stringProp name="HTTPSampler.protocol"></stringProp>
+ <stringProp name="HTTPSampler.contentEncoding"></stringProp>
+ <stringProp name="HTTPSampler.path">${path}/runtime/queryRuntimeListByClusterId</stringProp>
+ <stringProp name="HTTPSampler.method">POST</stringProp>
+ <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
+ <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
+ <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
+ <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
+ <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
+ <stringProp name="HTTPSampler.connect_timeout"></stringProp>
+ <stringProp name="HTTPSampler.response_timeout"></stringProp>
+ </HTTPSamplerProxy>
+ <hashTree/>
+ </hashTree>
+ <TestFragmentController guiclass="TestFragmentControllerGui" testclass="TestFragmentController" testname="cluster" enabled="false"/>
+ <hashTree>
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="查询组织下 某个 cluster type 的 cluster" enabled="true">
+ <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
+ <collectionProp name="Arguments.arguments">
+ <elementProp name="" elementType="HTTPArgument">
+ <boolProp name="HTTPArgument.always_encode">false</boolProp>
+ <stringProp name="Argument.value">{
+ "clusterId":1,
+ "clusterType": "EVENTMESH_CLUSTER"
+}</stringProp>
+ <stringProp name="Argument.metadata">=</stringProp>
+ </elementProp>
+ </collectionProp>
+ </elementProp>
+ <stringProp name="HTTPSampler.domain">${host}</stringProp>
+ <stringProp name="HTTPSampler.port">${port}</stringProp>
+ <stringProp name="HTTPSampler.protocol"></stringProp>
+ <stringProp name="HTTPSampler.contentEncoding"></stringProp>
+ <stringProp name="HTTPSampler.path">${path}/user/cluster/createEventMeshClusterByOnlyData</stringProp>
+ <stringProp name="HTTPSampler.method">POST</stringProp>
+ <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
+ <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
+ <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
+ <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
+ <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
+ <stringProp name="HTTPSampler.connect_timeout"></stringProp>
+ <stringProp name="HTTPSampler.response_timeout"></stringProp>
+ </HTTPSamplerProxy>
+ <hashTree/>
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="查询组织下 某个 cluster type 的 cluster" enabled="true">
+ <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
+ <collectionProp name="Arguments.arguments">
+ <elementProp name="" elementType="HTTPArgument">
+ <boolProp name="HTTPArgument.always_encode">false</boolProp>
+ <stringProp name="Argument.value">{
+ "clusterId":1,
+ "clusterType": "EVENTMESH_CLUSTER"
+}</stringProp>
+ <stringProp name="Argument.metadata">=</stringProp>
+ </elementProp>
+ </collectionProp>
+ </elementProp>
+ <stringProp name="HTTPSampler.domain">${host}</stringProp>
+ <stringProp name="HTTPSampler.port">${port}</stringProp>
+ <stringProp name="HTTPSampler.protocol"></stringProp>
+ <stringProp name="HTTPSampler.contentEncoding"></stringProp>
+ <stringProp name="HTTPSampler.path">${path}/user/cluster/queryClusterByOrganizationIdAndType</stringProp>
+ <stringProp name="HTTPSampler.method">POST</stringProp>
+ <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
+ <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
+ <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
+ <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
+ <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
+ <stringProp name="HTTPSampler.connect_timeout"></stringProp>
+ <stringProp name="HTTPSampler.response_timeout"></stringProp>
+ </HTTPSamplerProxy>
+ <hashTree/>
+ </hashTree>
+ <TestFragmentController guiclass="TestFragmentControllerGui" testclass="TestFragmentController" testname="clusterCycle" enabled="true"/>
+ <hashTree>
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="创建 eventmesh 集群" enabled="true">
+ <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
+ <collectionProp name="Arguments.arguments">
+ <elementProp name="" elementType="HTTPArgument">
+ <boolProp name="HTTPArgument.always_encode">false</boolProp>
+ <stringProp name="Argument.value">{
+ "name": "test",
+ "description": "111"
+}</stringProp>
+ <stringProp name="Argument.metadata">=</stringProp>
+ </elementProp>
+ </collectionProp>
+ </elementProp>
+ <stringProp name="HTTPSampler.domain">${host}</stringProp>
+ <stringProp name="HTTPSampler.port">${port}</stringProp>
+ <stringProp name="HTTPSampler.protocol"></stringProp>
+ <stringProp name="HTTPSampler.contentEncoding"></stringProp>
+ <stringProp name="HTTPSampler.path">${path}/organization/clusterCycleDeploy/createEventMeshClusterByOnlyData</stringProp>
+ <stringProp name="HTTPSampler.method">POST</stringProp>
+ <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
+ <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
+ <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
+ <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
+ <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
+ <stringProp name="HTTPSampler.connect_timeout"></stringProp>
+ <stringProp name="HTTPSampler.response_timeout"></stringProp>
+ </HTTPSamplerProxy>
+ <hashTree/>
+ </hashTree>
+ <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="察看结果树" enabled="true">
+ <boolProp name="ResultCollector.error_logging">false</boolProp>
+ <objProp>
+ <name>saveConfig</name>
+ <value class="SampleSaveConfiguration">
+ <time>true</time>
+ <latency>true</latency>
+ <timestamp>true</timestamp>
+ <success>true</success>
+ <label>true</label>
+ <code>true</code>
+ <message>true</message>
+ <threadName>true</threadName>
+ <dataType>true</dataType>
+ <encoding>false</encoding>
+ <assertions>true</assertions>
+ <subresults>true</subresults>
+ <responseData>false</responseData>
+ <samplerData>false</samplerData>
+ <xml>false</xml>
+ <fieldNames>true</fieldNames>
+ <responseHeaders>false</responseHeaders>
+ <requestHeaders>false</requestHeaders>
+ <responseDataOnError>false</responseDataOnError>
+ <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
+ <assertionsResultsToSave>0</assertionsResultsToSave>
+ <bytes>true</bytes>
+ <sentBytes>true</sentBytes>
+ <url>true</url>
+ <threadCounts>true</threadCounts>
+ <idleTime>true</idleTime>
+ <connectTime>true</connectTime>
+ </value>
+ </objProp>
+ <stringProp name="filename"></stringProp>
+ </ResultCollector>
+ <hashTree/>
+ </hashTree>
+ </hashTree>
+ </hashTree>
+</jmeterTestPlan>
diff --git a/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql
index 50056d0..9cb612f 100644
--- a/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql
+++ b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql
@@ -1,35 +1,90 @@
/*
- * licensed to the apache software foundation (asf) under one or more
- * contributor license agreements. see the notice file distributed with
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
- * the asf licenses this file to you under the apache license, version 2.0
- * (the "license"); you may not use this file except in compliance with
- * the license. you may obtain a copy of the license at
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/license-2.0
+ * 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.
+ * 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.
*/
+
+
+drop table if exists `case`;
+
+create table `case`
+(
+ id bigint unsigned primary key auto_increment comment 'id',
+ organization_id bigint unsigned not null comment '组织id',
+ name varchar(128) not null comment '案例名',
+ case_type varchar(16) not null comment '案例类型',
+ object_type varchar(16) not null comment '对象类型',
+ object_id varchar(32) not null comment '',
+ status int not null default 1 comment '',
+ create_time timestamp not null default current_timestamp comment '接入时间',
+ update_time timestamp not null default current_timestamp on update current_timestamp comment '修改时间',
+ is_delete int not null default 0 comment '数据逻辑标记',
+ key object_type_id (object_type, object_id)
+) comment ='';
+
+drop table if exists `resources_config`;
+
+create table `resources_config`
+(
+ id bigint unsigned primary key auto_increment comment 'id',
+ organization_id bigint unsigned not null comment '组织id',
+ name varchar(128) not null comment '案例名',
+ object_type varchar(16) not null comment '对象类型',
+ object_id varchar(32) not null comment '',
+ cpu_num int not null comment '',
+ men_num int not null comment '',
+ disk_num int not null comment '',
+ gpu_num int not null comment '',
+ status int not null default 1 comment '',
+ create_time timestamp not null default current_timestamp comment '接入时间',
+ update_time timestamp not null default current_timestamp on update current_timestamp comment '修改时间',
+ is_delete int not null default 0 comment '数据逻辑标记',
+ key object_type_id (object_type, object_id)
+) comment ='资源配置表';
+
drop table if exists `cluster`;
create table cluster
(
- id bigint unsigned primary key auto_increment comment '集群id',
- name varchar(128) not null comment '集群名称',
- cluster_type varchar(16) not null comment '集群类型',
- trusteeship_type varchar(16) not null comment '托管类型',
- version varchar(32) not null comment 'eventmesh版本',
- jmx_properties text comment 'jmx配置',
- description text comment '备注',
- auth_type int not null default 0 comment '认证类型,-1未知,0:无认证,',
- run_state tinyint not null default 1 comment '运行状态, 0表示未监控, 1监控中,有注册中心,2:监控中,无注册中心',
- status int not null default 1 comment '0',
- create_time timestamp not null default current_timestamp comment '接入时间',
- update_time timestamp not null default current_timestamp on update current_timestamp comment '修改时间',
- is_delete int not null default 0 comment '数据逻辑标记',
+ id bigint unsigned primary key auto_increment comment '集群id',
+ organization_id bigint unsigned not null comment '组织id',
+ cluster_type varchar(64) not null comment '集群类型',
+ name varchar(128) not null comment '集群名称',
+ version varchar(32) not null comment 'eventmesh版本',
+ cluster_index int not null default 0 comment '在 集群里面的索引',
+ jmx_properties varchar(256) not null default '' comment 'jmx配置',
+ trusteeship_type varchar(32) not null comment '托管类型',
+ cluster_own_type varchar(32) not null comment '共享类型',
+ runtime_index int not null default 0 comment 'runtime索引值',
+ first_to_whom varchar(16) not null comment '第一次同步模式',
+ first_sync_state varchar(16) not null default 'NOT' comment '第一次同步结果',
+ replication_type varchar(16) not null comment '复制模式',
+ sync_error_type varchar(16) not null default 'NOT' comment '同步数据异常标识字段',
+ deploy_status_type varchar(16) not null comment '部署进行中状态',
+ resources_config_id varchar(16) not null comment '默认部署配置',
+ deploy_script_id bigint unsigned not null comment '默认部署脚本id',
+ deploy_script_name varchar(16) not null default '' comment '脚本名字',
+ deploy_script_version varchar(16) not null default '' comment '脚本版本',
+ config varchar(8192) not null comment '集群配置',
+ description text comment '备注',
+ auth_type varchar(32) not null default 0 comment '认证类型,-1未知,0:无认证,',
+ run_state tinyint not null default 1 comment '运行状态, 0表示未监控, 1监控中,有注册中心,2:监控中,无注册中心',
+ online_timestamp datetime not null default current_timestamp comment '上线时间',
+ offline_timestamp datetime not null default current_timestamp comment '下线时间',
+ status int not null default 1 comment '0',
+ create_time timestamp not null default current_timestamp comment '接入时间',
+ update_time timestamp not null default current_timestamp on update current_timestamp comment '修改时间',
+ is_delete int not null default 0 comment '数据逻辑标记',
unique key uniq_name (name)
) comment '物理集群信息表';
@@ -38,14 +93,15 @@
create table `cluster_relationship`
(
id bigint unsigned primary key auto_increment,
- cluster_type varchar(16) not null comment '集群类型',
- cluster_id bigint not null comment '集群id',
- relationship_type varchar(16) not null comment '集群类型',
- relationship_id bigint not null comment '集群id',
- create_time timestamp not null default current_timestamp comment '创建时间',
- update_time timestamp not null default current_timestamp on update current_timestamp comment '修改时间',
- status int not null default 1 comment '0',
- is_delete int not null default 0 comment '0',
+ organization_id bigint unsigned not null comment '组织id',
+ cluster_type varchar(63) not null comment '主集群类型',
+ cluster_id bigint not null comment '主集群id',
+ relationship_type varchar(63) not null comment '关联集群类型',
+ relationship_id bigint not null comment '关联集群id',
+ create_time timestamp not null default current_timestamp comment '创建时间',
+ update_time timestamp not null default current_timestamp on update current_timestamp comment '修改时间',
+ status int not null default 1 comment '0',
+ is_delete int not null default 0 comment '0',
unique key cluster_id_relationship_id_unique (`cluster_id`, `relationship_id`),
key cluster_id_key (`cluster_id`),
key relationship_id_key (`relationship_id`)
@@ -54,43 +110,65 @@
drop table if exists `config`;
create table config
(
- id bigint unsigned auto_increment primary key,
- cluster_id bigint not null comment '集群id',
- instance_type tinyint not null comment '实例类型 0:runtime,1:storage,2:connector,3:topic',
- instance_id bigint not null default -1 comment '实例id,上面配置对应的(比如runtime)的id,如果是-1,是cluster的配置',
- config_type varchar(31) not null default '' comment '配置类型',
- config_name varchar(192) not null comment '配置名称',
- config_value text not null comment '配置值',
- start_version varchar(64) not null default '' comment '配置开始使用的版本',
- end_version varchar(64) not null default '' comment '配置结束使用的版本',
- status int not null default 1 comment '0 关闭 1 开启 ',
- is_default int not null default 1,
- diff_type int not null default -1 comment '差异类型',
- description varchar(1000) not null default '' comment '备注',
- edit int not null default 1 comment '是否可以编辑 1 不可编辑(程序获取) 2 可编辑',
- create_time timestamp not null default current_timestamp comment '创建时间',
- update_time timestamp not null default current_timestamp on update current_timestamp comment '修改时间',
- is_modify int not null default 0,
- already_update int not null default 0 comment '0:no,1:yes',
- is_delete int not null default 0 comment '0',
+ id bigint unsigned auto_increment primary key,
+ organization_id bigint unsigned not null comment '组织id',
+ cluster_id bigint not null comment '集群id',
+ instance_type tinyint not null comment '实例类型 0:runtime,1:storage,2:connector,3:topic',
+ instance_id bigint not null default -1 comment '实例id,上面配置对应的(比如runtime)的id,如果是-1,是cluster的配置',
+ config_type varchar(31) not null default '' comment '配置类型',
+ config_name varchar(192) not null comment '配置名称',
+ config_value text not null comment '配置值',
+ start_version varchar(64) not null default '' comment '配置开始使用的版本',
+ end_version varchar(64) not null default '' comment '配置结束使用的版本',
+ status int not null default 1 comment '0 关闭 1 开启 ',
+ is_default int not null default 1,
+ diff_type int not null default -1 comment '差异类型',
+ description varchar(1000) not null default '' comment '备注',
+ edit int not null default 1 comment '是否可以编辑 1 不可编辑(程序获取) 2 可编辑',
+ create_time timestamp not null default current_timestamp comment '创建时间',
+ update_time timestamp not null default current_timestamp on update current_timestamp comment '修改时间',
+ is_modify int not null default 0 comment '是否修改元版本数据',
+ already_update int not null default 0 comment '0:no,1:yes',
+ is_delete int not null default 0 comment '0',
unique key uniq_cluster_id_instance_type_instance_id_config_name (instance_id, config_name, instance_type, cluster_id)
) comment '配置信息表';
+drop table if exists `topic`;
+create table `topic`
+(
+ `id` bigint unsigned primary key auto_increment comment 'id',
+ `cluster_id` bigint not null default '-1' comment '集群id',
+ runtime_id bigint unsigned not null default 0 comment 'kafka 没有runtime',
+ `topic_name` varchar(192) not null default '' comment 'topic名称',
+ topic_type varchar(16) not null default '' comment 'topic 类型。用户,broker,console,console',
+ read_queue_num int not null default 8 comment '读队列数量',
+ write_queue_num int not null default 8 comment '写队列数量',
+ replication_factor int not null default 0 comment '副本数量',
+ `order` int not null default 0 comment '是否是定时队列',
+ `status` int not null default 1,
+ `create_progress` int not null default 1 comment '0:创建成功,1:创建中,2:创建失败',
+ `retention_ms` bigint not null default '-2' comment '保存时间,-2:未知,-1:无限制,>=0对应时间,单位ms',
+ `description` varchar(1024) default '' comment '备注信息',
+ `create_time` timestamp not null default current_timestamp comment '创建时间(尽量与topic实际创建时间一致)',
+ `update_time` timestamp not null default current_timestamp on update current_timestamp comment '修改时间(尽量与topic实际创建时间一致)',
+ `is_delete` int not null default '0',
+ unique key `uniq_cluster_phy_id_topic_name` (`cluster_id`, `topic_name`)
+) comment ='topic信息表';
drop table if exists `group`;
create table `group`
(
- id bigint unsigned primary key auto_increment comment 'id',
- cluster_id bigint not null comment '集群id',
- name varchar(192) not null comment 'group名称',
- member_count int unsigned not null default '0' comment '成员数',
- members text null comment 'group的member列表',
- type tinyint not null comment 'group类型 0:consumer 1:producer',
- state varchar(64) not null default '' comment '状态',
- create_time timestamp not null default current_timestamp comment '创建时间',
- update_time timestamp not null default current_timestamp on update current_timestamp comment '修改时间',
- status int not null default 1,
- is_delete int not null default 0 comment '0',
+ id bigint unsigned primary key auto_increment comment 'id',
+ organization_id bigint unsigned not null comment '组织id',
+ cluster_id bigint not null comment '集群id',
+ name varchar(192) not null comment 'group名称',
+ type tinyint not null comment 'group类型 0:consumer 1:producer',
+ own_type varchar(16) not null default '' comment 'topic 类型。用户,broker,console,console',
+ state varchar(64) not null default '' comment '状态',
+ create_time timestamp not null default current_timestamp comment '创建时间',
+ update_time timestamp not null default current_timestamp on update current_timestamp comment '修改时间',
+ status int not null default 1,
+ is_delete int not null default 0 comment '0',
unique key uniq_cluster_phy_id_name (cluster_id, name)
) comment 'group信息表';
@@ -98,16 +176,17 @@
drop table if exists group_member;
create table group_member
(
- id bigint unsigned primary key auto_increment comment 'id',
- cluster_id bigint default -1 not null comment '集群id',
- topic_name varchar(192) default '' not null comment 'topic名称',
- group_name varchar(192) default '' not null comment 'group名称',
- eventmesh_user varchar(192) default '' not null comment 'eventmesh用户',
- state varchar(64) default '' not null comment '状态',
- create_time timestamp default current_timestamp not null comment '创建时间',
- update_time timestamp default current_timestamp on update current_timestamp not null comment '修改时间',
- status int default 1 not null,
- is_delete int not null default 0 comment '0',
+ id bigint unsigned primary key auto_increment comment 'id',
+ organization_id bigint unsigned not null comment '组织id',
+ cluster_id bigint not null default -1 comment '集群id',
+ topic_name varchar(192) not null default '' comment 'topic名称',
+ group_name varchar(192) not null default '' comment 'group名称',
+ eventmesh_user varchar(192) not null default '' comment 'eventmesh用户',
+ state varchar(64) not null default '' comment '状态',
+ create_time timestamp not null default current_timestamp comment '创建时间',
+ update_time timestamp not null default current_timestamp on update current_timestamp comment '修改时间',
+ status int not null default 1,
+ is_delete int not null default 0 comment '0',
unique key uniq_cluster_topic_group (cluster_id, topic_name, group_name)
) comment 'groupmember信息表';
@@ -115,20 +194,39 @@
drop table if exists runtime;
create table runtime
(
- id bigint primary key auto_increment comment 'id',
- cluster_id bigint not null comment '物理集群id',
- `name` varchar(128) not null comment 'runtime名称',
- host varchar(128) not null comment 'runtime主机名',
- port varchar(128) not null comment 'runtime端口',
- jmx_port int not null default -1 comment 'jmx端口',
- start_timestamp timestamp not null default current_timestamp comment '启动时间',
- rack varchar(128) not null default '' comment 'rack信息',
- status int not null default 1 comment '状态: 1启用,0未启用',
- create_time timestamp not null default current_timestamp comment '创建时间',
- update_time timestamp not null default current_timestamp on update current_timestamp comment '修改时间',
- endpoint_map varchar(1024) not null default '' comment '监听信息',
- is_delete int not null default 0 comment '0',
- unique key uniq_cluster_phy_id__host_port (cluster_id, host)
+ id bigint primary key auto_increment comment 'id',
+ organization_id bigint unsigned not null comment '组织id',
+ cluster_id bigint not null default -1 comment '集群id',
+ cluster_type varchar(63) not null comment '集群类型',
+ `name` varchar(128) not null comment '节点名字',
+ host int not null comment 'runtime 对外的 IP,kubernetes这个ip 有问题',
+ port int not null comment 'runtime port',
+ runtime_index int not null default -1 comment 'runtime 在 cluster 里面的索引',
+ version varchar(32) not null comment 'runtime版本',
+ jmx_port varchar(256) not null default '' comment 'jmx配置',
+ trusteeship_type varchar(16) not null comment '托管类型',
+ first_to_whom varchar(16) not null comment '第一次同步模式',
+ first_sync_state varchar(16) not null default 'NOT' comment '第一次同步结果',
+ replication_type varchar(16) not null comment '节点在集群的复制类型',
+ sync_error_type varchar(16) not null default 'NOT' comment '同步数据异常标识字段',
+ deploy_status_type varchar(16) not null comment '部署进行中状态',
+ kubernetes_cluster_id bigint unique not null default 0 comment 'kubernetes cluster id',
+ create_script_content text not null comment ' kubernetes 创建时的内容',
+ resources_config_id varchar(16) not null comment '默认部署配置',
+ deploy_script_id bigint unsigned not null comment '默认部署脚本id',
+ deploy_script_name varchar(16) not null default '' comment '脚本名字',
+ deploy_script_version varchar(16) not null default '' comment '脚本版本',
+ auth_type varchar(16) not null default '' comment '认真类型',
+ description text comment '备注',
+ rack varchar(128) not null default '' comment '哪个机架信息',
+ status int not null default 1 comment '状态: 1启用,0未启用',
+ online_timestamp datetime not null default current_timestamp comment '上线时间',
+ offline_timestamp datetime not null default current_timestamp comment '下线时间',
+ create_time timestamp not null default current_timestamp comment '创建时间',
+ update_time timestamp not null default current_timestamp on update current_timestamp comment '修改时间',
+ endpoint_map varchar(1024) not null default '' comment '监听信息',
+ is_delete int not null default 0 comment '0',
+ unique key uniq_cluster_phy_id_host_port (cluster_id, host)
) comment 'runtime信息表';
drop table if exists `client`;
@@ -213,42 +311,6 @@
-drop table if exists `group`;
-create table `group`
-(
- `id` bigint unsigned primary key auto_increment comment 'id',
- `cluster_id` bigint not null default '-1' comment '集群id',
- `name` varchar(192) not null default '' comment 'group名称',
- `member_count` int unsigned not null default '0' comment '成员数',
- `members` varchar(1024) not null default '' comment 'group的member列表',
- `type` tinyint not null comment 'group类型 0:consumer 1:producer',
- `state` varchar(64) not null default '' comment '状态',
- `create_time` timestamp not null default current_timestamp comment '创建时间',
- `update_time` timestamp not null default current_timestamp on update current_timestamp comment '修改时间',
- `status` int not null default 1,
- unique key `uniq_cluster_phy_id_name` (`cluster_id`, `name`),
- key `cluster_id` (`cluster_id`, `name`)
-) comment ='group信息表';
-
-
-drop table if exists `group_member`;
-create table `group_member`
-(
- `id` bigint unsigned primary key auto_increment comment 'id',
- `cluster_id` bigint not null default '-1' comment '集群id',
- `client_id` bigint unsigned not null comment '客服端id',
- `topic_name` varchar(192) not null default '' comment 'topic名称',
- `group_name` varchar(192) not null default '' comment 'group名称',
- `eventmesh_user` varchar(192) not null default '' comment 'eventmesh用户',
- `state` varchar(64) not null default '' comment '状态',
- `create_time` timestamp not null default current_timestamp comment '创建时间',
- `update_time` timestamp not null default current_timestamp on update current_timestamp comment '修改时间',
- `status` int not null default 1,
- unique key `uniq_cluster_topic_group` (`cluster_id`, `topic_name`, `group_name`),
- key `cluster_id` (`cluster_id`, `topic_name`, `group_name`)
-) comment ='groupmember信息表';
-
-
drop table if exists `operation_log`;
create table `operation_log`
(
@@ -267,24 +329,6 @@
) comment ='操作记录信息表';
-drop table if exists `topic`;
-create table `topic`
-(
- `id` bigint unsigned primary key auto_increment comment 'id',
- `cluster_id` bigint not null default '-1' comment '集群id',
- `topic_name` varchar(192) not null default '' comment 'topic名称',
- `status` int not null default 1,
- `create_progress` int not null default 1 comment '0:创建成功,1:创建中,2:创建失败',
- `retention_ms` bigint not null default '-2' comment '保存时间,-2:未知,-1:无限制,>=0对应时间,单位ms',
- `type` tinyint not null default '0' comment 'topic类型,默认0,0:普通,1:eventmesh内部',
- `description` varchar(1024) default '' comment '备注信息',
- `create_time` timestamp not null default current_timestamp comment '创建时间(尽量与topic实际创建时间一致)',
- `update_time` timestamp not null default current_timestamp on update current_timestamp comment '修改时间(尽量与topic实际创建时间一致)',
- `is_delete` int not null default '0',
- unique key `uniq_cluster_phy_id_topic_name` (`cluster_id`, `topic_name`)
-) comment ='topic信息表';
-
-
drop table if exists `connector`;
create table `connector`
@@ -323,7 +367,19 @@
+drop table if exists `port`;
+create table `port`
+(
+ `id` bigint unsigned primary key auto_increment comment '自增id',
+ `cluster_id` bigint not null default '0' comment '集群id',
+ `current_port` int not null default 0 comment '当前 port value',
+ `status` int default 1 not null comment '状态: 1启用,0未启用',
+ `create_time` timestamp not null default current_timestamp comment '创建时间',
+ `update_time` timestamp not null default current_timestamp on update current_timestamp comment '修改时间',
+ is_delete int not null default 0 comment '0',
+ unique key unique_cluster_id (cluster_id)
+);
diff --git a/eventmesh-dashboard-console/src/main/resources/logback.xml b/eventmesh-dashboard-console/src/main/resources/logback.xml
index ae23589..6dede9a 100644
--- a/eventmesh-dashboard-console/src/main/resources/logback.xml
+++ b/eventmesh-dashboard-console/src/main/resources/logback.xml
@@ -15,7 +15,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-
+
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder charset="UTF-8">
@@ -36,7 +36,7 @@
<charset class="java.nio.charset.Charset">UTF-8</charset>
</encoder>
</appender>
-
+ <logger name="org.apache.eventmesh.dashboard.console.mapper" level="debug" />
<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/EventMeshDashboardApplicationTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/EventMeshDashboardApplicationTest.java
index a2f3ac4..59ead5b 100644
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/EventMeshDashboardApplicationTest.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/EventMeshDashboardApplicationTest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console;
import java.util.Objects;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/databuild/BuildFullMetadata.java
similarity index 60%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java
copy to eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/databuild/BuildFullMetadata.java
index 2102c5c..f659496 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/databuild/BuildFullMetadata.java
@@ -15,36 +15,35 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.cluster;
+package org.apache.eventmesh.dashboard.console.databuild;
+import org.apache.eventmesh.dashboard.common.enums.ClusterOwnType;
import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType.FirstToWhom;
import org.apache.eventmesh.dashboard.common.enums.ClusterType;
-import javax.validation.constraints.NotNull;
+import java.util.Set;
+import lombok.Builder;
import lombok.Data;
@Data
-public class CreateClusterDTO {
+@Builder
+public class BuildFullMetadata {
- @NotNull
- private String name;
+ private boolean eventMeshEnabled;
- @NotNull
- private ClusterTrusteeshipType trusteeshipType;
+ private Set<ClusterType> clusterTypeSet;
- @NotNull
- private ClusterType clusterType;
+ private Set<ClusterType> metaTypeSet;
- @NotNull
- private String version;
+ private Set<ClusterType> runtimeTypeSet;
- private String jmxProperties = "";
+ private Set<FirstToWhom> firstToWhomSet;
- private String description = "";
+ private Set<ClusterTrusteeshipType> clusterTrusteeshipTypesSet;
-
- private Integer authType = 0;
+ private Set<ClusterOwnType> clusterOwnTypesSet;
}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/databuild/BuildFullSceneData.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/databuild/BuildFullSceneData.java
new file mode 100644
index 0000000..b6265c4
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/databuild/BuildFullSceneData.java
@@ -0,0 +1,395 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.databuild;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterOwnType;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType.FirstToWhom;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.DeployStatusType;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.mapper.cluster.ClusterEntityMapperTest;
+import org.apache.eventmesh.dashboard.console.mapper.cluster.ClusterRelationshipMapperTest;
+import org.apache.eventmesh.dashboard.console.mapper.cluster.RuntimeEntityMapperTest;
+
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import lombok.Data;
+import lombok.Getter;
+
+public class BuildFullSceneData {
+
+
+ private final List<Triple<ClusterTrusteeshipType, FirstToWhom, ClusterOwnType>> tripleList = new ArrayList<>();
+
+ private final List<Triple<ClusterType, List<ClusterType>/* meta */, List<ClusterType>>> clusterTypeTripleList = new ArrayList<>();
+
+
+ @Getter
+ private final List<Pair<ClusterEntity, List<ClusterEntity>>> eventMeshRuntimeTripleList = new ArrayList<>();
+
+ @Getter
+ private final List<Triple<ClusterEntity, List<ClusterEntity>/* meta */, List<ClusterEntity>>> clusterTripleList = new ArrayList<>();
+
+ @Getter
+ private final List<ClusterEntity> clusterEntityList = new ArrayList<>();
+
+ @Getter
+ private final List<ClusterRelationshipEntity> clusterRelationshipEntityList = new ArrayList<>();
+
+
+ private final Map<Long, RuntimeEntity> runtimeEntityMap = new HashMap<>();
+
+
+ private ShareMetadata runtimeShareMetadata = new ShareMetadata();
+
+ private ShareMetadata mateShareMetadata = new ShareMetadata();
+
+
+ @Getter
+ private BuildFullMetadata buildFullMetadata;
+
+
+ private ClusterEntity createClusterEntity(ClusterType clusterType) {
+ ClusterEntity clusterEntity = ClusterEntityMapperTest.createClusterEntity();
+ clusterEntity.setClusterType(clusterType);
+ this.clusterEntityList.add(clusterEntity);
+ return clusterEntity;
+ }
+
+ /**
+ * 构建思路
+ * <p>
+ * 维度
+ * <ol>
+ * <li>所有集群</li>
+ * <li>eventmesh 下 所有不同类型 storage</li>
+ * <li>cluster 集群下 所有不同类型 meta</li>
+ * <li>cluster 集群下 所有不同类型 runtime</li>
+ * <li>ClusterTrusteeshipType 所有状态</li>
+ * <li>FirstToWhom 所有状态</li>
+ * <li>ClusterOwnType 状态</li>
+ * </ol>
+ * <p>
+ * <p>
+ * TODO 如何构建 , RocketMQ 三个结构
+ */
+ public void build() {
+ this.buildBase();
+ this.buildReplica();
+ this.association();
+ }
+
+ public void association() {
+ tripleList.forEach(this::buildCluster);
+ // 写入数据库
+
+ //this.createClusterRelationshipEntity();
+ // 写入数据库
+
+ //this.clusterEntityList.forEach(this::createRuntimeEntity);
+ // 写入数据库
+
+ }
+
+ public List<Triple<ClusterEntity, List<ClusterEntity>, List<ClusterEntity>>> getClusterTripleList(ClusterType clusterType) {
+ List<Triple<ClusterEntity, List<ClusterEntity>, List<ClusterEntity>>> tripleList = new ArrayList<>();
+ this.clusterTripleList.forEach(tripleList1 -> {
+ if (tripleList1.getLeft().getClusterType() == clusterType) {
+ tripleList.add(tripleList1);
+ }
+ });
+ return tripleList;
+ }
+
+ public void buildBase() {
+ buildFullMetadata.getClusterTrusteeshipTypesSet().forEach(clusterTrusteeshipType -> {
+ buildFullMetadata.getFirstToWhomSet().forEach(firstToWhom -> {
+ buildFullMetadata.getClusterOwnTypesSet().forEach(clusterOwnType -> {
+ Triple<ClusterTrusteeshipType, FirstToWhom, ClusterOwnType> triple =
+ Triple.of(clusterTrusteeshipType, firstToWhom, clusterOwnType);
+ if (ClusterOwnType.SHARE == clusterOwnType) {
+ this.mateShareMetadata.shareNum++;
+ this.runtimeShareMetadata.shareNum++;
+ }
+ this.tripleList.add(triple);
+ });
+ });
+ });
+ }
+
+
+ public void buildReplica() {
+
+ this.buildFullMetadata.getClusterTypeSet().forEach(this::buildReplica);
+
+ this.buildShare(this.buildFullMetadata.getRuntimeTypeSet(), this.runtimeShareMetadata);
+ this.buildShare(this.buildFullMetadata.getMetaTypeSet(), this.mateShareMetadata);
+
+ }
+
+ private void buildCluster(Triple<ClusterTrusteeshipType, FirstToWhom, ClusterOwnType> triple) {
+ clusterTypeTripleList.forEach(cluster -> {
+ ClusterType clusterType = cluster.getLeft();
+ ClusterEntity clusterEntity = this.createClusterEntity(clusterType);
+ this.build(clusterEntity, triple);
+ clusterTripleList.add(Triple.of(clusterEntity, this.buildCluster(clusterType, cluster.getMiddle(), triple),
+ this.buildCluster(clusterType, cluster.getRight(), triple)));
+ });
+ if (this.buildFullMetadata.isEventMeshEnabled()) {
+ List<ClusterEntity> eventMeshEntities = new ArrayList<>();
+ List<ClusterEntity> clusterEntityList1 = new ArrayList<>();
+ this.clusterTripleList.forEach(tripleList1 -> {
+ ClusterEntity clusterEntity = tripleList1.getLeft();
+ if (clusterEntity.getClusterType() == ClusterType.EVENTMESH_CLUSTER) {
+ eventMeshEntities.add(clusterEntity);
+ } else {
+ clusterEntityList1.add(clusterEntity);
+ }
+ });
+ int num = clusterEntityList1.size() % eventMeshEntities.size();
+ for (int i = 0; i < eventMeshEntities.size(); i++) {
+ eventMeshRuntimeTripleList.add(Pair.of(eventMeshEntities.get(i), clusterEntityList1.subList(i * num, num)));
+ }
+
+ }
+ }
+
+ private List<ClusterEntity> buildCluster(ClusterType clusterType, List<ClusterType> clusterTypeList,
+ Triple<ClusterTrusteeshipType, FirstToWhom, ClusterOwnType> triple) {
+ Set<ClusterType> oneSet = Set.of(ClusterType.STORAGE_KAFKA_BROKER, ClusterType.STORAGE_KAFKA_ZK, ClusterType.STORAGE_KAFKA_RAFT);
+ List<ClusterEntity> runtimeClusterEntity = new ArrayList<>();
+ Random random = new Random();
+ clusterTypeList.forEach(middle -> {
+ Map<ClusterType, List<ClusterEntity>> shareMap = middle.isMeta() ? mateShareMetadata.getShareMap() : runtimeShareMetadata.getShareMap();
+ int num = 1;
+ if (!oneSet.contains(middle)) {
+ if (middle.isMeta()) {
+ num = random.nextInt(3) + 1;
+ } else {
+ num = random.nextInt(5) + 2;
+ }
+ }
+ int shareNum = random.nextInt(num) + 1;
+ Set<Integer> shareNumSet = new HashSet<>();
+ for (int i = 0; i < num; i++) {
+ ClusterEntity runtime = null;
+ if (triple.getRight() == ClusterOwnType.SHARE && shareNum != 0) {
+ List<ClusterEntity> clusterEntitieList = shareMap.get(middle);
+ for (; ; ) {
+ int randomNum = random.nextInt(clusterEntitieList.size());
+ if (shareNumSet.contains(randomNum)) {
+ continue;
+ }
+ shareNumSet.add(randomNum);
+ runtime = clusterEntitieList.get(random.nextInt(clusterEntitieList.size()));
+ break;
+ }
+ } else {
+ runtime = this.createClusterEntity(middle);
+ }
+ runtimeClusterEntity.add(runtime);
+
+ if (runtime != null) {
+ this.build(runtime, triple);
+ }
+ }
+ });
+ return runtimeClusterEntity;
+ }
+
+ private void build(ClusterEntity clusterEntity, Triple<ClusterTrusteeshipType, FirstToWhom, ClusterOwnType> triple) {
+ clusterEntity.setTrusteeshipType(triple.getLeft());
+ clusterEntity.setFirstToWhom(triple.getMiddle());
+ clusterEntity.setClusterOwnType(triple.getRight());
+ }
+
+
+ private void buildShare(Set<ClusterType> clusterTypeList, ShareMetadata mateShareMetadata) {
+ Random random = new Random();
+ clusterTypeList.forEach(clusterType -> {
+ AtomicInteger atomicInteger1 = new AtomicInteger(mateShareMetadata.getShareNum());
+ for (; ; ) {
+ int num = random.nextInt(3) + 2;
+ if (num > atomicInteger1.get()) {
+ num = atomicInteger1.get();
+ }
+ atomicInteger1.set(atomicInteger1.get() - num);
+ ClusterEntity clusterEntity = this.createClusterEntity(clusterType);
+ //clusterEntityList.add(clusterEntity);
+ clusterEntity.setClusterOwnType(ClusterOwnType.SHARE);
+ mateShareMetadata.getShareMap().computeIfAbsent(clusterType, (key) -> new ArrayList<>()).add(clusterEntity);
+ if (atomicInteger1.get() <= 0) {
+ return;
+ }
+ }
+
+ });
+ }
+
+
+ public void buildReplica(ClusterType type) {
+ List<ClusterType> metaList = new ArrayList<>();
+ for (ClusterType meta : type.getMetaClusterType()) {
+ metaList.add(meta);
+ List<ClusterType> runtimeList = new ArrayList<>();
+ for (ClusterType runtime : type.getRuntimeClusterType()) {
+ if (runtime.isDefinition()) {
+ for (ClusterType clusterType : runtime.getRuntimeClusterType()) {
+ runtimeList.add(clusterType);
+ clusterTypeTripleList.add(Triple.of(type, List.copyOf(metaList), List.of(clusterType)));
+ if (runtimeList.size() > 1) {
+ clusterTypeTripleList.add(Triple.of(type, List.copyOf(metaList), List.copyOf(runtimeList)));
+ }
+ }
+ } else {
+ runtimeList.add(runtime);
+ clusterTypeTripleList.add(Triple.of(type, List.copyOf(metaList), List.of(runtime)));
+ if (runtimeList.size() > 1) {
+ clusterTypeTripleList.add(Triple.of(type, List.copyOf(metaList), List.copyOf(runtimeList)));
+ }
+ }
+ }
+ }
+ }
+
+
+ public List<RuntimeEntity> createRuntimeEntity() {
+ this.clusterEntityList.forEach(this::createRuntimeEntity);
+ return new ArrayList<>(this.runtimeEntityMap.values());
+ }
+
+ public List<RuntimeEntity> getRuntimeEntityList(List<ClusterEntity> clusterEntityList) {
+ List<RuntimeEntity> runtimeEntityList = new ArrayList<>();
+ for (ClusterEntity clusterEntity : clusterEntityList) {
+ runtimeEntityList.add(this.runtimeEntityMap.get(clusterEntity.getId()));
+ }
+ return runtimeEntityList;
+ }
+
+ public List<ClusterRelationshipEntity> createClusterRelationshipEntity() {
+ this.clusterTripleList.forEach(triple -> {
+
+ triple.getMiddle().forEach(middle -> {
+ this.createClusterRelationshipEntity(triple.getLeft(), middle);
+ });
+ triple.getRight().forEach(r -> {
+ this.createClusterRelationshipEntity(triple.getLeft(), r);
+ });
+ });
+ this.eventMeshRuntimeTripleList.forEach(tripleList1 -> {
+ tripleList1.getRight().forEach(r -> {
+ this.createClusterRelationshipEntity(tripleList1.getLeft(), r);
+ });
+ });
+ return this.clusterRelationshipEntityList;
+ }
+
+ private void createClusterRelationshipEntity(ClusterEntity clusterEntity, ClusterEntity relationshipClusterEntity) {
+ ClusterRelationshipEntity clusterRelationshipEntity =
+ ClusterRelationshipMapperTest.buildClusterRelationshipEntity(clusterEntity, relationshipClusterEntity);
+
+ this.clusterRelationshipEntityList.add(clusterRelationshipEntity);
+ }
+
+ private void createRuntimeEntity(ClusterEntity clusterEntity) {
+ if (!this.buildFullMetadata.getClusterOwnTypesSet().contains(clusterEntity.getClusterOwnType())) {
+ return;
+ }
+ if (clusterEntity.getClusterType().isDefinition()) {
+ return;
+ }
+ Random random = new Random();
+ int num = random.nextInt(3) + 3;
+ for (int i = 0; i < num; i++) {
+ RuntimeEntity runtimeEntity = RuntimeEntityMapperTest.createRuntimeEntity(clusterEntity);
+ runtimeEntity.setDeployStatusType(DeployStatusType.CREATE_FULL_WAIT);
+ if (num == i + 1) {
+ runtimeEntity.setDeployStatusType(DeployStatusType.CREATE_WAIT);
+ }
+ this.runtimeEntityMap.put(runtimeEntity.getId(), runtimeEntity);
+ }
+ }
+
+
+ public void buildFullMetadata() {
+ this.buildFullMetadata =
+ BuildFullMetadata.builder()
+ .eventMeshEnabled(true)
+ .clusterTypeSet(new HashSet<>(ClusterType.getStorageCluster()))
+ .metaTypeSet(new HashSet<>(ClusterType.getStorageRuntimeCluster()))
+ .runtimeTypeSet(new HashSet<>(ClusterType.getStorageMetaCluster()))
+ .firstToWhomSet(Set.of(FirstToWhom.NOT))
+ .clusterTrusteeshipTypesSet(Set.of(ClusterTrusteeshipType.SELF))
+ .clusterOwnTypesSet(Set.of(ClusterOwnType.INDEPENDENCE)).build();
+
+ this.buildFullMetadata.getClusterTypeSet().add(ClusterType.EVENTMESH_CLUSTER);
+ this.buildFullMetadata.getMetaTypeSet().addAll(ClusterType.EVENTMESH_CLUSTER.getMetaClusterType());
+ this.buildFullMetadata.getRuntimeTypeSet().addAll(ClusterType.EVENTMESH_CLUSTER.getMetaClusterInStorage());
+ this.build();
+ }
+
+ public void buildStorageAll() {
+ this.buildFullMetadata =
+ BuildFullMetadata.builder()
+ .clusterTypeSet(new HashSet<>(ClusterType.getStorageCluster()))
+ .metaTypeSet(new HashSet<>(ClusterType.getStorageRuntimeCluster()))
+ .runtimeTypeSet(new HashSet<>(ClusterType.getStorageMetaCluster()))
+ .firstToWhomSet(Set.of(FirstToWhom.NOT))
+ .clusterTrusteeshipTypesSet(Set.of(ClusterTrusteeshipType.SELF))
+ .clusterOwnTypesSet(Set.of(ClusterOwnType.INDEPENDENCE)).build();
+ this.build();
+ }
+
+ public void build(ClusterType clusterType) {
+ this.buildFullMetadata = BuildFullMetadata.builder().clusterTypeSet(Set.of(clusterType))
+ .metaTypeSet(Set.copyOf(clusterType.getMetaClusterType()))
+ .runtimeTypeSet(Set.copyOf(clusterType.getRuntimeClusterType()))
+ .firstToWhomSet(Set.of(FirstToWhom.NOT))
+ .clusterTrusteeshipTypesSet(Set.of(ClusterTrusteeshipType.SELF))
+ .clusterOwnTypesSet(Set.of(ClusterOwnType.INDEPENDENCE)).build();
+ this.build();
+ }
+
+ public void build(BuildFullMetadata buildFullMetadata) {
+ this.buildFullMetadata = buildFullMetadata;
+ }
+
+ @Data
+ private static class ShareMetadata {
+
+ private final List<ClusterEntity> shareClusterEntityList = new ArrayList<>();
+
+ private Integer shareNum = 0;
+
+ private final Map<ClusterType, List<ClusterEntity>> shareMap = new HashMap<>();
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/Health2ServiceTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/Health2ServiceTest.java
new file mode 100644
index 0000000..28c374a
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/Health2ServiceTest.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.function.health;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
+import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
+import org.apache.eventmesh.dashboard.console.service.function.HealthDataService;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKManage;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateJvmCapConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateJvmConfig;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class Health2ServiceTest {
+
+ @Mock
+ private HealthDataService dataService;
+
+ public static BaseSyncBase createJvm() {
+ SDKTypeEnum sdkTypeEnum = SDKTypeEnum.ADMIN;
+ BaseSyncBase baseSyncBase = new RuntimeMetadata();
+ baseSyncBase.setId(1L);
+ baseSyncBase.setClusterType(ClusterType.STORAGE_JVM_BROKER);
+ CreateJvmConfig config = new CreateJvmConfig();
+ config.setKey(baseSyncBase.getId().toString());
+ SDKManage.getInstance().createClient(sdkTypeEnum, baseSyncBase, config, baseSyncBase.getClusterType());
+ return baseSyncBase;
+ }
+
+ public static BaseSyncBase createJvmCap() {
+ SDKTypeEnum sdkTypeEnum = SDKTypeEnum.ADMIN;
+ BaseSyncBase baseSyncBase = new RuntimeMetadata();
+ baseSyncBase.setId(1L);
+ baseSyncBase.setClusterType(ClusterType.STORAGE_JVM_CAP_BROKER);
+ CreateJvmCapConfig config = new CreateJvmCapConfig();
+ config.setKey(baseSyncBase.getId().toString());
+ SDKManage.getInstance().createClient(sdkTypeEnum, baseSyncBase, config, baseSyncBase.getClusterType());
+ return baseSyncBase;
+ }
+
+ private Health2Service health2Service = new Health2Service();
+
+
+
+ @Before
+ public void init(){
+ health2Service.setDataService(dataService);
+ }
+
+ @Test
+ public void test(){
+ BaseSyncBase baseSyncBase = createJvm();
+ health2Service.register(baseSyncBase);
+ health2Service.executeAll();
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutorTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutorTest.java
deleted file mode 100644
index 964126e..0000000
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutorTest.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.health;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-
-import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckStatus;
-import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckType;
-import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
-import org.apache.eventmesh.dashboard.console.entity.function.HealthCheckResultEntity;
-import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
-import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
-import org.apache.eventmesh.dashboard.console.service.function.HealthDataService;
-
-import java.util.concurrent.CompletableFuture;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.mockito.stubbing.Answer;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.jdbc.Sql;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-@ExtendWith(MockitoExtension.class)
-@ExtendWith(SpringExtension.class)
-@SpringBootTest(classes = EventMeshDashboardApplication.class)
-@ActiveProfiles("test")
-@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"})
-@Timeout(value = 5)
-class HealthExecutorTest {
-
- @Autowired
- HealthDataService healthDataService;
- @Mock
- AbstractHealthCheckService successHealthCheckService;
- @Mock
- AbstractHealthCheckService failHealthCheckService;
- @Mock
- AbstractHealthCheckService timeoutHealthCheckService;
- private HealthExecutor healthExecutor = new HealthExecutor();
- private CheckResultCache memoryCache = CheckResultCache.getINSTANCE();
-
- @BeforeEach
- public void initMock() {
- Mockito.lenient().doAnswer((Answer<Void>) invocation -> {
- HealthCheckCallback callback = invocation.getArgument(0);
- callback.onSuccess();
- return null;
- }).when(successHealthCheckService).doCheck(any(HealthCheckCallback.class));
- Mockito.lenient().doAnswer((Answer<Void>) invocation -> {
- HealthCheckCallback callback = invocation.getArgument(0);
- callback.onFail(new RuntimeException("TestRuntimeException: This check is designed to be failed. Ignore This!"));
- return null;
- }).when(failHealthCheckService).doCheck(any(HealthCheckCallback.class));
- Mockito.lenient().doAnswer((Answer<Void>) invocation -> {
- HealthCheckCallback callback = invocation.getArgument(0);
- CompletableFuture.runAsync(() -> {
- try {
- Thread.sleep(10000);
- } catch (InterruptedException e) {
- return;
- }
- callback.onFail(new RuntimeException("TestRuntimeException"));
- });
- return null;
- }).when(timeoutHealthCheckService).doCheck(any(HealthCheckCallback.class));
-
- healthExecutor.setDataService(healthDataService);
- healthExecutor.setMemoryCache(memoryCache);
- HealthCheckObjectConfig config1 = HealthCheckObjectConfig.builder()
- .instanceId(1L)
- .healthCheckResourceType("storage")
- .healthCheckResourceSubType("redis")
- .connectUrl("redis://localhost:6379")
- .simpleClassName("RedisCheck")
- .clusterId(1L)
- .build();
- Mockito.lenient().when(successHealthCheckService.getConfig()).thenReturn(config1);
- Mockito.lenient().when(timeoutHealthCheckService.getConfig()).thenReturn(config1);
- HealthCheckObjectConfig config2 = HealthCheckObjectConfig.builder()
- .instanceId(2L)
- .healthCheckResourceType("storage")
- .healthCheckResourceSubType("redis")
- .connectUrl("redis://localhost:6379")
- .simpleClassName("RedisCheck")
- .clusterId(1L)
- .build();
- Mockito.lenient().when(failHealthCheckService.getConfig()).thenReturn(config2);
- }
-
- @Test
- public void testExecute() throws InterruptedException {
- healthExecutor.execute(successHealthCheckService);
- healthExecutor.execute(failHealthCheckService);
- Thread.sleep(1000);
- assertEquals(2, memoryCache.getCacheMap().get("storage").size());
- assertNotEquals(memoryCache.getCacheMap().get("storage").get(1L).getStatus(), memoryCache.getCacheMap().get("storage").get(2L).getStatus());
- }
-
-
- @Test
- public void testEndExecute() {
- healthExecutor.execute(successHealthCheckService);
- healthExecutor.execute(failHealthCheckService);
- healthExecutor.endExecute();
- HealthCheckResultEntity query = new HealthCheckResultEntity();
- query.setClusterId(1L);
- query.setType(HealthCheckType.STORAGE.getNumber());
- query.setTypeId(2L);
- assertNotNull(healthDataService.queryHealthCheckResultByClusterIdAndTypeAndTypeId(query).get(0).getState());
- }
-
- @Test
- public void testStartExecute() throws InterruptedException {
- healthExecutor.execute(successHealthCheckService);
- healthExecutor.execute(failHealthCheckService);
- //to test startExecute(), we need to call endExecute() first
- healthExecutor.endExecute();
- Thread.sleep(500);
- healthExecutor.startExecute();
- HealthCheckResultEntity query = new HealthCheckResultEntity();
- query.setClusterId(1L);
- query.setType(HealthCheckType.STORAGE.getNumber());
- query.setTypeId(1L);
- assertEquals(1, healthDataService.queryHealthCheckResultByClusterIdAndTypeAndTypeId(query).get(0).getState());
- }
-
- @Test
- public void testTimeout() {
- healthExecutor.execute(timeoutHealthCheckService);
- healthExecutor.endExecute();
- healthExecutor.startExecute();
-
- HealthCheckResultEntity query = new HealthCheckResultEntity();
- query.setClusterId(1L);
- query.setType(HealthCheckType.STORAGE.getNumber());
- query.setTypeId(1L);
- assertEquals(HealthCheckStatus.TIMEOUT.getNumber(),
- healthDataService.queryHealthCheckResultByClusterIdAndTypeAndTypeId(query).get(0).getState());
- }
-
- @Test
- public void testFull() throws InterruptedException {
- healthExecutor.startExecute();
- healthExecutor.execute(successHealthCheckService);
- healthExecutor.execute(failHealthCheckService);
- healthExecutor.endExecute();
- Thread.sleep(1000);
- healthExecutor.startExecute();
- healthExecutor.execute(successHealthCheckService);
- healthExecutor.execute(failHealthCheckService);
- healthExecutor.endExecute();
- HealthCheckResultEntity query = new HealthCheckResultEntity();
- query.setClusterId(1L);
- query.setType(HealthCheckType.STORAGE.getNumber());
- query.setTypeId(1L);
- assertEquals(2, healthDataService.queryHealthCheckResultByClusterIdAndTypeAndTypeId(query).size());
- }
-
-}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthServiceTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthServiceTest.java
deleted file mode 100644
index 0d5f5bd..0000000
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthServiceTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.health;
-
-import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
-import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
-import org.apache.eventmesh.dashboard.console.service.function.HealthDataService;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-@ExtendWith(MockitoExtension.class)
-@Timeout(value = 5)
-class HealthServiceTest {
-
- HealthService healthService = new HealthService();
-
- @Mock
- private HealthDataService healthDataService;
-
- @Mock
- private CheckResultCache checkResultCache;
-
- @BeforeEach
- void init() {
- healthService.createExecutor(healthDataService, checkResultCache);
- }
-
- @Test
- void testInsertCheckServiceWithAnnotation() {
- HealthCheckObjectConfig config = HealthCheckObjectConfig.builder()
- .instanceId(1L)
- .healthCheckResourceType("storage")
- .healthCheckResourceSubType("redis")
- .connectUrl("redis://localhost:6379")
- .build();
- healthService.insertCheckService(config);
- }
-
- @Test
- void testInsertCheckServiceWithSimpleClassName() {
- HealthCheckObjectConfig config = HealthCheckObjectConfig.builder()
- .instanceId(1L)
- .simpleClassName("RedisCheck")
- .healthCheckResourceType("storage")
- .healthCheckResourceSubType("redis")
- .clusterId(1L)
- .connectUrl("redis://localhost:6379")
- .build();
- healthService.insertCheckService(config);
- }
-
- @Test
- void testInsertCheckServiceWithClass() {
- HealthCheckObjectConfig config = HealthCheckObjectConfig.builder()
- .instanceId(1L)
- .healthCheckResourceType("storage")
- .healthCheckResourceSubType("redis")
- .clusterId(1L)
- .checkClass(TestHealthCheckService.class)
- .build();
- healthService.insertCheckService(config);
- }
-
- @Test
- void testDeleteCheckService() {
- HealthCheckObjectConfig config = HealthCheckObjectConfig.builder()
- .instanceId(1L)
- .healthCheckResourceType("storage")
- .healthCheckResourceSubType("redis")
- .clusterId(1L)
- .checkClass(TestHealthCheckService.class)
- .build();
- healthService.insertCheckService(config);
- healthService.deleteCheckService("storage", 1L);
- }
-
- @Test
- void testExecuteAll() {
- HealthCheckObjectConfig config = HealthCheckObjectConfig.builder()
- .instanceId(1L)
- .healthCheckResourceType("storage")
- .healthCheckResourceSubType("redis")
- .clusterId(1L)
- .checkClass(TestHealthCheckService.class)
- .build();
- healthService.insertCheckService(config);
- healthService.executeAll();
- }
-
- public static class TestHealthCheckService extends AbstractHealthCheckService {
-
-
- public TestHealthCheckService(HealthCheckObjectConfig healthCheckObjectConfig) {
- super(healthCheckObjectConfig);
- }
-
- @Override
- public void doCheck(HealthCheckCallback callback) {
- callback.onSuccess();
- }
-
- @Override
- public void init() {
-
- }
-
- @Override
- public void destroy() {
-
- }
- }
-}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosConfigCheckTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosConfigCheckTest.java
index 7915bd0..18cb33b 100644
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosConfigCheckTest.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosConfigCheckTest.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.function.health.check.impl.meta;
import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -39,15 +39,7 @@
@BeforeEach
public void init() {
try {
- HealthCheckObjectConfig config = HealthCheckObjectConfig.builder()
- .instanceId(1L)
- .healthCheckResourceType("meta")
- .healthCheckResourceSubType("nacos")
- .clusterId(1L)
- .connectUrl("127.0.0.1:8848")
- .requestTimeoutMillis(1000L)
- .build();
- nacosCheck = new NacosConfigCheck(config);
+ nacosCheck = new NacosConfigCheck();
} catch (Exception e) {
log.error("NacosConfigCheck failed.", e);
}
@@ -79,6 +71,6 @@
@AfterEach
public void destroy() {
- nacosCheck.destroy();
+
}
}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosNamingServiceCheckTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosNamingServiceCheckTest.java
index 080273b..f950109 100644
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosNamingServiceCheckTest.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosNamingServiceCheckTest.java
@@ -15,15 +15,14 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.function.health.check.impl.meta;
import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
@@ -39,15 +38,8 @@
@BeforeEach
public void init() {
try {
- HealthCheckObjectConfig config = HealthCheckObjectConfig.builder()
- .instanceId(1L)
- .healthCheckResourceType("meta")
- .healthCheckResourceSubType("nacos")
- .clusterId(1L)
- .connectUrl("127.0.0.1:8848")
- .requestTimeoutMillis(1000L)
- .build();
- nacosRegisterCheck = new NacosNamingServiceCheck(config);
+
+ nacosRegisterCheck = new NacosNamingServiceCheck();
} catch (Exception e) {
log.error("NacosNamingServiceCheck failed.", e);
}
@@ -77,8 +69,4 @@
}
}
- @AfterEach
- public void destroy() {
- nacosRegisterCheck.destroy();
- }
}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/RedisCheckTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/RedisCheckTest.java
deleted file mode 100644
index 9f0cd47..0000000
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/RedisCheckTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.health.check.impl.storage;
-
-import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
-
-import java.util.concurrent.CountDownLatch;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-
-import io.lettuce.core.RedisException;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Timeout(value = 5)
-class RedisCheckTest {
-
- private RedisCheck redisCheck;
-
- @BeforeEach
- public void init() {
- try {
- HealthCheckObjectConfig config = HealthCheckObjectConfig.builder()
- .instanceId(1L)
- .healthCheckResourceType("storage")
- .healthCheckResourceSubType("redis")
- .simpleClassName("RedisCheck")
- .clusterId(1L)
- .connectUrl("127.0.0.1:6379")
- .password("")
- .build();
- redisCheck = new RedisCheck(config);
- } catch (RedisException e) {
- log.error("RedisCheck failed.", e);
- }
- }
-
- @Test
- public void testDoCheck() throws InterruptedException {
- try {
- CountDownLatch latch = new CountDownLatch(1);
- if (redisCheck == null) {
- log.error("RedisCheck is null.");
- return;
- }
- redisCheck.doCheck(new HealthCheckCallback() {
- @Override
- public void onSuccess() {
- latch.countDown();
- log.info("{} success", this.getClass().getSimpleName());
- }
-
- @Override
- public void onFail(Exception e) {
- latch.countDown();
- log.error("{}, failed for reason {}", this.getClass().getSimpleName(), e);
- }
- });
- latch.await();
- } catch (RedisException e) {
- log.error("RedisCheck failed.", e);
- }
- }
-}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4BrokerCheckTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4BrokerCheckTest.java
index eaa7d5b..016ca80 100644
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4BrokerCheckTest.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4BrokerCheckTest.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.function.health.check.impl.storage.rocketmq4;
import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
import java.util.concurrent.CountDownLatch;
@@ -37,12 +37,7 @@
@BeforeEach
public void init() {
try {
- HealthCheckObjectConfig config = HealthCheckObjectConfig.builder()
- .host("127.0.0.1")
- .port(10911)
- .requestTimeoutMillis(1000L)
- .build();
- rocketmqCheck = new Rocketmq4BrokerCheck(config);
+ rocketmqCheck = new Rocketmq4BrokerCheck();
} catch (Exception e) {
log.error("Rocketmq4BrokerCheck failed.", e);
}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4NameserverCheckTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4NameserverCheckTest.java
index 8c2cab2..8b66102 100644
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4NameserverCheckTest.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4NameserverCheckTest.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.function.health.check.impl.storage.rocketmq4;
import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
import java.util.concurrent.CountDownLatch;
@@ -37,12 +37,7 @@
@BeforeEach
public void init() {
try {
- HealthCheckObjectConfig config = HealthCheckObjectConfig.builder()
-
- .connectUrl("127.0.0.1:9876")
- .requestTimeoutMillis(1000L)
- .build();
- rocketmqCheck = new Rocketmq4NameServerCheck(config);
+ rocketmqCheck = new Rocketmq4NameServerCheck();
} catch (Exception e) {
log.error("Rocketmq4NameserverCheck failed.", e);
}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4TopicCheckTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4TopicCheckTest.java
index 1d4eb09..3d2c66a 100644
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4TopicCheckTest.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4TopicCheckTest.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.function.health.check.impl.storage.rocketmq4;
import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
import java.util.concurrent.CountDownLatch;
@@ -37,11 +37,7 @@
@BeforeEach
public void init() throws InterruptedException {
try {
- HealthCheckObjectConfig config = new HealthCheckObjectConfig();
- config.getRocketmqConfig().setBrokerUrl("127.0.0.1:10911");
- config.getRocketmqConfig().setNameServerUrl("127.0.0.1:9876");
- config.setRequestTimeoutMillis(1000L);
- rocketmqCheck = new Rocketmq4TopicCheck(config);
+ rocketmqCheck = new Rocketmq4TopicCheck();
} catch (Exception e) {
log.error("Rocketmq4TopicCheck failed.", e);
}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImplTest.java
deleted file mode 100644
index ca25df2..0000000
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImplTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.metadata.handler.db;
-
-import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata;
-import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
-import org.apache.eventmesh.dashboard.console.service.function.ConfigService;
-
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.jdbc.Sql;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-@ExtendWith(SpringExtension.class)
-@ActiveProfiles("test")
-@SpringBootTest(classes = EventMeshDashboardApplication.class)
-@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"})
-class ConfigMetadataHandlerToDbImplTest {
-
- @Autowired
- private ConfigMetadataHandlerToDbImpl configMetadataHandlerToDb;
-
- @Autowired
- private ConfigService configDataService;
-
- @Test
- public void testAddMetadata() {
- ConfigMetadata configMetadata = new ConfigMetadata();
- configMetadata.setConfigKey("configKey");
- configMetadata.setConfigValue("configValue");
- configMetadata.setInstanceType(0);
- configMetadata.setInstanceId(0L);
- configMetadata.setClusterId(0L);
- configMetadataHandlerToDb.addMetadata(configMetadata);
- }
-}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImplTest.java
deleted file mode 100644
index 1057cab..0000000
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImplTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.metadata.handler.db;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-import org.apache.eventmesh.dashboard.common.model.metadata.ConnectionMetadata;
-import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
-import org.apache.eventmesh.dashboard.console.entity.cluster.ClientEntity;
-import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity;
-import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
-import org.apache.eventmesh.dashboard.console.service.cluster.ClientDataService;
-import org.apache.eventmesh.dashboard.console.service.cluster.ConnectionDataService;
-import org.apache.eventmesh.dashboard.console.service.connector.ConnectorDataService;
-import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler;
-
-import java.util.List;
-
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.jdbc.Sql;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-@ExtendWith(SpringExtension.class)
-@ActiveProfiles("test")
-@SpringBootTest(classes = EventMeshDashboardApplication.class)
-@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"})
-@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:client-test.sql", "classpath:connector-test.sql",
- "classpath:connection-test.sql"})
-class ConnectionMetadataHandlerToDbImplTest {
-
- @Autowired
- MetadataHandler<ConnectionMetadata> connectionMetadataMetadataHandler;
-
- @Autowired
- ConnectionDataService connectionDataService;
-
- @Autowired
- ConnectorDataService connectorDataService;
-
- @Autowired
- ClientDataService clientDataService;
-
- @Test
- public void testNewConnectorNewClientNewConnection() {
- ConnectionMetadata connectionMetadata = new ConnectionMetadata();
- connectionMetadata.setSourceType("connector");
- connectionMetadata.setSourceId(0L);
- connectionMetadata.setSourceHost("192.168.1.1");
- connectionMetadata.setSourcePort(8888);
- connectionMetadata.setSourceName("");
- connectionMetadata.setSinkType("client");
- connectionMetadata.setSinkHost("");
- connectionMetadata.setSinkPort(0);
- connectionMetadata.setSinkName("");
- connectionMetadata.setSinkId(0L);
- connectionMetadata.setRuntimeId(0L);
- connectionMetadata.setTopic("");
- connectionMetadata.setGroupId(0L);
- connectionMetadata.setDescription("");
- connectionMetadata.setRegistryAddress("");
- connectionMetadata.setClusterId(0L);
-
- connectionMetadataMetadataHandler.addMetadata(connectionMetadata);
-
- assertEquals(7, connectionDataService.getAllConnections().size());
- assertEquals(6, connectorDataService.selectAll().size());
- assertEquals(5, clientDataService.selectAll().size());
- }
-
- @Test
- public void testOldConnectorNewClientNewConnection() {
- ConnectionMetadata connectionMetadata = new ConnectionMetadata();
-
- connectionMetadata.setSourceType("connector");
- connectionMetadata.setSourceHost("192.168.3.1");
- connectionMetadata.setSourcePort(8888);
- connectionMetadata.setSourceName("");
- connectionMetadata.setSinkType("client");
- connectionMetadata.setSinkHost("");
- connectionMetadata.setSinkPort(0);
- connectionMetadata.setSinkName("");
- connectionMetadata.setRuntimeId(0L);
- connectionMetadata.setTopic("");
- connectionMetadata.setGroupId(0L);
- connectionMetadata.setDescription("");
- connectionMetadata.setRegistryAddress("");
- connectionMetadata.setClusterId(0L);
-
- connectionMetadataMetadataHandler.addMetadata(connectionMetadata);
-
- List<ConnectionEntity> connections = connectionDataService.getAllConnections();
- List<ConnectorEntity> connectors = connectorDataService.selectAll();
- List<ClientEntity> clients = clientDataService.selectAll();
-
- assertEquals(7, connections.size());
- assertEquals(5, connectors.size());
- assertEquals(5, clients.size());
-
- assertEquals(2, connections.get(connections.size() - 1).getSourceId().intValue());
- assertEquals(5, connections.get(connections.size() - 1).getSinkId().intValue());
- }
-}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImplTest.java
deleted file mode 100644
index acfacb2..0000000
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImplTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.metadata.handler.db;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-import org.apache.eventmesh.dashboard.common.model.metadata.GroupMetadata;
-import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
-import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity;
-import org.apache.eventmesh.dashboard.console.service.message.GroupService;
-import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler;
-
-import java.util.List;
-
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.jdbc.Sql;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-@ExtendWith(SpringExtension.class)
-@ActiveProfiles("test")
-@SpringBootTest(classes = EventMeshDashboardApplication.class)
-@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"})
-class GroupMetadataHandlerToDbImplTest {
-
- @Autowired
- MetadataHandler<GroupMetadata> groupMetadataHandlerToDb;
-
- @Autowired
- GroupService groupDataService;
-
- @Test
- public void testAddMetadata() {
- GroupMetadata groupMetadata = new GroupMetadata();
- groupMetadata.setName("group");
- groupMetadata.setState("");
- groupMetadata.setType(0);
- groupMetadata.setClusterId(1L);
- groupMetadata.setMembers("");
- groupMetadataHandlerToDb.addMetadata(groupMetadata);
- List<GroupEntity> results = groupDataService.selectAll();
- assertEquals("group", results.get(results.size() - 1).getName());
- }
-}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImplTest.java
deleted file mode 100644
index f87cc14..0000000
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImplTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.metadata.handler.db;
-
-import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
-import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
-import org.apache.eventmesh.dashboard.console.cache.ClusterCacheBase;
-import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
-import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
-import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
-import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService;
-import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler;
-
-import java.util.List;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.jdbc.Sql;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-@ExtendWith(SpringExtension.class)
-@ActiveProfiles("test")
-@SpringBootTest(classes = EventMeshDashboardApplication.class)
-@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"})
-@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:runtime-test.sql")
-class RuntimeMetadataHandlerToDbImplTest extends ClusterCacheBase {
-
- @Autowired
- private MetadataHandler<RuntimeMetadata> runtimeMetadataHandlerToDb;
-
- private RuntimeMetadata runtimeMetadata;
-
- @Autowired
- private RuntimeService runtimeService;
-
- @Autowired
- private ClusterService clusterService;
-
- @BeforeEach
- public void initData() {
- runtimeMetadata = new RuntimeMetadata();
- runtimeMetadata.setHost("192.168.3.14");
- runtimeMetadata.setPort(1234);
- runtimeMetadata.setRack("rack");
- runtimeMetadata.setRegistryAddress("12333");
- runtimeMetadata.setJmxPort(12345);
- runtimeMetadata.setClusterName("cluster1");
- runtimeMetadata.setEndpointMap("endpointMap");
- runtimeMetadata.setStorageClusterId(1L);
- runtimeMetadata.setStartTimestamp(123456L);
- runtimeMetadata.setRegistryAddress("registryAddress");
- }
-
- @Test
- void testAddMetadataWhenClusterExistRuntimeNotExist() {
- runtimeMetadataHandlerToDb.addMetadata(runtimeMetadata);
- List<RuntimeEntity> runtimeEntities = runtimeService.selectAll();
- Assertions.assertEquals("endpointMap", runtimeEntities.get(runtimeEntities.size() - 1).getEndpointMap());
- List<ClusterEntity> clusterEntities = clusterService.selectAll();
- Assertions.assertEquals("cluster1", clusterEntities.get(clusterEntities.size() - 1).getName());
- }
-
- @Test
- void testAddMetadataWhenClusterNotExistRuntimeNotExist() {
- runtimeMetadata.setClusterName("cluster2");
- runtimeMetadataHandlerToDb.addMetadata(runtimeMetadata);
- List<RuntimeEntity> runtimeEntities = runtimeService.selectAll();
- Assertions.assertEquals("endpointMap", runtimeEntities.get(runtimeEntities.size() - 1).getEndpointMap());
- List<ClusterEntity> clusterEntities = clusterService.selectAll();
- Assertions.assertEquals("cluster2", clusterEntities.get(clusterEntities.size() - 1).getName());
- }
-
- @Test
- void testAddMetadataWhenClusterExistRuntimeExist() {
- runtimeMetadata.setClusterId(1L);
- runtimeMetadata.setHost("127.0.0.1");
- runtimeMetadata.setPort(12345);
- runtimeMetadataHandlerToDb.addMetadata(runtimeMetadata);
- List<RuntimeEntity> runtimeEntities = runtimeService.selectAll();
- Assertions.assertEquals(3, runtimeEntities.size());
- Assertions.assertNotEquals("2024-03-18 09:53:10", runtimeEntities.get(0).getUpdateTime().toString());
- Assertions.assertNotEquals(-1, runtimeEntities.get(0).getStartTimestamp());
- Assertions.assertEquals(-1, runtimeEntities.get(1).getStartTimestamp());
- List<ClusterEntity> clusterEntities = clusterService.selectAll();
- Assertions.assertEquals(1, clusterEntities.size());
- }
-
- @Test
- void testAddMetadataWhenClusterNotExistRuntimeExist() {
- runtimeMetadata.setClusterName("cluster2");
- runtimeMetadata.setHost("127.0.0.1");
- runtimeMetadata.setPort(12345);
- runtimeMetadataHandlerToDb.addMetadata(runtimeMetadata);
- List<RuntimeEntity> runtimeEntities = runtimeService.selectAll();
- Assertions.assertEquals(3, runtimeEntities.size());
- Assertions.assertNotEquals("2024-03-18 09:53:10", runtimeEntities.get(0).getUpdateTime());
- Assertions.assertNotEquals(-1, runtimeEntities.get(0).getStartTimestamp());
- Assertions.assertEquals(-1, runtimeEntities.get(1).getStartTimestamp());
- List<ClusterEntity> clusterEntities = clusterService.selectAll();
- Assertions.assertEquals(1, clusterEntities.size());
- }
-}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImplTest.java
deleted file mode 100644
index 0e996c9..0000000
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImplTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.function.metadata.handler.db;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-import org.apache.eventmesh.dashboard.common.enums.StoreType;
-import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata;
-import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
-import org.apache.eventmesh.dashboard.console.cache.ClusterCacheBase;
-import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity;
-import org.apache.eventmesh.dashboard.console.service.message.TopicService;
-import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler;
-
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.jdbc.Sql;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-@ExtendWith(SpringExtension.class)
-@ActiveProfiles("test")
-@SpringBootTest(classes = EventMeshDashboardApplication.class)
-@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"})
-@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:topic-test.sql")
-class TopicMetadataHandlerToDbImplTest extends ClusterCacheBase {
-
- @Autowired
- MetadataHandler<TopicMetadata> topicMetadataHandlerToDb;
-
- @Autowired
- private TopicService topicService;
-
- @Test
- public void testAddMetadata() {
- TopicMetadata topicMetadata = new TopicMetadata();
- topicMetadata.setTopicName("testTopic");
- //set id to 0, this should be checked and recovered in another module
- topicMetadata.setRuntimeId(0L);
- topicMetadata.setStorageId(0L);
- topicMetadata.setClusterId(135L);
-
- topicMetadata.setType(0);
- topicMetadata.setStoreType(StoreType.REDIS);
- topicMetadata.setDescription("function/metadata/handler/db/TopicMetadataHandlerToDbImplTest.java");
- topicMetadata.setRetentionMs(-1L);
- topicMetadataHandlerToDb.addMetadata(topicMetadata);
- TopicEntity topicEntity = new TopicEntity();
- topicEntity.setId(135L);
- assertEquals("function/metadata/handler/db/TopicMetadataHandlerToDbImplTest.java",
- topicService.selectTopiByCluster(topicEntity).get(0).getDescription());
- }
-
-}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/integration/health/HealthServiceIntegrateTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/integration/health/HealthServiceIntegrateTest.java
deleted file mode 100644
index 1a16de2..0000000
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/integration/health/HealthServiceIntegrateTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.integration.health;
-
-import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckType;
-import org.apache.eventmesh.dashboard.console.entity.function.HealthCheckResultEntity;
-import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache;
-import org.apache.eventmesh.dashboard.console.function.health.HealthService;
-import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
-import org.apache.eventmesh.dashboard.console.service.function.HealthDataService;
-
-import java.util.List;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.jdbc.Sql;
-
-@SpringBootTest
-@ActiveProfiles("test")
-@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"})
-@Timeout(value = 10)
-public class HealthServiceIntegrateTest {
-
- private final CheckResultCache checkResultCache = CheckResultCache.getINSTANCE();
- HealthService healthService = new HealthService();
- @Autowired
- private HealthDataService healthDataService;
-
- @BeforeEach
- void init() {
- healthService.createExecutor(healthDataService, checkResultCache);
- }
-
- @Test
- void testStorageRedis() throws InterruptedException {
- HealthCheckObjectConfig config = HealthCheckObjectConfig.builder()
- .clusterId(1L)
- .instanceId(1L)
- .healthCheckResourceType("storage")
- .healthCheckResourceSubType("redis")
- .connectUrl("redis://localhost:6379")
- .build();
- healthService.insertCheckService(config);
- healthService.executeAll();
- Thread.sleep(1000);
- healthService.executeAll();
-
- HealthCheckResultEntity queryEntity = new HealthCheckResultEntity();
- queryEntity.setClusterId(1L);
- queryEntity.setType(HealthCheckType.STORAGE.getNumber());
- queryEntity.setTypeId(1L);
- List<HealthCheckResultEntity> results = healthDataService.queryHealthCheckResultByClusterIdAndTypeAndTypeId(queryEntity);
- Assertions.assertEquals(2, results.size());
- }
-}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java
index c52b31a..47088f0 100644
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.linkage.log;
import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
@@ -48,10 +49,10 @@
GroupEntity groupEntity = new GroupEntity();
groupEntity.setClusterId(1L);
groupEntity.setName("logTest");
- groupEntity.setStatus(1);
+ groupEntity.setStatus(1L);
groupEntity.setType(0);
- groupEntity.setState("OS");
- groupService.insertGroup(groupEntity);
+
+ groupService.addGroup(groupEntity);
LogEntity logEntity = new LogEntity();
logEntity.setClusterId(1L);
logEntity.setOperationType("add");
@@ -59,7 +60,7 @@
logEntity.setContent(groupEntity.toString());
logEntity.setResult(groupEntity.toString());
logEntity.setId(groupEntity.getId());
- List<LogEntity> logListByCluster = logService.selectLogListByCluster(new GetLogListDTO());
+ List<LogEntity> logListByCluster = logService.getLogListByCluster(new GetLogListDTO());
logListByCluster.get(0).setId(null);
logListByCluster.get(0).setCreateTime(null);
logListByCluster.get(0).setEndTime(null);
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterDataMapperTest.java
similarity index 64%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java
copy to eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterDataMapperTest.java
index 2afd16c..fd3a64f 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterDataMapperTest.java
@@ -15,23 +15,21 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.mapstruct.config;
+package org.apache.eventmesh.dashboard.console.mapper.cluster;
-
-import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
-import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
-/**
- *
- */
-
@Mapper
-public interface ConfigControllerMapper {
+public interface ClusterDataMapperTest {
- ConfigControllerMapper INSTANCE = Mappers.getMapper(ConfigControllerMapper.class);
+ ClusterDataMapperTest INSTANCE = Mappers.getMapper(ClusterDataMapperTest.class);
- public ConfigEntity queryEntityByConfig(GetConfigsListDTO getConfigsListDTO);
+ @Mapping(source = "id", target = "clusterId")
+ RuntimeEntity toRuntimeEntity(ClusterEntity clusterEntity);
+
}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterEntityMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterEntityMapperTest.java
new file mode 100644
index 0000000..03819d3
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterEntityMapperTest.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.mapper.cluster;
+
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterOwnType;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType.FirstToWhom;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.DeployStatusType;
+import org.apache.eventmesh.dashboard.common.enums.ReplicationType;
+import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
+import org.apache.eventmesh.dashboard.console.databuild.BuildFullSceneData;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
+import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase.Replace;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.jdbc.Sql;
+import org.springframework.test.context.junit4.SpringRunner;
+
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {EventMeshDashboardApplication.class})
+@Sql(scripts = {"classpath:eventmesh-dashboard.sql"})
+@AutoConfigureTestDatabase(replace = Replace.NONE)
+public class ClusterEntityMapperTest {
+
+
+ @Autowired
+ private ClusterMapper clusterMapper;
+
+
+ @Autowired
+ private ClusterRelationshipMapper clusterRelationshipMapper;
+
+ private BuildFullSceneData buildFullSceneData = new BuildFullSceneData();
+
+ private static final AtomicLong nameIndex = new AtomicLong();
+
+ private ClusterEntity clusterEntity = new ClusterEntity();
+
+ @Before
+ public void init() {
+ this.clusterEntity = createClusterEntity();
+ this.clusterMapper.insertCluster(clusterEntity);
+ }
+
+ public static ClusterEntity createClusterEntity(){
+ return createClusterEntity(ClusterType.EVENTMESH_CLUSTER);
+ }
+
+ public static ClusterEntity createClusterEntity(ClusterType clusterType) {
+ ClusterEntity clusterEntity = new ClusterEntity();
+ clusterEntity.setOrganizationId(1L);
+ clusterEntity.setName("test-" + nameIndex.incrementAndGet());
+ clusterEntity.setClusterType(clusterType);
+ clusterEntity.setVersion("");
+ clusterEntity.setTrusteeshipType(ClusterTrusteeshipType.SELF);
+ clusterEntity.setFirstToWhom(FirstToWhom.NOT);
+ clusterEntity.setReplicationType(ReplicationType.NOT);
+ clusterEntity.setDeployStatusType(DeployStatusType.CREATE_WAIT);
+ clusterEntity.setClusterOwnType(ClusterOwnType.INDEPENDENCE);
+ clusterEntity.setResourcesConfigId(1L);
+ clusterEntity.setDeployScriptId(1L);
+
+ clusterEntity.setDescription("");
+ clusterEntity.setConfig("");
+ clusterEntity.setAuthType("");
+ clusterEntity.setJmxProperties("");
+
+ return clusterEntity;
+ }
+
+
+ @Test
+ public void test_queryRelationClusterByClusterIdAndType() {
+ this.buildFullSceneData.buildReplica(ClusterType.STORAGE_REDIS_CLUSTER);
+
+ }
+
+ @Test
+ public void test_batch_cluster() {
+ List<ClusterEntity> clusterEntityList = new ArrayList<>();
+ for (int i = 0; i < 10; i++) {
+ clusterEntityList.add(createClusterEntity());
+ }
+ this.clusterMapper.batchInsert(clusterEntityList);
+ clusterEntityList.forEach(clusterEntity -> {
+ ClusterEntity newClusterEntity = this.clusterMapper.queryByClusterId(clusterEntity);
+ Assert.assertNotNull(newClusterEntity);
+ });
+ List<ClusterEntity> newClusterEntity = this.clusterMapper.queryAllCluster();
+ Assert.assertEquals(11, newClusterEntity.size());
+ }
+
+ @Test
+ public void test_insert_cluster() {
+ ClusterEntity newClusterEntity = this.clusterMapper.queryByClusterId(clusterEntity);
+ Assert.assertNotNull(newClusterEntity);
+ }
+
+ public void test_updateNumByClusterId() {
+
+ this.clusterMapper.insertCluster(clusterEntity);
+
+ clusterMapper.updateNumByClusterId(clusterEntity);
+ }
+}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapperTest.java
new file mode 100644
index 0000000..59b1f73
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapperTest.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.mapper.cluster;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
+import org.apache.eventmesh.dashboard.console.databuild.BuildFullSceneData;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity;
+import org.apache.eventmesh.dashboard.console.modle.DO.clusterRelationship.QueryListByClusterIdAndTypeDO;
+
+import java.time.LocalDateTime;
+import java.time.temporal.ChronoUnit;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
+import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase.Replace;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.jdbc.Sql;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {EventMeshDashboardApplication.class})
+@Sql(scripts = {"classpath:eventmesh-dashboard.sql"})
+@AutoConfigureTestDatabase(replace = Replace.NONE)
+public class ClusterRelationshipMapperTest {
+
+ @Autowired
+ private ClusterRelationshipMapper clusterRelationshipMapper;
+
+
+ @Autowired
+ private ClusterMapper clusterMapper;
+
+ private BuildFullSceneData buildFullSceneData = new BuildFullSceneData();
+
+ private static final AtomicLong nameIndex = new AtomicLong(2);
+
+ private ClusterRelationshipEntity clusterRelationshipEntity;
+
+
+ @Test
+ public void test_queryListByClusterIdAndType() {
+ this.buildFullSceneData.build(ClusterType.EVENTMESH_CLUSTER);
+ this.clusterMapper.batchInsert(this.buildFullSceneData.getClusterEntityList());
+ this.buildFullSceneData.createClusterRelationshipEntity();
+ List<ClusterRelationshipEntity> clusterRelationshipEntityList = this.buildFullSceneData.getClusterRelationshipEntityList();
+
+ this.clusterRelationshipMapper.batchClusterRelationshipEntry(clusterRelationshipEntityList);
+
+ QueryListByClusterIdAndTypeDO data = new QueryListByClusterIdAndTypeDO();
+ data.setClusterId(this.buildFullSceneData.getClusterTripleList().get(0).getLeft().getId());
+ List<ClusterRelationshipEntity> newClusterRelationshipEntityList = this.clusterRelationshipMapper.queryListByClusterIdAndType(data);
+
+ data.setRelationshipTypeList(List.of(ClusterType.EVENTMESH_RUNTIME));
+ newClusterRelationshipEntityList = this.clusterRelationshipMapper.queryListByClusterIdAndType(data);
+
+ newClusterRelationshipEntityList.size();
+ }
+
+ @Test
+ public void test_selectNewlyIncreased() {
+ this.test_batchClusterRelationshipEntry();
+
+ ClusterRelationshipEntity clusterRelationshipEntity = new ClusterRelationshipEntity();
+ clusterRelationshipEntity.setUpdateTime(LocalDateTime.now().plusHours(1L).truncatedTo(ChronoUnit.MILLIS));
+ List<ClusterRelationshipEntity> clusterRelationshipEntityList =
+ this.clusterRelationshipMapper.queryNewlyIncreased(clusterRelationshipEntity);
+ Assert.assertEquals(0, clusterRelationshipEntityList.size());
+
+ clusterRelationshipEntity.setUpdateTime(LocalDateTime.now().minusHours(1L).truncatedTo(ChronoUnit.MILLIS));
+ clusterRelationshipEntityList = this.clusterRelationshipMapper.queryNewlyIncreased(clusterRelationshipEntity);
+ Assert.assertEquals(10, clusterRelationshipEntityList.size());
+ }
+
+ @Test
+ public void test_relieveRelationship() {
+ this.test_insert_ClusterRelationshipEntry();
+ this.clusterRelationshipMapper.relieveRelationship(this.clusterRelationshipEntity);
+ ClusterRelationshipEntity clusterRelationshipEntity = this.clusterRelationshipMapper.queryById(this.clusterRelationshipEntity);
+ Assert.assertEquals(3, clusterRelationshipEntity.getStatus(), 1L);
+
+ }
+
+ @Test
+ public void test_batchClusterRelationshipEntry() {
+ List<ClusterRelationshipEntity> clusterRelationshipEntityList = new ArrayList<>();
+ for (int i = 0; i < 10; i++) {
+ clusterRelationshipEntityList.add(this.buildClusterRelationshipEntity());
+ }
+ this.clusterRelationshipMapper.batchClusterRelationshipEntry(clusterRelationshipEntityList);
+ clusterRelationshipEntityList = this.clusterRelationshipMapper.queryAll(null);
+ Assert.assertEquals(10, clusterRelationshipEntityList.size());
+
+ }
+
+ @Test
+ public void test_insert_ClusterRelationshipEntry() {
+ clusterRelationshipEntity = this.buildClusterRelationshipEntity();
+ this.clusterRelationshipMapper.insertClusterRelationshipEntry(clusterRelationshipEntity);
+ clusterRelationshipEntity = this.clusterRelationshipMapper.queryById(clusterRelationshipEntity);
+ Assert.assertNotNull(clusterRelationshipEntity);
+ }
+
+ public static ClusterRelationshipEntity buildClusterRelationshipEntity(ClusterEntity clusterEntity, ClusterEntity relationshipEntity) {
+ ClusterRelationshipEntity clusterRelationshipEntity = new ClusterRelationshipEntity();
+ clusterRelationshipEntity.setOrganizationId(clusterEntity.getOrganizationId());
+ clusterRelationshipEntity.setClusterId(clusterEntity.getId());
+ clusterRelationshipEntity.setClusterType(clusterEntity.getClusterType());
+ clusterRelationshipEntity.setRelationshipId(relationshipEntity.getId());
+ clusterRelationshipEntity.setRelationshipType(relationshipEntity.getClusterType());
+ return clusterRelationshipEntity;
+
+ }
+
+ public ClusterRelationshipEntity buildClusterRelationshipEntity() {
+ ClusterEntity clusterEntity = new ClusterEntity();
+ clusterEntity.setOrganizationId(1L);
+ clusterEntity.setClusterType(ClusterType.EVENTMESH_CLUSTER);
+ clusterEntity.setId(1L);
+ ClusterEntity relationshipEntity = new ClusterEntity();
+ relationshipEntity.setClusterType(ClusterType.EVENTMESH_RUNTIME);
+ relationshipEntity.setId(nameIndex.incrementAndGet());
+ return buildClusterRelationshipEntity(clusterEntity, relationshipEntity);
+ }
+
+
+}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/cluster/RuntimeEntityMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/cluster/RuntimeEntityMapperTest.java
new file mode 100644
index 0000000..e14cafd
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/cluster/RuntimeEntityMapperTest.java
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.mapper.cluster;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
+import org.apache.eventmesh.dashboard.console.databuild.BuildFullSceneData;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.modle.DO.runtime.QueryRuntimeByBigExpandClusterDO;
+
+import org.apache.commons.lang3.tuple.Triple;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
+import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase.Replace;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.jdbc.Sql;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {EventMeshDashboardApplication.class})
+@Sql(scripts = {"classpath:eventmesh-dashboard.sql"})
+@AutoConfigureTestDatabase(replace = Replace.NONE)
+public class RuntimeEntityMapperTest {
+
+ @Autowired
+ private ClusterMapper clusterMapper;
+
+ @Autowired
+ private RuntimeMapper runtimeMapper;
+
+ @Autowired
+ private ClusterRelationshipMapper clusterRelationshipMapper;
+
+ private BuildFullSceneData buildFullSceneData = new BuildFullSceneData();
+
+ private static final AtomicLong nameIndex = new AtomicLong(2);
+
+ @Test
+ public void test_queryClusterRuntimeOnClusterSpecifyByClusterId() {
+ buildFullSceneData.build(ClusterType.EVENTMESH_CLUSTER);
+ clusterMapper.batchInsert(buildFullSceneData.getClusterEntityList());
+ clusterRelationshipMapper.batchClusterRelationshipEntry(buildFullSceneData.createClusterRelationshipEntity());
+ runtimeMapper.batchInsert(buildFullSceneData.createRuntimeEntity());
+
+ buildFullSceneData.getClusterTripleList().forEach(triple -> {
+ final Set<Long> idSet =
+ buildFullSceneData.getRuntimeEntityList(triple.getRight()).stream().map(RuntimeEntity::getClusterId).collect(Collectors.toSet());
+ triple.getMiddle().forEach(entity -> {
+ test_queryClusterRuntimeOnClusterSpecifyByClusterId(entity, triple.getLeft().getClusterType().getRuntimeClusterType(), idSet);
+ });
+ final Set<Long> idSet1 =
+ buildFullSceneData.getRuntimeEntityList(triple.getMiddle()).stream().map(RuntimeEntity::getClusterId).collect(Collectors.toSet());
+ triple.getRight().forEach(entity -> {
+ test_queryClusterRuntimeOnClusterSpecifyByClusterId(entity, triple.getLeft().getClusterType().getMetaClusterType(), idSet1);
+ });
+
+ });
+ }
+
+ private void test_queryClusterRuntimeOnClusterSpecifyByClusterId(ClusterEntity clusterEntity, List<ClusterType> clusterTypeList,
+ Set<Long> idSet) {
+ QueryRuntimeByBigExpandClusterDO queryRuntimeByBigExpandClusterDO =
+ QueryRuntimeByBigExpandClusterDO.builder()
+ .followClusterId(clusterEntity.getId())
+ .queryClusterTypeList(clusterTypeList).build();
+ List<RuntimeEntity> runtimeEntityList = runtimeMapper.queryClusterRuntimeOnClusterSpecifyByClusterId(queryRuntimeByBigExpandClusterDO);
+ Set<Long> neIdSet = runtimeEntityList.stream().map(RuntimeEntity::getClusterId).collect(Collectors.toSet());
+ Assert.assertEquals(idSet, neIdSet);
+ }
+
+ @Test
+ public void test_queryRuntimeByBigExpandCluster() {
+ buildFullSceneData.build(ClusterType.EVENTMESH_CLUSTER);
+ clusterMapper.batchInsert(buildFullSceneData.getClusterEntityList());
+ clusterRelationshipMapper.batchClusterRelationshipEntry(buildFullSceneData.createClusterRelationshipEntity());
+ runtimeMapper.batchInsert(buildFullSceneData.createRuntimeEntity());
+
+ List<Triple<ClusterEntity, List<ClusterEntity>, List<ClusterEntity>>> triples =
+ buildFullSceneData.getClusterTripleList(ClusterType.EVENTMESH_CLUSTER);
+ List<RuntimeEntity> allEntityList = new ArrayList<>();
+ triples.forEach(triple -> {
+ AtomicReference<List<RuntimeEntity>> oldRef = new AtomicReference<>();
+ triple.getRight().forEach(triple1 -> {
+ QueryRuntimeByBigExpandClusterDO queryRuntimeByBigExpandClusterDO =
+ QueryRuntimeByBigExpandClusterDO.builder()
+ .followClusterId(triple1.getId())
+ .mainClusterType(ClusterType.EVENTMESH_CLUSTER)
+ .storageClusterTypeList(ClusterType.getStorageCluster())
+ .storageMetaClusterTypeList(ClusterType.getStorageMetaCluster())
+ .build();
+ List<RuntimeEntity> runtimeEntityList = runtimeMapper.queryRuntimeByBigExpandCluster(queryRuntimeByBigExpandClusterDO);
+ allEntityList.addAll(runtimeEntityList);
+ if (Objects.nonNull(oldRef.get())) {
+ Assert.assertEquals(oldRef.get(), runtimeEntityList);
+ }
+ oldRef.set(runtimeEntityList);
+ });
+
+ });
+
+
+ }
+
+
+ @Test
+ public void test_queryRuntimeByClusterId() {
+ buildFullSceneData.build(ClusterType.EVENTMESH_CLUSTER);
+ clusterMapper.batchInsert(buildFullSceneData.getClusterEntityList());
+
+ List<RuntimeEntity> runtimeEntityList = buildFullSceneData.createRuntimeEntity();
+ runtimeMapper.batchInsert(runtimeEntityList);
+ AtomicInteger atomicInteger = new AtomicInteger();
+ List<RuntimeEntity> list = new ArrayList<>();
+ buildFullSceneData.getClusterTripleList().forEach(triple -> {
+ List<ClusterEntity> clusterEntityList = new ArrayList<>();
+ clusterEntityList.addAll(triple.getMiddle());
+ clusterEntityList.addAll(triple.getRight());
+ List<RuntimeEntity> runtimeEntityList1 = this.runtimeMapper.queryRuntimeByClusterId(clusterEntityList);
+ list.addAll(runtimeEntityList1);
+ });
+ Assert.assertEquals(list.size(), runtimeEntityList.size());
+ }
+
+
+ @Test
+ public void test_batch() {
+ ClusterEntity clusterEntity = ClusterEntityMapperTest.createClusterEntity();
+ clusterEntity.setId(1L);
+ List<RuntimeEntity> runtimeEntityList = new ArrayList<>();
+ for (int i = 0; i < 10; i++) {
+ RuntimeEntity runtimeEntity = createRuntimeEntity(clusterEntity);
+ runtimeEntityList.add(runtimeEntity);
+ }
+ this.runtimeMapper.batchInsert(runtimeEntityList);
+ runtimeEntityList = this.runtimeMapper.queryAll();
+ Assert.assertEquals(10, runtimeEntityList.size());
+ }
+
+ @Test
+ public void test_insert() {
+ ClusterEntity clusterEntity = ClusterEntityMapperTest.createClusterEntity();
+ clusterEntity.setId(1L);
+ RuntimeEntity runtimeEntity = createRuntimeEntity(clusterEntity);
+ runtimeEntity.setClusterId(clusterEntity.getId());
+ this.runtimeMapper.insertRuntime(runtimeEntity);
+ runtimeEntity = this.runtimeMapper.queryRuntimeEntityById(runtimeEntity);
+
+ Assert.assertNotNull(runtimeEntity);
+ this.runtimeMapper.insertRuntime(runtimeEntity);
+ RuntimeEntity newRuntimeEntity = this.runtimeMapper.queryRuntimeEntityById(runtimeEntity);
+ // TODO h2 不支持 MySQL ON DUPLICATE KEY UPDATE
+ //Assert.assertNotEquals(runtimeEntity.getOnlineTimestamp(), newRuntimeEntity.getOnlineTimestamp());
+ }
+
+ public static RuntimeEntity createRuntimeEntity(ClusterEntity clusterEntity) {
+ RuntimeEntity runtimeEntity = ClusterDataMapperTest.INSTANCE.toRuntimeEntity(clusterEntity);
+ runtimeEntity.setName(nameIndex.incrementAndGet() + "-----runtime");
+ runtimeEntity.setHost(nameIndex.incrementAndGet() + "");
+ runtimeEntity.setPort((int) nameIndex.get());
+ runtimeEntity.setJmxPort((int) nameIndex.get());
+ runtimeEntity.setKubernetesClusterId(nameIndex.get());
+ return runtimeEntity;
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/message/TopicEntityMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/message/TopicEntityMapperTest.java
new file mode 100644
index 0000000..a6bfff8
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/message/TopicEntityMapperTest.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.mapper.message;
+
+
+import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
+import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
+import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase.Replace;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.jdbc.Sql;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {EventMeshDashboardApplication.class})
+@Sql(scripts = {"classpath:eventmesh-dashboard.sql"})
+@AutoConfigureTestDatabase(replace = Replace.NONE)
+public class TopicEntityMapperTest {
+
+ @Autowired
+ private TopicMapper topicMapper;
+
+ private static AtomicLong nameIndex = new AtomicLong();
+
+ @Test
+ public void test_batch_delete() {
+ this.test_batch_insert();
+ List<TopicEntity> topicEntityList = this.topicMapper.selectAll();
+ int num = this.topicMapper.deleteTopicByIds(topicEntityList);
+ Assert.assertEquals(num, topicEntityList.size());
+
+ List<TopicEntity> newTopicEntityList = this.topicMapper.selectAll();
+ Assert.assertEquals(0, newTopicEntityList.size());
+
+ }
+
+ @Test
+ public void test_batch_insert() {
+ List<TopicEntity> topicEntityList = new ArrayList<>();
+ for (int i = 0; i < 10; i++) {
+ topicEntityList.add(createTopicEntity());
+ }
+ topicMapper.batchInsert(topicEntityList);
+
+ List<TopicEntity> newTopicEntityList = this.topicMapper.selectAll();
+ Assert.assertEquals(topicEntityList.size(), newTopicEntityList.size());
+ }
+
+ @Test
+ public void test_insertTopic() {
+ TopicEntity topicEntity = createTopicEntity();
+ topicMapper.insertTopic(topicEntity);
+
+ topicEntity = topicMapper.queryTopicById(topicEntity);
+ Assert.assertNotNull(topicEntity);
+
+ }
+
+
+ public static TopicEntity createTopicEntity() {
+ return createTopicEntity(1L, 2L);
+ }
+
+ public static TopicEntity createTopicEntity(Long clusterId, Long topicId) {
+ TopicEntity topicEntity = new TopicEntity();
+ topicEntity.setClusterId(1L);
+ topicEntity.setRuntimeId(2L);
+ topicEntity.setTopicName("test-" + nameIndex.getAndIncrement());
+ topicEntity.setTopicType("topicType");
+ topicEntity.setNumQueue(8L);
+ topicEntity.setReplicationFactor(2);
+ topicEntity.setTopicFilterType("topicFilterType");
+ topicEntity.setAttributes("1");
+ topicEntity.setOrder("desc");
+ topicEntity.setRetentionMs(1L);
+ topicEntity.setDescription("desc");
+ topicEntity.setCreateProgress(1);
+ return topicEntity;
+ }
+
+
+}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/model/domain/ClusterMetadataDomainTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/model/domain/ClusterMetadataDomainTest.java
new file mode 100644
index 0000000..a4a186e
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/model/domain/ClusterMetadataDomainTest.java
@@ -0,0 +1,218 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.model.domain;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.console.domain.metadata.ClusterMetadataDomain;
+import org.apache.eventmesh.dashboard.console.domain.metadata.ClusterMetadataDomain.DataHandler;
+import org.apache.eventmesh.dashboard.console.domain.metadata.MetadataAllDO;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseIdEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.core.cluster.ClusterBaseDO;
+import org.apache.eventmesh.dashboard.core.cluster.ColonyDO;
+import org.apache.eventmesh.dashboard.core.cluster.RuntimeBaseDO;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ClusterMetadataDomainTest {
+
+ public ClusterMetadataDomain clusterMetadataDomain = new ClusterMetadataDomain();
+
+ private MetadataAllDO metadataAllDO;
+
+ private MetadataAllDO deleteMetadataAllDO;
+
+ private ClusterEntity clusterEntity = new ClusterEntity();
+
+ private List<ClusterEntity> clusterEntityList = new ArrayList<>();
+
+ private List<ClusterRelationshipEntity> clusterRelationshipEntityList = new ArrayList<>();
+
+ private List<RuntimeEntity> runtimeEntityList = new ArrayList<>();
+
+ private AtomicLong atomicLong = new AtomicLong(1L);
+
+
+ @Before
+ public void init() {
+ clusterMetadataDomain.rootClusterDHO();
+ clusterMetadataDomain.useBuildConfig();
+ clusterMetadataDomain.isConsoleModel();
+ clusterMetadataDomain.setHandler(new DataHandler() {
+ @Override
+ public void registerRuntime(RuntimeEntity runtimeEntity, RuntimeBaseDO runtimeBaseDO, ColonyDO colonyDO) {
+ ClusterType clusterType = runtimeEntity.getClusterType();
+ System.out.println("registerRuntime clusterType : " + clusterType);
+ }
+
+ @Override
+ public void unRegisterRuntime(RuntimeEntity runtimeEntity, RuntimeBaseDO runtimeBaseDO, ColonyDO colonyDO) {
+ ClusterType clusterType = runtimeEntity.getClusterType();
+ System.out.println("unRegisterRuntime clusterType : " + clusterType);
+ }
+
+ @Override
+ public void registerCluster(ClusterEntity clusterEntity, ClusterBaseDO clusterBaseDO, ColonyDO colonyDO) {
+ ClusterType clusterType = clusterEntity.getClusterType();
+ System.out.println("registerCluster clusterType : " + clusterType);
+ }
+
+ @Override
+ public void unRegisterCluster(ClusterEntity clusterEntity, ClusterBaseDO clusterBaseDO, ColonyDO colonyDO) {
+ ClusterType clusterType = clusterEntity.getClusterType();
+ System.out.println("clusterType clusterType : " + clusterType);
+ }
+ });
+ metadataAllDO =
+ MetadataAllDO.builder().clusterEntityList(clusterEntityList).clusterRelationshipEntityList(clusterRelationshipEntityList)
+ .runtimeEntityList(runtimeEntityList).build();
+ this.test_EventMesh_Cluster();
+ }
+
+ public Long getId() {
+ return atomicLong.getAndIncrement();
+ }
+
+ private void handler() {
+ this.clusterMetadataDomain.handlerMetadata(this.metadataAllDO);
+ this.randomDelete();
+ }
+
+ private void randomDelete() {
+
+ deleteMetadataAllDO =
+ MetadataAllDO.builder()
+ .runtimeEntityList(this.deleteEntity(this.runtimeEntityList)).build();
+ this.clusterMetadataDomain.handlerMetadata(this.deleteMetadataAllDO);
+
+ deleteMetadataAllDO =
+ MetadataAllDO.builder()
+ .clusterEntityList(this.deleteEntity(this.clusterEntityList)).build();
+ this.clusterMetadataDomain.handlerMetadata(this.deleteMetadataAllDO);
+
+ }
+
+ private <T> T deleteEntity(Object object) {
+ List<BaseIdEntity> baseIdEntities = (List<BaseIdEntity>) object;
+ Random random = new Random();
+ List<BaseIdEntity> deleteBaseIdEntity = new ArrayList<>();
+ baseIdEntities.forEach((value) -> {
+ if (random.nextInt(100) < 10) {
+ value.setStatus(0L);
+ deleteBaseIdEntity.add(value);
+ }
+ });
+ return (T) deleteBaseIdEntity;
+ }
+
+ private void createClusterRelationshipEntity(ClusterEntity mainCluster, ClusterEntity clusterEntity) {
+ ClusterRelationshipEntity clusterRelationshipEntity = new ClusterRelationshipEntity();
+ clusterRelationshipEntity.setClusterId(mainCluster.getId());
+ clusterRelationshipEntity.setClusterType(mainCluster.getClusterType());
+
+ clusterRelationshipEntity.setRelationshipId(clusterEntity.getId());
+ clusterRelationshipEntity.setRelationshipType(clusterEntity.getClusterType());
+ this.clusterRelationshipEntityList.add(clusterRelationshipEntity);
+ }
+
+ @Test
+ public void test_EventMesh_Cluster() {
+
+ clusterEntity.setId(this.getId());
+ clusterEntity.setClusterType(ClusterType.EVENTMESH_CLUSTER);
+ clusterEntityList.add(clusterEntity);
+
+ this.createCluster(clusterEntity, ClusterType.EVENTMESH_META_NACOS);
+ this.createCluster(clusterEntity, ClusterType.EVENTMESH_META_NACOS);
+
+ this.createCluster(clusterEntity, ClusterType.EVENTMESH_RUNTIME);
+ this.createCluster(clusterEntity, ClusterType.EVENTMESH_RUNTIME);
+
+ }
+
+ public void createRuntime(ClusterEntity cluster) {
+ for (int i = 0; i < 5; i++) {
+ RuntimeEntity runtimeEntity = new RuntimeEntity();
+ runtimeEntity.setId(this.getId());
+ runtimeEntity.setClusterId(cluster.getId());
+ runtimeEntity.setClusterType(cluster.getClusterType());
+ runtimeEntity.setStatus(1L);
+ this.runtimeEntityList.add(runtimeEntity);
+ }
+ }
+
+ @Test
+ public void test_RockerMQ_Cluster() {
+ ClusterEntity clusterEntity = this.createCluster(this.clusterEntity, ClusterType.STORAGE_ROCKETMQ_CLUSTER);
+
+ this.createCluster(clusterEntity, ClusterType.STORAGE_ROCKETMQ_NAMESERVER);
+ this.createCluster(clusterEntity, ClusterType.STORAGE_ROCKETMQ_NAMESERVER);
+
+ // 创建 broker cluster
+
+ ClusterEntity runtimeCluster = this.createCluster(clusterEntity, ClusterType.STORAGE_ROCKETMQ_BROKER);
+ this.createCluster(runtimeCluster, ClusterType.STORAGE_ROCKETMQ_BROKER_MAIN_SLAVE);
+ this.createCluster(runtimeCluster, ClusterType.STORAGE_ROCKETMQ_BROKER_MAIN_SLAVE);
+
+ // 创建 broker cluster
+ runtimeCluster = this.createCluster(clusterEntity, ClusterType.STORAGE_ROCKETMQ_BROKER);
+ this.createCluster(runtimeCluster, ClusterType.STORAGE_ROCKETMQ_BROKER_MAIN_SLAVE);
+ this.createCluster(runtimeCluster, ClusterType.STORAGE_ROCKETMQ_BROKER_MAIN_SLAVE);
+
+ this.handler();
+
+ }
+
+ @Test
+ public void test_Kafka_Cluster() {
+ ClusterEntity clusterEntity = this.createCluster(this.clusterEntity, ClusterType.STORAGE_KAFKA_CLUSTER);
+
+ this.createCluster(clusterEntity, ClusterType.STORAGE_KAFKA_ZK);
+
+ // 创建 broker cluster
+ this.createCluster(clusterEntity, ClusterType.STORAGE_KAFKA_BROKER);
+ this.handler();
+ }
+
+ public ClusterEntity createCluster(ClusterEntity mainCluster, ClusterType clusterType) {
+ ClusterEntity clusterEntity = new ClusterEntity();
+ clusterEntity.setId(this.getId());
+ clusterEntity.setClusterType(clusterType);
+ clusterEntity.setStatus(1L);
+ clusterEntityList.add(clusterEntity);
+ this.createClusterRelationshipEntity(mainCluster, clusterEntity);
+ if (!Objects.equals(clusterType.getAssemblyBusiness(), ClusterType.DEFINITION)) {
+ this.createRuntime(clusterEntity);
+ }
+ return clusterEntity;
+ }
+
+ private static class TestDataWrapper {
+
+ }
+}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterEntityServiceImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterEntityServiceImplTest.java
new file mode 100644
index 0000000..83dd4e0
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterEntityServiceImplTest.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.cluster.impl;
+
+import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
+
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = EventMeshDashboardApplication.class)
+public class ClusterEntityServiceImplTest {
+
+ @Autowired
+ private ClusterService clusterService;
+
+
+ @Before
+ public void nameExist() {
+ }
+
+ public void queryClusterById() {
+ }
+
+ public void queryClusterByOrganizationIdAndType() {
+ }
+
+
+ public void queryRelationClusterByClusterIdAndType() {
+ }
+
+ public void queryRelationshipClusterByClusterIdAndType() {
+ }
+
+ public void queryStorageByClusterId() {
+ }
+
+ public void queryAllSubClusterByClusterId() {
+ }
+
+ public void createCluster() {
+ }
+
+ public void getClusterBaseMessage() {
+ }
+
+
+ public void queryHomeClusterData() {
+ }
+
+ public void batchInsert() {
+ }
+
+ public void selectAll() {
+ }
+
+ public void selectNewlyIncreased() {
+ }
+
+ void insertCluster() {
+ }
+
+ void insertClusterAndRelationship() {
+ }
+
+ public void selectAllCluster() {
+ }
+
+
+ public void updateClusterById() {
+ }
+
+ public void deactivate() {
+ }
+
+ public void queryByUpdateTime() {
+ }
+
+ public void getIndex() {
+ }
+
+
+}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java
index 0884b5c..1b98ef9 100644
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java
@@ -15,18 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.console.service.connection.impl;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity;
-import org.apache.eventmesh.dashboard.console.service.cluster.impl.ConnectionDataServiceDatabaseImpl;
-
-import java.util.List;
-
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.jdbc.Sql;
@@ -39,18 +32,14 @@
@SpringBootTest
public class ConnectionDataServiceDatabaseImplTest {
- @Autowired
- private ConnectionDataServiceDatabaseImpl connectionServiceDatabaseImpl;
@Test
public void testGetAllConnectionsByClusterId() {
- List<ConnectionEntity> connectionEntityList = connectionServiceDatabaseImpl.getAllConnectionsByClusterId(1L);
- assertEquals(3, connectionEntityList.size());
+
}
@Test
public void testGetAllConnections() {
- List<ConnectionEntity> connectionEntityList = connectionServiceDatabaseImpl.getAllConnections();
- assertEquals(6, connectionEntityList.size());
+
}
-}
+}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/DefaultDataHandlerTest.java
similarity index 65%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/DefaultDataHandlerTest.java
index bf167b1..cad7767 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/DefaultDataHandlerTest.java
@@ -15,16 +15,20 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.console.spring.support;
-@Data
-public class ChangeConfigEntity {
- private String configName;
+import org.apache.eventmesh.dashboard.console.model.domain.ClusterMetadataDomainTest;
- private String configValue;
+import org.junit.Test;
- private Integer alreadyUpdate;
+public class DefaultDataHandlerTest {
+
+ private ClusterMetadataDomainTest clusterMetadataDomainTest = new ClusterMetadataDomainTest();
+
+ @Test
+ public void test() {
+ clusterMetadataDomainTest.clusterMetadataDomain.rootClusterDHO();
+ }
}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManagerTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManagerTest.java
deleted file mode 100644
index 5a1b63c..0000000
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManagerTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.console.spring.support;
-
-import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
-import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache;
-import org.apache.eventmesh.dashboard.console.function.health.HealthService;
-import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.SyncDataServiceWrapper;
-import org.apache.eventmesh.dashboard.console.service.DataServiceWrapper;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.jdbc.Sql;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@ExtendWith(MockitoExtension.class)
-@ExtendWith(SpringExtension.class)
-@ActiveProfiles("test")
-@SpringBootTest(classes = EventMeshDashboardApplication.class)
-@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"})
-//We don't have runtime and topic check for now, so runtime-test.sql and topic-test.sql is not used
-@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:client-test.sql", "classpath:connection-test.sql",
- "classpath:connector-test.sql", "classpath:meta-test.sql", "classpath:store-test.sql"})
-class FunctionManagerTest {
-
- @Autowired
- private DataServiceWrapper dataServiceWrapper;
-
- @Autowired
- private SyncDataServiceWrapper syncDataServiceWrapper;
-
- private FunctionManager functionManager;
-
- private HealthService healthService;
-
- @BeforeEach
- void setUpData() {
- functionManager = new FunctionManager();
- FunctionManagerProperties properties = new FunctionManagerProperties();
- properties.setDataServiceContainer(dataServiceWrapper);
- properties.setSyncDataServiceWrapper(syncDataServiceWrapper);
-
- functionManager.setProperties(properties);
- healthService = new HealthService();
- healthService.createExecutor(properties.getDataServiceContainer().getHealthDataService(), CheckResultCache.getINSTANCE());
- functionManager.setHealthService(healthService);
- }
-
- @Test
- void testHealthCheck() {
- functionManager.getHealthService().updateHealthCheckConfigs(dataServiceWrapper);
- healthService.executeAll();
- healthService.executeAll();
- Assertions.assertNotEquals(4, dataServiceWrapper.getHealthDataService().selectAll().size());
- }
-}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/RuntimeDeployServiceTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/RuntimeDeployServiceTest.java
new file mode 100644
index 0000000..011a798
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/RuntimeDeployServiceTest.java
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.spring.support;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.DeployStatusType;
+import org.apache.eventmesh.dashboard.console.entity.cases.DeployScriptEntity;
+import org.apache.eventmesh.dashboard.console.entity.cases.ResourcesConfigEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterRelationshipService;
+import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
+import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService;
+import org.apache.eventmesh.dashboard.console.service.connector.ResourcesConfigService;
+import org.apache.eventmesh.dashboard.console.service.deploy.DeployScriptService;
+import org.apache.eventmesh.dashboard.console.service.deploy.PortService;
+import org.apache.eventmesh.dashboard.console.service.function.ConfigService;
+import org.apache.eventmesh.dashboard.console.spring.support.RuntimeDeployService.AbstractRuntimeServiceTask;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKManage;
+
+import org.apache.commons.lang3.reflect.FieldUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockedStatic;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import io.fabric8.kubernetes.client.KubernetesClient;
+import io.micrometer.core.instrument.util.IOUtils;
+
+@RunWith(MockitoJUnitRunner.class)
+public class RuntimeDeployServiceTest {
+
+
+ private RuntimeDeployService runtimeDeployService = new RuntimeDeployService();
+
+
+ @Mock
+ private ClusterService clusterService;
+
+ @Mock
+ private RuntimeService runtimeService;
+
+ @Mock
+ private ClusterRelationshipService clusterRelationshipService;
+
+ @Mock
+ private DeployScriptService deployScriptService;
+
+ @Mock
+ private ResourcesConfigService resourcesConfigService;
+
+ @Mock
+ private ConfigService configService;
+
+
+ private RuntimeEntity runtimeEntity = new RuntimeEntity();
+
+ private MockedStatic<SDKManage> sdkManageMockedStatic;
+
+ @Mock
+ private SDKManage sdkManageMock;
+
+ @Mock
+ private KubernetesClient kubernetesClient;
+
+ @Mock
+ private PortService portService;
+
+
+ @Before
+ public void init() throws IllegalAccessException {
+ runtimeEntity.setClusterId(10L);
+ runtimeEntity.setId(10000L);
+
+ FieldUtils.writeField(runtimeDeployService, "clusterService", clusterService, true);
+ FieldUtils.writeField(runtimeDeployService, "runtimeService", runtimeService, true);
+ FieldUtils.writeField(runtimeDeployService, "clusterRelationshipService", clusterRelationshipService, true);
+ FieldUtils.writeField(runtimeDeployService, "deployScriptService", deployScriptService, true);
+ FieldUtils.writeField(runtimeDeployService, "resourcesConfigService", resourcesConfigService, true);
+ FieldUtils.writeField(runtimeDeployService, "configService", configService, true);
+ FieldUtils.writeField(runtimeDeployService, "portService", portService, true);
+
+ sdkManageMockedStatic = Mockito.mockStatic(SDKManage.class);
+ sdkManageMockedStatic.when(SDKManage::getInstance).thenReturn(sdkManageMock);
+
+ Mockito.when(sdkManageMock.getClient(Mockito.any(), Mockito.any())).thenReturn(kubernetesClient);
+
+
+ }
+
+
+ @Test
+ public void test_CREATE_WAIT() throws IllegalAccessException {
+ ClusterEntity clusterEntity = new ClusterEntity();
+ clusterEntity.setId(1L);
+ Mockito.when(clusterService.queryClusterById(Mockito.any())).thenReturn(clusterEntity);
+
+ ClusterEntity kubeClusterEntity = new ClusterEntity();
+ kubeClusterEntity.setId(2L);
+ Mockito.when(clusterService.queryRelationshipClusterByClusterIdAndType(Mockito.any())).thenReturn(kubeClusterEntity);
+
+ ResourcesConfigEntity resourcesConfigEntity = new ResourcesConfigEntity();
+ resourcesConfigEntity.setCpuNum(1F);
+ resourcesConfigEntity.setMemNum(2F);
+ resourcesConfigEntity.setDiskNum(3F);
+ Mockito.when(resourcesConfigService.queryResourcesById(Mockito.any())).thenReturn(resourcesConfigEntity);
+
+ DeployScriptEntity deployScriptEntity = new DeployScriptEntity();
+ deployScriptEntity.setId(1L);
+ String content = IOUtils.toString(RuntimeDeployServiceTest.class.getResourceAsStream("/kubernetes/EventMesh-runtime.yaml"));
+ deployScriptEntity.setContent(content);
+ Mockito.when(deployScriptService.queryById(Mockito.any())).thenReturn(deployScriptEntity);
+
+ Mockito.when(portService.getPorts(Mockito.any())).thenReturn(List.of(100 + "", 101 + "", 102 + "", 103 + ""));
+
+ List<ConfigEntity> configEntityList = new ArrayList<>();
+ for (int i = 1; i <= 30; i++) {
+ ConfigEntity configEntity = new ConfigEntity();
+ configEntity.setConfigName("config" + i);
+ configEntity.setConfigValue("config" + i);
+ configEntityList.add(configEntity);
+ }
+ Mockito.when(configService.queryByClusterAndInstanceId(Mockito.any())).thenReturn(configEntityList);
+
+ runtimeEntity.setClusterType(ClusterType.EVENTMESH_RUNTIME);
+ runtimeEntity.setDeployStatusType(DeployStatusType.CREATE_WAIT);
+ AbstractRuntimeServiceTask abstractRuntimeServiceTask = runtimeDeployService.createTask(runtimeEntity);
+ FieldUtils.writeField(abstractRuntimeServiceTask, "runtimeEntity", runtimeEntity, true);
+ abstractRuntimeServiceTask.run();
+ }
+
+ @Test
+ public void test_CREATE_UNINSTALL() throws IllegalAccessException {
+ ClusterEntity clusterEntity = new ClusterEntity();
+ clusterEntity.setId(1L);
+ Mockito.when(clusterService.queryClusterById(Mockito.any())).thenReturn(clusterEntity);
+
+ ClusterEntity kubeClusterEntity = new ClusterEntity();
+ kubeClusterEntity.setId(2L);
+ Mockito.when(clusterService.queryRelationshipClusterByClusterIdAndType(Mockito.any())).thenReturn(kubeClusterEntity);
+
+ runtimeEntity.setClusterType(ClusterType.EVENTMESH_RUNTIME);
+ runtimeEntity.setDeployStatusType(DeployStatusType.UNINSTALL);
+ AbstractRuntimeServiceTask abstractRuntimeServiceTask = runtimeDeployService.createTask(runtimeEntity);
+ FieldUtils.writeField(abstractRuntimeServiceTask, "runtimeEntity", runtimeEntity, true);
+ abstractRuntimeServiceTask.run();
+ }
+}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/RuntimeConvertMetaDataTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/RuntimeConvertMetaDataTest.java
new file mode 100644
index 0000000..345861e
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/metadata/convert/RuntimeConvertMetaDataTest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.console.spring.support.metadata.convert;
+
+import org.apache.eventmesh.dashboard.common.model.ConvertMetaData;
+import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
+import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity;
+
+import org.junit.Test;
+
+public class RuntimeConvertMetaDataTest {
+
+
+ @Test
+ public void test() {
+ ConvertMetaData<RuntimeEntity, RuntimeMetadata> convertMetaData = RuntimeConvertMetaData.INSTANCE;
+ RuntimeEntity runtimeEntity = new RuntimeEntity();
+ runtimeEntity.setId(1L);
+ runtimeEntity.setName("test");
+ runtimeEntity.setClusterId(2L);
+ RuntimeMetadata runtimeMetadata = convertMetaData.toMetaData(runtimeEntity);
+ System.out.println(runtimeMetadata);
+ }
+}
diff --git a/eventmesh-dashboard-console/src/test/resources/acl-test.sql b/eventmesh-dashboard-console/src/test/resources/acl-test.sql
index 5352e47..90c5838 100644
--- a/eventmesh-dashboard-console/src/test/resources/acl-test.sql
+++ b/eventmesh-dashboard-console/src/test/resources/acl-test.sql
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
INSERT INTO eventmesh_dashboard_test.acl (id, cluster_id, pattern, operation, permission_type, host, resource_type,
resource_name, pattern_type, create_time, update_time)
VALUES (3, 0, '', 0, '0', '', '0', 'source_name', 1, '2024-03-27 13:22:36', '2024-03-27 14:12:07');
diff --git a/eventmesh-dashboard-console/src/test/resources/application-test.yml b/eventmesh-dashboard-console/src/test/resources/application-test.yml
index 0b8c038..3c70abb 100644
--- a/eventmesh-dashboard-console/src/test/resources/application-test.yml
+++ b/eventmesh-dashboard-console/src/test/resources/application-test.yml
@@ -15,26 +15,13 @@
# limitations under the License.
#
+
spring:
datasource:
- name: eventmesh-console
- type: com.alibaba.druid.pool.DruidDataSource
- druid:
- driver-class-name: com.mysql.cj.jdbc.Driver
- url: jdbc:mysql://${DB_ADDRESS:localhost:3306}/eventmesh_dashboard_test?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true
- username: ${DB_USERNAME:root}
- password: ${DB_PASSWORD:password}
-
- initial-size: 1
- max-active: 50
- min-idle: 5
- max-wait: 6000
- validation-query: select 'x'
- validation-query-timeout: 15
- test-on-borrow: false
- test-while-idle: true
- min-evictable-idle-time-millis: 300000
-
+ url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;TIMEZONE=UTC # 内存模式,禁止自动关闭
+ driver-class-name: org.h2.Driver
+ username: sa
+ password: ""
logging:
level:
- root: INFO
\ No newline at end of file
+ root: INFO
diff --git a/eventmesh-dashboard-console/src/test/resources/client-test.sql b/eventmesh-dashboard-console/src/test/resources/client-test.sql
index 4a652f8..30c1afa 100644
--- a/eventmesh-dashboard-console/src/test/resources/client-test.sql
+++ b/eventmesh-dashboard-console/src/test/resources/client-test.sql
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
DELETE
FROM `eventmesh_dashboard_test`.client
WHERE TRUE;
diff --git a/eventmesh-dashboard-console/src/test/resources/connection-test.sql b/eventmesh-dashboard-console/src/test/resources/connection-test.sql
index b52a19b..8c4d135 100644
--- a/eventmesh-dashboard-console/src/test/resources/connection-test.sql
+++ b/eventmesh-dashboard-console/src/test/resources/connection-test.sql
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
DELETE
FROM `eventmesh_dashboard_test`.connection
WHERE TRUE;
diff --git a/eventmesh-dashboard-console/src/test/resources/connector-test.sql b/eventmesh-dashboard-console/src/test/resources/connector-test.sql
index 52cc0ab..2f294ec 100644
--- a/eventmesh-dashboard-console/src/test/resources/connector-test.sql
+++ b/eventmesh-dashboard-console/src/test/resources/connector-test.sql
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
DELETE
FROM `eventmesh_dashboard_test`.connection
WHERE TRUE;
diff --git a/eventmesh-dashboard-console/src/test/resources/health-test.sql b/eventmesh-dashboard-console/src/test/resources/health-test.sql
index 2640020..7a6875e 100644
--- a/eventmesh-dashboard-console/src/test/resources/health-test.sql
+++ b/eventmesh-dashboard-console/src/test/resources/health-test.sql
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
DELETE FROM `eventmesh_dashboard_test`.health_check_result WHERE TRUE;
ALTER TABLE `eventmesh_dashboard_test`.health_check_result AUTO_INCREMENT = 1;
diff --git a/eventmesh-dashboard-console/src/test/resources/instance-user-test.sql b/eventmesh-dashboard-console/src/test/resources/instance-user-test.sql
index 2a4b47b..4c26a19 100644
--- a/eventmesh-dashboard-console/src/test/resources/instance-user-test.sql
+++ b/eventmesh-dashboard-console/src/test/resources/instance-user-test.sql
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
DELETE FROM `eventmesh_dashboard_test`.instance_user WHERE TRUE;
ALTER TABLE `eventmesh_dashboard_test`.instance_user AUTO_INCREMENT = 1;
diff --git a/eventmesh-dashboard-console/src/test/resources/kubernetes/EventMesh-runtime-refer.yaml b/eventmesh-dashboard-console/src/test/resources/kubernetes/EventMesh-runtime-refer.yaml
new file mode 100644
index 0000000..3c65fb6
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/resources/kubernetes/EventMesh-runtime-refer.yaml
@@ -0,0 +1,80 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: eventmesh-runtime
+ labels:
+ app: eventmesh
+spec:
+ replicas: 2
+ selector:
+ matchLabels:
+ app: eventmesh-runtime
+ template:
+ metadata:
+ labels:
+ app: eventmesh-runtime
+ spec:
+ containers:
+ - name: eventmesh-container
+ image: apache/eventmesh-runtime:latest
+ ports:
+ - containerPort: 10000 # HTTP API 端口
+ - containerPort: 10105 # gRPC 端口
+ - containerPort: 10111 # tcp 端口
+ - containerPort: 11111 # admin 端口
+ env:
+ - name: EVENTMESH_STORAGE_TYPE
+ value: "rocketmq" # 指定事件存储类型(如 RocketMQ/Kafka)
+ - name: ROCKETMQ_NAMESRV_ADDR
+ value: "rocketmq-namesrv:9876" # 中间件地址
+ volumeMounts:
+ - name: eventmesh-config
+ mountPath: /eventmesh/conf
+ volumes:
+ - name: eventmesh-config
+ configMap:
+ name: eventmesh-config
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: eventmesh-service
+spec:
+ type: LoadBalancer
+ ports:
+ - name: admin
+ port: 11111
+ targetPort: 11111
+ protocol: TCP
+ - name: TCP
+ port: 10111
+ targetPort: 10111
+ protocol: TCP
+ - name: http
+ port: 10000
+ targetPort: 10000
+ protocol: TCP
+ - name: grpc
+ port: 10105
+ targetPort: 10105
+ protocol: TCP
+ selector:
+ app: eventmesh-runtime
diff --git a/eventmesh-dashboard-console/src/test/resources/kubernetes/EventMesh-runtime.yaml b/eventmesh-dashboard-console/src/test/resources/kubernetes/EventMesh-runtime.yaml
new file mode 100644
index 0000000..67f8bdd
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/resources/kubernetes/EventMesh-runtime.yaml
@@ -0,0 +1,77 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: ${name}
+ namespace: ${namespace}
+ labels:
+ app: eventmesh
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: ${name}
+ template:
+ metadata:
+ labels:
+ app: ${name}
+ spec:
+ containers:
+ - name: eventmesh-container
+ image: apache/eventmesh-runtime:latest
+ ports:
+ - containerPort: 10000 # HTTP API 端口
+ - containerPort: 10105 # gRPC 端口
+ - containerPort: 10111 # tcp 端口
+ - containerPort: 11111 # admin 端口
+ env:
+ - name: EVENTMESH_STORAGE_TYPE
+ value: "rocketmq" # 指定事件存储类型(如 RocketMQ/Kafka)
+ - name: ROCKETMQ_NAMESRV_ADDR
+ value: "rocketmq-namesrv:9876" # 中间件地址
+ - name: CONFIG
+ value: "${runtimeConfig}"
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: ${name}-service
+ namespace: ${namespace}
+spec:
+ type: LoadBalancer
+ ports:
+ - name: admin
+ port: ${adminPort}
+ targetPort: 11111
+ protocol: TCP
+ - name: TCP
+ port: ${tcpPort}
+ targetPort: 10111
+ protocol: TCP
+ - name: http
+ port: ${httpPort}
+ targetPort: 10000
+ protocol: TCP
+ - name: grpc
+ port: ${grpcPort}
+ targetPort: 10105
+ protocol: TCP
+ selector:
+ app: ${name}
diff --git a/eventmesh-dashboard-console/src/test/resources/kubernetes/RocketMQ-broker-refer.yaml b/eventmesh-dashboard-console/src/test/resources/kubernetes/RocketMQ-broker-refer.yaml
new file mode 100644
index 0000000..5826f6f
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/resources/kubernetes/RocketMQ-broker-refer.yaml
@@ -0,0 +1,57 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ labels:
+ app: rocketmq-broker
+ name: rocketmq-broker
+ namespace: default
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: rocketmq-broker
+ template:
+ metadata:
+ labels:
+ app: rocketmq-broker
+ spec:
+ containers:
+ - env:
+ - name: NAMESRV_ADDR #通过环境变量指定namesrv 地址,注意该值为namesrv svc地址
+ value: rocketmq-dialevoneid:9876
+ image: rocketmqinc/rocketmq:4.4.0
+ command: ["/bin/sh","mqbroker"]
+ name: rocketmq-broker
+ ports:
+ - containerPort: 10909
+ name: tcp-10909
+ protocol: TCP
+ - containerPort: 10911
+ name: tcp-10911
+ protocol: TCP
+ - containerPort: 10912
+ name: tcp-10912
+ protocol: TCP
+ resources:
+ limits:
+ memory: 1200Mi
+ requests:
+ memory: 1200Mi
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/test/resources/kubernetes/RocketMQ-broker.yaml b/eventmesh-dashboard-console/src/test/resources/kubernetes/RocketMQ-broker.yaml
new file mode 100644
index 0000000..02ebe9a
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/resources/kubernetes/RocketMQ-broker.yaml
@@ -0,0 +1,56 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ labels:
+ app: rocketmq-broker
+ name: rocketmq-broker
+ namespace: default
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: rocketmq-broker
+ template:
+ metadata:
+ labels:
+ app: rocketmq-broker
+ spec:
+ containers:
+ - env:
+ - name: ${metaAddress} #通过环境变量指定namesrv 地址,注意该值为namesrv svc地址
+ value: rocketmq-dialevoneid:9876
+ image: rocketmqinc/rocketmq:4.4.0
+ command: ["/bin/sh","mqbroker"]
+ name: rocketmq-broker
+ ports:
+ - containerPort: ${prot1}
+ name: tcp-10909
+ protocol: TCP
+ - containerPort: ${prot2}
+ name: tcp-10911
+ protocol: TCP
+ - containerPort: ${prot3}
+ name: tcp-10912
+ protocol: TCP
+ resources:
+ limits:
+ memory: 1200Mi
+ requests:
+ memory: 1200Mi
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/test/resources/kubernetes/RocketMQ-nameservice-refer.yaml b/eventmesh-dashboard-console/src/test/resources/kubernetes/RocketMQ-nameservice-refer.yaml
new file mode 100644
index 0000000..d91fb44
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/resources/kubernetes/RocketMQ-nameservice-refer.yaml
@@ -0,0 +1,47 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ labels:
+ app: rocketmq-namesrv
+ name: rocketmq-namesrv
+ namespace: default
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: rocketmq-namesrv
+ template:
+ metadata:
+ labels:
+ app: rocketmq-namesrv
+ spec:
+ containers:
+ - image: rocketmqinc/rocketmq:4.4.0
+ name: rockermq-namesrv
+ command: ["/bin/sh","mqnamesrv"]
+ ports:
+ - containerPort: 9876
+ name: tcp-9876
+ protocol: TCP
+ resources:
+ limits:
+ memory: 600Mi
+ requests:
+ memory: 600Mi
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/test/resources/kubernetes/RocketMQ-nameservice.yaml b/eventmesh-dashboard-console/src/test/resources/kubernetes/RocketMQ-nameservice.yaml
new file mode 100644
index 0000000..d91fb44
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/resources/kubernetes/RocketMQ-nameservice.yaml
@@ -0,0 +1,47 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ labels:
+ app: rocketmq-namesrv
+ name: rocketmq-namesrv
+ namespace: default
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: rocketmq-namesrv
+ template:
+ metadata:
+ labels:
+ app: rocketmq-namesrv
+ spec:
+ containers:
+ - image: rocketmqinc/rocketmq:4.4.0
+ name: rockermq-namesrv
+ command: ["/bin/sh","mqnamesrv"]
+ ports:
+ - containerPort: 9876
+ name: tcp-9876
+ protocol: TCP
+ resources:
+ limits:
+ memory: 600Mi
+ requests:
+ memory: 600Mi
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/test/resources/meta-test.sql b/eventmesh-dashboard-console/src/test/resources/meta-test.sql
index 580e67b..8b9180a 100644
--- a/eventmesh-dashboard-console/src/test/resources/meta-test.sql
+++ b/eventmesh-dashboard-console/src/test/resources/meta-test.sql
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
DELETE FROM `eventmesh_dashboard_test`.meta WHERE TRUE;
ALTER TABLE `eventmesh_dashboard_test`.meta AUTO_INCREMENT = 1;
diff --git a/eventmesh-dashboard-console/src/test/resources/runtime-test.sql b/eventmesh-dashboard-console/src/test/resources/runtime-test.sql
index 1695124..39095b4 100644
--- a/eventmesh-dashboard-console/src/test/resources/runtime-test.sql
+++ b/eventmesh-dashboard-console/src/test/resources/runtime-test.sql
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
DELETE FROM `eventmesh_dashboard_test`.runtime WHERE TRUE;
ALTER TABLE `eventmesh_dashboard_test`.runtime AUTO_INCREMENT = 1;
diff --git a/eventmesh-dashboard-console/src/test/resources/store-test.sql b/eventmesh-dashboard-console/src/test/resources/store-test.sql
index 1807027..d609859 100644
--- a/eventmesh-dashboard-console/src/test/resources/store-test.sql
+++ b/eventmesh-dashboard-console/src/test/resources/store-test.sql
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
DELETE
FROM `eventmesh_dashboard_test`.store
WHERE TRUE;
diff --git a/eventmesh-dashboard-console/src/test/resources/topic-test.sql b/eventmesh-dashboard-console/src/test/resources/topic-test.sql
index 6db880a..6d6ba97 100644
--- a/eventmesh-dashboard-console/src/test/resources/topic-test.sql
+++ b/eventmesh-dashboard-console/src/test/resources/topic-test.sql
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
DELETE
FROM `eventmesh_dashboard_test`.topic
WHERE TRUE;
diff --git a/eventmesh-dashboard-console/src/test/resources/use-test-schema.sql b/eventmesh-dashboard-console/src/test/resources/use-test-schema.sql
index db0c0a2..8eff34f 100644
--- a/eventmesh-dashboard-console/src/test/resources/use-test-schema.sql
+++ b/eventmesh-dashboard-console/src/test/resources/use-test-schema.sql
@@ -15,4 +15,5 @@
* limitations under the License.
*/
+
USE `eventmesh_dashboard_test`;
diff --git a/eventmesh-dashboard-core/pom.xml b/eventmesh-dashboard-core/pom.xml
index 787e8fb..10dc26c 100644
--- a/eventmesh-dashboard-core/pom.xml
+++ b/eventmesh-dashboard-core/pom.xml
@@ -30,9 +30,10 @@
<version>0.0.1-SNAPSHOT</version>
<name>eventmesh-dashboard-core</name>
<properties>
- <java.version>1.8</java.version>
+ <java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <kubernetes.client.version>7.1.0</kubernetes.client.version>
</properties>
<dependencies>
@@ -107,8 +108,17 @@
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper</artifactId>
+ <version>3.9.3</version>
+ </dependency>
<!-- health check client end -->
-
+ <dependency>
+ <groupId>io.fabric8</groupId>
+ <artifactId>kubernetes-client</artifactId>
+ <version>${kubernetes.client.version}</version>
+ </dependency>
<!-- Unit Test -->
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/BaseDataDO.java
similarity index 71%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/BaseDataDO.java
index 291fe8c..fd7ed4a 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/BaseDataDO.java
@@ -15,19 +15,25 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.connection;
-import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
+package org.apache.eventmesh.dashboard.core.cluster;
+
+import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata;
import java.util.List;
-import lombok.Data;
+public class BaseDataDO<RE, CM> {
-@Data
-public class AddConnectorConfigEntity {
+ /**
+ * RE 资源信息
+ */
+ private Object resource;
- private List<ConfigEntity> sinkConnectorConfigs;
+ /**
+ * CM 配置参数
+ */
+ private List<ConfigMetadata> configMetadata;
- private List<ConfigEntity> sourceConnectorConfigs;
+
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicRequest.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterBaseDO.java
similarity index 64%
rename from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicRequest.java
rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterBaseDO.java
index a9eb328..ca3627d 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicRequest.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterBaseDO.java
@@ -15,27 +15,28 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting.topic;
+package org.apache.eventmesh.dashboard.core.cluster;
-import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.AbstractMultiCreateSDKConfig;
-import com.alibaba.fastjson2.JSONObject;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
-import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
-import lombok.NoArgsConstructor;
@Data
-@NoArgsConstructor
-@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
-public class CreateTopicRequest extends GlobalRequest {
-
- private TopicMetadata topicMetadata;
+public class ClusterBaseDO<C, R extends RuntimeBaseDO, RE, CM> extends BaseDataDO<RE, CM> {
- private JSONObject topicConfig;
+ private C clusterInfo;
+
+ private Map<Long, R> runtimeMap = new ConcurrentHashMap<>();
+
+ private AbstractMultiCreateSDKConfig multiCreateSDKConfig;
+
+
+
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDO.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDO.java
index 20621ae..b62042a 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDO.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDO.java
@@ -15,21 +15,18 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.cluster;
import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata;
-import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
+import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class ClusterDO {
+@EqualsAndHashCode(callSuper = true)
+public class ClusterDO extends ClusterBaseDO<ClusterMetadata, RuntimeDO, Object, ConfigMetadata> {
- private ClusterMetadata clusterInfo;
-
- private Map<Long, RuntimeMetadata> runtimeMap = new ConcurrentHashMap<>();
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDoCache.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDoCache.java
index 61ac242..20bb32e 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDoCache.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDoCache.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.cluster;
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ColonyDO.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ColonyDO.java
index b221869..f56a49e 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ColonyDO.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ColonyDO.java
@@ -15,42 +15,185 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.cluster;
+import org.apache.eventmesh.dashboard.common.enums.ClusterSyncMetadataEnum;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.model.ClusterSyncMetadata;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.AbstractMultiCreateSDKConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.NetAddress;
+
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import lombok.Data;
+import lombok.Getter;
/**
- * eventmesh ClusterDO meta ClusterDO runtime ClusterDO storage ClusterDO meta(注册中心,zk,) ClusterDO runtime(broker) ClusterDO
+ * eventmesh ClusterDO meta ClusterDO runtime ClusterDO storage ClusterDO meta(注册中心,zk,) ClusterDO runtime(broker) ClusterDO 一个集群 eventmesh 集群有
+ * 1.有多个 runtime 集群 2.有多个 存储 集群 3.有多个 meta 集群
+ * <p>
+ * 一个 RocketMQ 集群 1. 有多个 存储群集(这里是 runtime 集群,是内部实例,不是外部实例) 2. 有一个注册中心集群(这里是 meta )
*/
+@SuppressWarnings({"rawtypes", "unchecked"})
@Data
-public class ColonyDO {
+public class ColonyDO<C extends ClusterBaseDO> {
private Long superiorId;
- private ClusterDO clusterDO;
+ //private ColonyDO<C> superiorDO;
+
+ @Getter
+ private Long clusterId;
+
+ private C clusterDO;
// 双活集群 所以是可以是一个list的
// 可以默认一个集群
- private Map<Long, ColonyDO> runtimeColonyDOList = new ConcurrentHashMap<>();
+ private Map<Long, ColonyDO<C>> runtimeColonyDOMap = new ConcurrentHashMap<>();
// 只有 eventmesh 集群有这个点,其他没有。
- private Map<Long, ColonyDO> storageColonyDOList = new ConcurrentHashMap<>();
+ private Map<Long, ColonyDO<C>> storageColonyDOMap = new ConcurrentHashMap<>();
/**
* A(nameserver cluster) a1 a2 a3 B(nameserver cluster) b1 b2 b3
* <p>
* rocketmq a1,a2,a3,b1,b2,b3
*/
- private Map<Long, ColonyDO> metaColonyDOList = new ConcurrentHashMap<>();
+ private Map<Long, ColonyDO<C>> metaColonyDOList = new ConcurrentHashMap<>();
- public Long getClusterId() {
- return Objects.nonNull(this.clusterDO.getClusterInfo().getClusterId()) ? this.clusterDO.getClusterInfo().getClusterId()
- : this.clusterDO.getClusterInfo().getId();
+ private Map<Long, ColonyDO<C>> allColonyDO;
+
+ private Class<?> clusterBaseDOClass;
+
+ private ClusterType clusterType;
+
+ private ClusterSyncMetadata clusterSyncMetadata;
+
+
+ public static <T> T create(Class<?> clusterDO, Object metadata) {
+
+ try {
+ ColonyDO<ClusterBaseDO> colonyDO = new ColonyDO<>();
+ //ClusterBaseDO clusterEntityDO = (ClusterBaseDO) clusterDO.newInstance();
+ //clusterEntityDO.setClusterInfo(metadata);
+ colonyDO.setClusterDO((ClusterBaseDO) metadata);
+ colonyDO.allColonyDO = new ConcurrentHashMap<>();
+ return (T) colonyDO;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ private static <T> T createBaseDO(Class<?> clusterDO, Object metadata) {
+ try {
+ ClusterBaseDO clusterEntityDO = (ClusterBaseDO) clusterDO.newInstance();
+ clusterEntityDO.setClusterInfo(metadata);
+ return (T) clusterEntityDO;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+ public void setClusterType(ClusterType clusterType) {
+ this.clusterType = clusterType;
+ this.clusterSyncMetadata = ClusterSyncMetadataEnum.getClusterSyncMetadata(clusterType);
+ }
+
+
+ public ColonyDO<C> register(Long mainId, Long runtimeId, Object object, NetAddress netAddress) {
+ ColonyDO<C> mainColony = this.allColonyDO.get(mainId);
+ if (Objects.isNull(mainColony)) {
+ return null;
+ }
+ mainColony.getClusterDO().getRuntimeMap().put(runtimeId, object);
+ if (mainColony.getClusterSyncMetadata().getClusterFramework().isCAP()) {
+ AbstractMultiCreateSDKConfig abstractMultiCreateSDKConfig = mainColony.getClusterDO().getMultiCreateSDKConfig();
+ if (mainColony.getClusterType().isMeta()) {
+ abstractMultiCreateSDKConfig.addMetaAddress(netAddress);
+ } else {
+ abstractMultiCreateSDKConfig.addNetAddress(netAddress);
+ }
+ }
+ return mainColony;
+ }
+
+ public ColonyDO<C> register(Long clusterId, ClusterType clusterType, Object object) {
+ ColonyDO<C> current = this.allColonyDO.get(clusterId);
+ if (Objects.isNull(current)) {
+ ColonyDO<C> colonyDO = create(this.clusterBaseDOClass, object);
+ colonyDO.setClusterId(clusterId);
+ colonyDO.setClusterType(clusterType);
+ colonyDO.setClusterSyncMetadata(ClusterSyncMetadataEnum.getClusterSyncMetadata(clusterType));
+ this.allColonyDO.put(clusterId, colonyDO);
+ current = colonyDO;
+ } else {
+ current.setClusterDO((C) object);
+ }
+ return current;
+ }
+
+ public void relationship(Long mainId, Long clusterId) {
+ ColonyDO<C> mainColony = this.allColonyDO.get(mainId);
+
+ ColonyDO<C> colonyDO = this.allColonyDO.get(clusterId);
+ colonyDO.setSuperiorId(mainId);
+ //colonyDO.setSuperiorDO(mainColony);
+
+ mainColony.relationship(colonyDO.getClusterType(), clusterId, colonyDO);
+ }
+
+ private void relationship(ClusterType clusterType, Long clusterId, ColonyDO<C> colonyDO) {
+ Map<Long, ColonyDO<C>> colonyDOMap = this.getColonyDOMap(clusterType);
+ colonyDOMap.put(clusterId, colonyDO);
+ }
+
+ public void unRelationship(Long mainId, Long clusterId) {
+ ColonyDO<C> mainColony = this.allColonyDO.get(mainId);
+ ColonyDO<C> colonyDO = this.allColonyDO.get(clusterId);
+ mainColony.remove(colonyDO.getClusterType(), clusterId);
+ }
+
+
+ public ColonyDO<C> removeRuntime(Long clusterId, Long runtimeId, NetAddress netAddress) {
+ ColonyDO<C> mainColony = this.allColonyDO.get(clusterId);
+ if (Objects.isNull(mainColony)) {
+ return null;
+ }
+ mainColony.getClusterDO().getRuntimeMap().remove(runtimeId);
+ if (mainColony.getClusterSyncMetadata().getClusterFramework().isCAP()) {
+ AbstractMultiCreateSDKConfig abstractMultiCreateSDKConfig = mainColony.getClusterDO().getMultiCreateSDKConfig();
+ if (mainColony.getClusterType().isMeta()) {
+ abstractMultiCreateSDKConfig.removeMetaAddress(netAddress);
+ } else {
+ abstractMultiCreateSDKConfig.removeNetAddress(netAddress);
+ }
+ }
+ return mainColony;
+ }
+
+ public ColonyDO<C> remove(Long clusterId) {
+ return this.allColonyDO.remove(clusterId);
+ }
+
+ public void remove(ClusterType clusterType, Long clusterId) {
+ Map<Long, ColonyDO<C>> colonyDOMap = this.getColonyDOMap(clusterType);
+ colonyDOMap.remove(clusterId);
+ }
+
+
+ public Map<Long, ColonyDO<C>> getColonyDOMap(ClusterType clusterType) {
+ if (Objects.equals(this.clusterType, ClusterType.EVENTMESH_CLUSTER)) {
+ return clusterType.isStorage() ? this.storageColonyDOMap
+ : clusterType.isMeta() ? this.metaColonyDOList : this.runtimeColonyDOMap;
+ }
+ return clusterType.isMeta() ? this.metaColonyDOList : this.runtimeColonyDOMap;
+
}
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/MetadataBaseDO.java
similarity index 72%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/MetadataBaseDO.java
index bf167b1..a4650f3 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/MetadataBaseDO.java
@@ -15,16 +15,18 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+
+package org.apache.eventmesh.dashboard.core.cluster;
+
+import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+
@Data
-public class ChangeConfigEntity {
+@EqualsAndHashCode(callSuper = true)
+public class MetadataBaseDO<C, R extends RuntimeBaseDO> extends ClusterBaseDO<C, R, Object, ConfigMetadata> {
- private String configName;
- private String configValue;
-
- private Integer alreadyUpdate;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/RuntimeBaseDO.java
similarity index 65%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/RuntimeBaseDO.java
index 344d02d..ece5877 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/RuntimeBaseDO.java
@@ -15,28 +15,26 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.message;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+package org.apache.eventmesh.dashboard.core.cluster;
+
+
+import org.apache.eventmesh.dashboard.common.model.ClusterSyncMetadata;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.AbstractCreateSDKConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
-@EqualsAndHashCode(callSuper = true, exclude = "status")
-public class GroupMemberEntity extends BaseEntity {
+@EqualsAndHashCode(callSuper = true)
+public class RuntimeBaseDO<R, RE, CM> extends BaseDataDO<RE, CM> {
- private Long id;
+ private R runtimeMetadata;
- private Long clusterId;
+ private AbstractCreateSDKConfig createSDKConfig;
- private String topicName;
- private String groupName;
+ private ClusterSyncMetadata clusterSyncMetadata;
- private String eventMeshUser;
- private String state;
-
- private Integer status;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/RuntimeDO.java
similarity index 69%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/RuntimeDO.java
index 6dafeef..dc4c28c 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/RuntimeDO.java
@@ -15,20 +15,20 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+package org.apache.eventmesh.dashboard.core.cluster;
+
+import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+
@Data
-public class UpdateConfigsLog {
+@EqualsAndHashCode(callSuper = true)
+public class RuntimeDO extends RuntimeBaseDO<RuntimeMetadata, Object, ConfigMetadata> {
- private Long instanceId;
- private Long clusterId;
-
- private String name;
-
- private String configProperties;
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/config/AdminProperties.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/config/AdminProperties.java
deleted file mode 100644
index 66f1420..0000000
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/config/AdminProperties.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.config;
-
-import org.apache.eventmesh.dashboard.common.constant.ConfigConst;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-import lombok.Data;
-
-/**
- * TODO get configs from DB (console module's work)
- */
-
-@Deprecated
-@Data
-@Component
-@ConfigurationProperties(prefix = ConfigConst.ADMIN_PROPS_PREFIX)
-public class AdminProperties {
-
- private MetaProperties meta = new MetaProperties();
- private StoreProperties store = new StoreProperties();
-
- @Data
- public static class MetaProperties {
-
- private String type = ConfigConst.META_TYPE_NACOS;
- private NacosProperties nacos = new NacosProperties();
- private EtcdProperties etcd = new EtcdProperties();
- private int timeoutMs = 5000;
-
- @Data
- public static class NacosProperties {
-
- private String addr = "127.0.0.1:8848";
- private String namespace = "";
- private boolean authEnabled = false;
- private String protocol = "http";
- private String username;
- private String password;
- private String accessKey;
- private String secretKey;
- }
-
- @Data
- public static class EtcdProperties {
-
- private String addr;
- }
- }
-
- @Data
- public static class StoreProperties {
-
- private String type = ConfigConst.STORE_TYPE_ROCKETMQ; // TODO should be standalone
- private RocketMQProperties rocketmq = new RocketMQProperties();
- private KafkaProperties kafka = new KafkaProperties();
-
- @Data
- public static class RocketMQProperties {
-
- private String namesrvAddr;
- private String clusterName = "";
- private String accessKey = "";
- private String secretKey = "";
- }
-
- @Data
- public static class KafkaProperties {
-
- private String namesrvAddr;
- private int partitions = 1;
- private int replicationFactors = 1;
- }
- }
-}
\ No newline at end of file
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/AbstractClientInfo.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/AbstractClientInfo.java
new file mode 100644
index 0000000..0a90675
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/AbstractClientInfo.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.function.SDK;
+
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
+
+import java.util.Objects;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Executor;
+
+import lombok.Setter;
+
+public abstract class AbstractClientInfo<T> {
+
+ @Setter
+ private ClientWrapper clientWrapper;
+
+ @Setter
+ private Executor executor;
+
+ public T getClient() {
+ return (T) this.clientWrapper.getClientMap().get(this.getSDKTypeEnum());
+ }
+
+ protected CompletableFuture<Void> completableFuture(Runnable runnable) {
+ return Objects.nonNull(this.executor) ? CompletableFuture.runAsync(runnable, executor) : CompletableFuture.runAsync(runnable);
+ }
+
+ public CreateSDKConfig getCreateSDKConfig() {
+ return this.getCreateSDKConfig();
+ }
+
+ public BaseSyncBase getBaseSyncBase() {
+ return this.getBaseSyncBase();
+ }
+
+
+ protected abstract SDKTypeEnum getSDKTypeEnum();
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/AbstractSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/AbstractSDKOperation.java
index d9ad2a7..f266323 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/AbstractSDKOperation.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/AbstractSDKOperation.java
@@ -15,15 +15,18 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK;
-public abstract class AbstractSDKOperation<T> implements SDKOperation<T> {
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
- protected T castClient(Object client) {
- try {
- return (T) client;
- } catch (ClassCastException e) {
- throw new IllegalArgumentException("Client is not of the expected type", e);
- }
+
+public abstract class AbstractSDKOperation<T, C extends CreateSDKConfig> extends AbstractClientInfo<T> implements SDKOperation<T, C> {
+
+
+ public SDKTypeEnum getSDKTypeEnum() {
+ return SDKTypeEnum.PING;
}
+
+
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingServiceRuntimeConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/ClientWrapper.java
similarity index 72%
rename from eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingServiceRuntimeConfig.java
rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/ClientWrapper.java
index 2b76a70..6552f63 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingServiceRuntimeConfig.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/ClientWrapper.java
@@ -15,10 +15,11 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.core.remoting;
+package org.apache.eventmesh.dashboard.core.function.SDK;
+
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
-import org.apache.eventmesh.dashboard.service.remoting.RemotingServiceType;
import java.util.HashMap;
import java.util.Map;
@@ -26,12 +27,13 @@
import lombok.Data;
@Data
-public class RemotingServiceRuntimeConfig {
+public class ClientWrapper {
+
+ private Map<SDKTypeEnum, Object> clientMap = new HashMap<>();
+
+ private CreateSDKConfig config;
+
+ private BaseSyncBase baseSyncBase;
- private CreateSDKConfig runtimeConfig;
-
- private CreateSDKConfig storageConfig;
-
- private Map<RemotingServiceType, String> remotingServiceTypeStringMap = new HashMap<>();
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/ConfigManage.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/ConfigManage.java
new file mode 100644
index 0000000..b8a7400
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/ConfigManage.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.function.SDK;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.AbstractCreateSDKConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.AbstractMultiCreateSDKConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.AbstractSimpleCreateSDKConfig;
+
+public class ConfigManage {
+
+ private static final ConfigManage configManage = new ConfigManage();
+
+ public static ConfigManage getInstance() {
+ return configManage;
+ }
+
+ private ConfigManage() {
+ }
+
+
+ public AbstractMultiCreateSDKConfig getMultiCreateSDKConfig(ClusterType clusterType, SDKTypeEnum sdkTypeEnum) {
+ return (AbstractMultiCreateSDKConfig) getCreateSDKConfig(clusterType, sdkTypeEnum);
+ }
+
+ public AbstractSimpleCreateSDKConfig getSimpleCreateSDKConfig(ClusterType clusterType, SDKTypeEnum sdkTypeEnum) {
+ return (AbstractSimpleCreateSDKConfig) getCreateSDKConfig(clusterType, sdkTypeEnum);
+ }
+
+ private AbstractCreateSDKConfig getCreateSDKConfig(ClusterType clusterType, SDKTypeEnum sdkTypeEnum) {
+
+ try {
+ Class<?> clazz = SDKManage.getInstance().getConfig(clusterType, sdkTypeEnum);
+ return (AbstractCreateSDKConfig) clazz.newInstance();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/ProtocolType.java
similarity index 84%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/ProtocolType.java
index 82e6c7f..e10c5ac 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/ProtocolType.java
@@ -15,12 +15,18 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.core.function.SDK;
-@Data
-public class GlobalRequest {
+public enum ProtocolType {
- private Long clusterId;
+ HTTP,
+
+ GRPC,
+
+ TPC,
+
+ PRIVATE,
+
+ ;
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManage.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManage.java
new file mode 100644
index 0000000..c15b37d
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManage.java
@@ -0,0 +1,224 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.function.SDK;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterSyncMetadataEnum;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
+import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
+import org.apache.eventmesh.dashboard.common.util.ClasspathScanner;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.AbstractCreateSDKConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
+
+import org.apache.commons.lang3.ArrayUtils;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+
+/**
+ * SDK manager is a singleton to manage all SDK clients, it is a facade to create, delete and get a client.
+ */
+public class SDKManage {
+
+ /**
+ * inner key is the unique key of a client, such as (ip + port) they are defined in CreateClientConfig
+ * <p>
+ * key: SDKTypeEnum value: A map collection is used with key being (ip+port) and value being client.
+ *
+ * @see CreateSDKConfig#getUniqueKey()
+ */
+ private final Map<String, ClientWrapper> clientMap = new ConcurrentHashMap<>();
+ /**
+ * Initialise the SDKOperation object instance according to SDKTypeEnum.
+ * <p>
+ * key: SDKTypeEnum value: SDKOperation
+ *
+ * @see SDKTypeEnum
+ * @see SDKOperation
+ */
+ private static final Map<ClusterType, Map<SDKTypeEnum, SDKMetadataWrapper>> CLUSTER_TYPE_MAP_CONCURRENT_HASH_MAP =
+ new ConcurrentHashMap<>();
+
+ private static final SDKManage INSTANCE = new SDKManage();
+
+
+ // register all client create operation
+ static {
+ Set<Class<?>> interfaceSet = new HashSet<>();
+ interfaceSet.add(SDKOperation.class);
+ ClasspathScanner classpathScanner =
+ ClasspathScanner.builder().base(SDKManage.class).subPath("/operation/**").interfaceSet(interfaceSet).build();
+ try {
+ List<Class<?>> classList = classpathScanner.getClazz();
+ classList.forEach(SDKManage::createSDKMetadataWrapper);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ static void createSDKMetadataWrapper(Class<?> clazz) {
+ SDKMetadata[] sdkMetadataArray = clazz.getAnnotationsByType(SDKMetadata.class);
+ if (ArrayUtils.isEmpty(sdkMetadataArray)) {
+ return;
+ }
+
+ try {
+ SDKMetadata sdkMetadata = sdkMetadataArray[0];
+ Class<?> multi = getCreateSDKConfigClass(clazz);
+ for (ClusterType clusterType : sdkMetadata.clusterType()) {
+ Map<SDKTypeEnum, SDKMetadataWrapper> map =
+ CLUSTER_TYPE_MAP_CONCURRENT_HASH_MAP.computeIfAbsent(clusterType, k -> new ConcurrentHashMap<>());
+ SDKTypeEnum[] sdkTypeEnums = sdkMetadata.sdkTypeEnum();
+ if (Objects.equals(sdkTypeEnums[0], SDKTypeEnum.ALL)) {
+ sdkTypeEnums = new SDKTypeEnum[] {SDKTypeEnum.ADMIN, SDKTypeEnum.PING, SDKTypeEnum.PRODUCER, SDKTypeEnum.CONSUMER};
+ }
+ for (SDKTypeEnum sdkTypeEnum : sdkTypeEnums) {
+ SDKMetadataWrapper sdkMetadataWrapper = new SDKMetadataWrapper();
+ sdkMetadataWrapper.sdkMetadata = sdkMetadata;
+ sdkMetadataWrapper.createSDKConfigClass = multi;
+ sdkMetadataWrapper.abstractSDKOperation = (AbstractSDKOperation<Object, CreateSDKConfig>) clazz.newInstance();
+ map.put(sdkTypeEnum, sdkMetadataWrapper);
+ }
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static Class<?> getCreateSDKConfigClass(Class<?> genericClass) {
+ Type supercType = genericClass.getGenericSuperclass();
+ if (supercType instanceof ParameterizedType type) {
+ Type[] typeArguments = type.getActualTypeArguments();
+ for (Type typeArgument : typeArguments) {
+ Class<?> argument;
+ if (typeArgument instanceof ParameterizedType parameterizedType) {
+ argument = (Class<?>) parameterizedType.getRawType();
+ } else {
+ argument = (Class<?>) typeArgument;
+ }
+ for (; ; ) {
+ Class<?> superclass = argument.getSuperclass();
+ if (Objects.isNull(superclass)) {
+ break;
+ }
+ if (Objects.equals(superclass, AbstractCreateSDKConfig.class)) {
+ if (typeArgument instanceof Class<?>) {
+ return (Class<?>) typeArgument;
+ }
+ }
+ argument = superclass;
+ }
+ }
+ }
+ return null;
+ }
+
+ private SDKManage() {
+ }
+
+ public static synchronized SDKManage getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Create SDK client through (SDKTypeEnum) clientTypeEnum, (CreateSDKConfig) config.
+ */
+ public <T> T createClient(SDKTypeEnum sdkTypeEnum, BaseSyncBase baseSyncBase, CreateSDKConfig config, ClusterType clusterType) {
+
+ try {
+
+ SDKMetadataWrapper sdkMetadataWrapper = CLUSTER_TYPE_MAP_CONCURRENT_HASH_MAP.get(clusterType).get(sdkTypeEnum);
+
+ Object object = sdkMetadataWrapper.abstractSDKOperation.createClient(config);
+ if (Objects.equals(sdkTypeEnum, SDKTypeEnum.PRODUCER) || Objects.equals(sdkTypeEnum, SDKTypeEnum.CONSUMER)) {
+ return (T) object;
+ }
+
+ ClientWrapper wrapper = new ClientWrapper();
+ wrapper.setConfig(config);
+ wrapper.setBaseSyncBase(baseSyncBase);
+
+ wrapper.getClientMap().put(SDKTypeEnum.ADMIN, object);
+ // all 模式下应该共享一个对象。这里需要优化
+ if (Objects.equals(SDKTypeEnum.ADMIN, sdkTypeEnum)) {
+ object = sdkMetadataWrapper.abstractSDKOperation.createClient(config);
+ wrapper.getClientMap().put(SDKTypeEnum.PING, object);
+ }
+ final String uniqueKey = baseSyncBase.getUnique();
+ clientMap.put(uniqueKey, wrapper);
+ return (T) object;
+ } catch (Exception e) {
+ throw new RuntimeException("create client error", e);
+ }
+ }
+
+
+ public void deleteClient(SDKTypeEnum sdkTypeEnum, String uniqueKey) {
+ if (Objects.isNull(sdkTypeEnum)) {
+ this.clientMap.remove(uniqueKey);
+ } else {
+ this.clientMap.get(uniqueKey).getClientMap().put(sdkTypeEnum, null);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getClient(SDKTypeEnum clientTypeEnum, String uniqueKey) {
+ return (T) clientMap.get(uniqueKey).getClientMap().get(clientTypeEnum);
+ }
+
+ public ClientWrapper getClientWrapper(String uniqueKey) {
+ return clientMap.get(uniqueKey);
+ }
+
+ public <T> T createAbstractClientInfo(Class<?> clazz, BaseSyncBase baseSyncBase) {
+ try {
+ String unique = baseSyncBase.getUnique();
+ if (!baseSyncBase.isCluster() && ClusterSyncMetadataEnum.getClusterFramework(baseSyncBase.getClusterType()).isCAP()) {
+ unique = ((RuntimeMetadata) baseSyncBase).clusterUnique();
+ }
+ AbstractClientInfo<Object> abstractClientInfo = (AbstractClientInfo<Object>) clazz.newInstance();
+ abstractClientInfo.setClientWrapper(clientMap.get(unique));
+ return (T) abstractClientInfo;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Class<?> getConfig(ClusterType clusterType, SDKTypeEnum sdkTypeEnum) {
+ return CLUSTER_TYPE_MAP_CONCURRENT_HASH_MAP.get(clusterType).get(sdkTypeEnum).createSDKConfigClass;
+ }
+
+
+ static class SDKMetadataWrapper {
+
+ private SDKMetadata sdkMetadata;
+
+ private Class<?> createSDKConfigClass;
+
+ private AbstractSDKOperation<Object, CreateSDKConfig> abstractSDKOperation;
+
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManager.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManager.java
deleted file mode 100644
index 823af69..0000000
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManager.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.function.SDK;
-
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.EtcdSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.NacosConfigSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.NacosNamingSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.NacosSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.RedisSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq.RocketMQAdminOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq.RocketMQProduceSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq.RocketMQPushConsumerSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq.RocketMQRemotingSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeGrpcConsumerSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeGrpcProducerSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeHttpConsumerSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeHttpProducerSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeTcpCloudEventSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeTcpEventMeshSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeTcpOpenMessageSDKOperation;
-
-import java.util.AbstractMap.SimpleEntry;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.ConcurrentHashMap;
-
-
-/**
- * SDK manager is a singleton to manage all SDK clients, it is a facade to create, delete and get a client.
- */
-public class SDKManager {
-
- /**
- * inner key is the unique key of a client, such as (ip + port) they are defined in CreateClientConfig
- * <p>
- * key: SDKTypeEnum value: A map collection is used with key being (ip+port) and value being client.
- *
- * @see CreateSDKConfig#getUniqueKey()
- */
- private static final Map<SDKTypeEnum, Map<String, Object>> clientMap = new ConcurrentHashMap<>();
- /**
- * Initialise the SDKOperation object instance according to SDKTypeEnum.
- * <p>
- * key: SDKTypeEnum value: SDKOperation
- *
- * @see SDKTypeEnum
- * @see SDKOperation
- */
- private static final Map<SDKTypeEnum, SDKOperation<?>> clientCreateOperationMap = new ConcurrentHashMap<>();
- private static volatile SDKManager INSTANCE = null;
-
- // register all client create operation
- static {
- for (SDKTypeEnum clientTypeEnum : SDKTypeEnum.values()) {
- clientMap.put(clientTypeEnum, new ConcurrentHashMap<>());
- }
- // redis
- clientCreateOperationMap.put(SDKTypeEnum.STORAGE_REDIS, new RedisSDKOperation());
-
- // rocketmq
- clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, new RocketMQRemotingSDKOperation());
- clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_PRODUCER, new RocketMQProduceSDKOperation());
- clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_CONSUMER, new RocketMQPushConsumerSDKOperation());
- clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_ADMIN, new RocketMQAdminOperation());
-
- // nacos
- clientCreateOperationMap.put(SDKTypeEnum.META_NACOS, new NacosSDKOperation());
- clientCreateOperationMap.put(SDKTypeEnum.META_NACOS_CONFIG, new NacosConfigSDKOperation());
- clientCreateOperationMap.put(SDKTypeEnum.META_NACOS_NAMING, new NacosNamingSDKOperation());
-
- // etcd
- clientCreateOperationMap.put(SDKTypeEnum.META_ETCD, new EtcdSDKOperation());
-
- // eventmesh_runtime
- clientCreateOperationMap.put(SDKTypeEnum.RUNTIME_EVENTMESH_CLIENT, new RuntimeSDKOperation());
-
- // eventmesh_runtime_tcp
- clientCreateOperationMap.put(SDKTypeEnum.RUNTIME_TCP_CLOUDEVENT_CLIENT, new RuntimeTcpCloudEventSDKOperation());
- clientCreateOperationMap.put(SDKTypeEnum.RUNTIME_TCP_EVENTMESH_CLIENT, new RuntimeTcpEventMeshSDKOperation());
- clientCreateOperationMap.put(SDKTypeEnum.RUNTIME_TCP_OPENMESSAGE_CLIENT, new RuntimeTcpOpenMessageSDKOperation());
-
- // eventmesh_runtime_http
- clientCreateOperationMap.put(SDKTypeEnum.RUNTIME_HTTP_PRODUCER, new RuntimeHttpProducerSDKOperation());
- clientCreateOperationMap.put(SDKTypeEnum.RUNTIME_HTTP_CONSUMER, new RuntimeHttpConsumerSDKOperation());
-
- // eventmesh_runtime_grpc
- clientCreateOperationMap.put(SDKTypeEnum.RUNTIME_GRPC_PRODUCER, new RuntimeGrpcProducerSDKOperation());
- clientCreateOperationMap.put(SDKTypeEnum.RUNTIME_GRPC_CONSUMER, new RuntimeGrpcConsumerSDKOperation());
- }
-
- private SDKManager() {
- }
-
- public static synchronized SDKManager getInstance() {
- if (INSTANCE == null) {
- synchronized (SDKManager.class) {
- if (INSTANCE == null) {
- INSTANCE = new SDKManager();
- }
- }
- }
- return INSTANCE;
- }
-
- /**
- * Create SDK client through (SDKTypeEnum) clientTypeEnum, (CreateSDKConfig) config.
- */
- public <T> SimpleEntry<String, T> createClient(SDKTypeEnum clientTypeEnum, CreateSDKConfig config) {
-
- final String uniqueKey = config.getUniqueKey();
-
- Map<String, Object> clients = clientMap.get(clientTypeEnum);
-
- Object client = clients.get(uniqueKey);
- SimpleEntry<String, ?> result = new SimpleEntry<>(uniqueKey, client);
- if (Objects.isNull(client)) {
- SDKOperation<?> clientCreateOperation = clientCreateOperationMap.get(clientTypeEnum);
- result = clientCreateOperation.createClient(config);
- clients.put(result.getKey(), result.getValue());
- }
- try {
- return (SimpleEntry<String, T>) result;
- } catch (Exception e) {
- throw new RuntimeException("create client error", e);
- }
- }
-
- public void deleteClient(SDKTypeEnum clientTypeEnum, String uniqueKey) {
- Map<String, Object> clients = clientMap.get(clientTypeEnum);
- SDKOperation<?> operation = clientCreateOperationMap.get(clientTypeEnum);
- try {
- operation.close(clients.get(uniqueKey));
- } catch (Exception e) {
- throw new RuntimeException("close client error", e);
- }
- clients.remove(uniqueKey);
- }
-
- public Object getClient(SDKTypeEnum clientTypeEnum, String uniqueKey) {
- return clientMap.get(clientTypeEnum).get(uniqueKey);
- }
-
- // get all client
- public Map<String, Object> getClients(SDKTypeEnum clientTypeEnum) {
- return clientMap.get(clientTypeEnum);
- }
-}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKMetadata.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKMetadata.java
new file mode 100644
index 0000000..73a1c40
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKMetadata.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.function.SDK;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.RemotingType;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.NullCreateSDKConfig;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ *
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface SDKMetadata {
+
+ ClusterType[] clusterType();
+
+
+ RemotingType remotingType();
+
+
+ SDKTypeEnum[] sdkTypeEnum();
+
+ Class<?> config() default NullCreateSDKConfig.class;
+
+ /**
+ * @return
+ */
+ ProtocolType protocol() default ProtocolType.PRIVATE;
+
+ /**
+ * value is {@link ClusterType.RUNTIME } or {@link ClusterType.CLUSTER }
+ *
+ * @return
+ */
+ ClusterType dimension() default ClusterType.RUNTIME;
+
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKOperation.java
index fd4f4cf..034421c 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKOperation.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKOperation.java
@@ -15,22 +15,21 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK;
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
-import java.util.AbstractMap.SimpleEntry;
-
/**
* Operation to create and close a client, the operations will be store in the SDKManager
*
* @param <T> SDK client
*/
-public interface SDKOperation<T> {
+public interface SDKOperation<T, C extends CreateSDKConfig> {
- SimpleEntry<String, T> createClient(CreateSDKConfig clientConfig);
+ T createClient(C clientConfig) throws Exception;
- void close(Object client);
+ void close(T client) throws Exception;
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKTypeEnum.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKTypeEnum.java
index 4950eb1..b69fe04 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKTypeEnum.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKTypeEnum.java
@@ -15,38 +15,31 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK;
+/**
+ * TODO
+ * META 与 RUNTIME 有相同操作,如何确定.
+ * 同时多协议,如何处理。
+ * TPC的优先级最高,那如何确定端口。
+ * <p>
+ * TODO 关于订阅与发布
+ * 消费组 与 生产组 的 group name 是否随机
+ * RocketMQ 的 namespace 如何处理
+ * PRODUCER,CONSUMER,操作完之后,是否要删除 生产与消费相关信息
+ */
public enum SDKTypeEnum {
- RUNTIME,
+ ALL,
- STORAGE_ROCKETMQ_REMOTING,
+ PING,
- STORAGE_ROCKETMQ_ADMIN,
+ ADMIN,
- STORAGE_ROCKETMQ_PRODUCER,
+ PRODUCER,
- STORAGE_ROCKETMQ_CONSUMER,
+ CONSUMER,
- STORAGE_REDIS,
-
- META_NACOS,
- META_NACOS_CONFIG,
-
- META_NACOS_NAMING,
-
- META_ETCD,
-
- RUNTIME_EVENTMESH_CLIENT,
-
- RUNTIME_TCP_CLOUDEVENT_CLIENT,
- RUNTIME_TCP_EVENTMESH_CLIENT,
- RUNTIME_TCP_OPENMESSAGE_CLIENT,
-
- RUNTIME_HTTP_PRODUCER,
- RUNTIME_HTTP_CONSUMER,
-
- RUNTIME_GRPC_PRODUCER,
- RUNTIME_GRPC_CONSUMER,
+ ;
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/AbstractCreateSDKConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/AbstractCreateSDKConfig.java
new file mode 100644
index 0000000..c068269
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/AbstractCreateSDKConfig.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.function.SDK.config;
+
+
+import lombok.Data;
+
+@Data
+public abstract class AbstractCreateSDKConfig implements CreateSDKConfig {
+
+
+ /**
+ * true is key
+ * <p>
+ * false if address + ":" + port
+ */
+ private boolean keyMode = true;
+
+ /**
+ * cluster id or runtime id
+ */
+ private String key;
+
+ private String namespace;
+
+ private String username;
+
+ private String password;
+
+ private String accessKey;
+
+ private String secretKey;
+
+ private String config;
+
+
+ protected abstract String uniqueKey();
+
+ public String getUniqueKey() {
+ return this.keyMode ? this.uniqueKey() + this.key : this.doUniqueKey();
+ }
+
+ abstract String doUniqueKey();
+
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/AbstractMultiCreateSDKConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/AbstractMultiCreateSDKConfig.java
new file mode 100644
index 0000000..5c0c619
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/AbstractMultiCreateSDKConfig.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.function.SDK.config;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+public class AbstractMultiCreateSDKConfig extends AbstractCreateSDKConfig {
+
+
+ private List<NetAddress> netAddresseList = new CopyOnWriteArrayList<>();
+
+ /**
+ * TODO
+ * TODO
+ * TODO 有意义?
+ * 设定次字段的时候,是为了解决 kafka 老版本操作的时候是 需要操作zk。 目前还没解决这个问题
+ */
+ private List<NetAddress> metaAddressList = new CopyOnWriteArrayList<>();
+
+
+ public boolean isNullAddress() {
+ return netAddresseList.isEmpty();
+ }
+
+ public void addNetAddress(NetAddress netAddress) {
+ this.netAddresseList.add(netAddress);
+ }
+
+ public void removeNetAddress(NetAddress netAddress) {
+ this.netAddresseList.remove(netAddress);
+ }
+
+ public void addMetaAddress(NetAddress netAddress) {
+ this.metaAddressList.add(netAddress);
+ }
+
+ public void removeMetaAddress(NetAddress netAddress) {
+ this.metaAddressList.remove(netAddress);
+ }
+
+
+ @Override
+ public String doUniqueKey() {
+ return this.doUniqueKey(this.netAddresseList);
+ }
+
+ private String doUniqueKey(List<NetAddress> netAddresseList) {
+ StringBuffer sb = new StringBuffer();
+ netAddresseList.forEach(netAddress -> {
+ sb.append(netAddress.doUniqueKey());
+ sb.append(";");
+ });
+ return sb.toString();
+ }
+
+ @Override
+ protected String uniqueKey() {
+ return "m_";
+ }
+
+
+ public String doUniqueKeyByMeta() {
+ return this.doUniqueKey(this.metaAddressList);
+ }
+
+
+ public String[] getNetAddressesByMeta() {
+ return this.getNetAddresses(this.metaAddressList);
+ }
+
+ public String[] getNetAddresses() {
+ return this.getNetAddresses(this.netAddresseList);
+ }
+
+ private String[] getNetAddresses(List<NetAddress> netAddresseList) {
+ List<String> netAddresses = new ArrayList<>();
+ netAddresseList.forEach(netAddress -> {
+ netAddresses.add(netAddress.doUniqueKey());
+ });
+ return netAddresses.toArray(new String[netAddresses.size()]);
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/AbstractSimpleCreateSDKConfig.java
similarity index 66%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/AbstractSimpleCreateSDKConfig.java
index bf167b1..27092d2 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/AbstractSimpleCreateSDKConfig.java
@@ -15,16 +15,26 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+
+package org.apache.eventmesh.dashboard.core.function.SDK.config;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class ChangeConfigEntity {
+@EqualsAndHashCode(callSuper = true)
+public class AbstractSimpleCreateSDKConfig extends AbstractCreateSDKConfig {
- private String configName;
- private String configValue;
+ private NetAddress netAddress;
- private Integer alreadyUpdate;
+
+ @Override
+ protected String uniqueKey() {
+ return "s_";
+ }
+
+ public String doUniqueKey() {
+ return netAddress.doUniqueKey();
+ }
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateEtcdConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateEtcdConfig.java
index 2f116e0..a90010a 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateEtcdConfig.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateEtcdConfig.java
@@ -15,26 +15,16 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.config;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
import lombok.Data;
-import lombok.NoArgsConstructor;
+import lombok.EqualsAndHashCode;
@Data
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
-public class CreateEtcdConfig implements CreateSDKConfig {
+@EqualsAndHashCode(callSuper = true)
+public class CreateEtcdConfig extends AbstractMultiCreateSDKConfig {
- private String etcdServerAddress;
-
- @Builder.Default()
private int connectTime = 10;
- @Override
- public String getUniqueKey() {
- return etcdServerAddress;
- }
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateJvmCapConfig.java
similarity index 84%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateJvmCapConfig.java
index 82e6c7f..446996a 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateJvmCapConfig.java
@@ -15,12 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.core.function.SDK.config;
-@Data
-public class GlobalRequest {
+public class CreateJvmCapConfig extends AbstractMultiCreateSDKConfig {
- private Long clusterId;
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingOperate.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateJvmConfig.java
similarity index 85%
rename from eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingOperate.java
rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateJvmConfig.java
index 24cf7f8..30a9363 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingOperate.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateJvmConfig.java
@@ -15,13 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.service.remoting;
-public enum RemotingOperate {
+package org.apache.eventmesh.dashboard.core.function.SDK.config;
- ADD,
+public class CreateJvmConfig extends AbstractSimpleCreateSDKConfig {
- UPDATE,
-
- DELETE;
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateKafkaZkConfig.java
similarity index 84%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateKafkaZkConfig.java
index 82e6c7f..32f85a1 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateKafkaZkConfig.java
@@ -15,12 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.core.function.SDK.config;
-@Data
-public class GlobalRequest {
+public class CreateKafkaZkConfig extends AbstractMultiCreateSDKConfig {
- private Long clusterId;
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateKakfaConfig.java
similarity index 85%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateKakfaConfig.java
index 82e6c7f..ca309a7 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateKakfaConfig.java
@@ -15,12 +15,13 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
+
+package org.apache.eventmesh.dashboard.core.function.SDK.config;
+
import lombok.Data;
@Data
-public class GlobalRequest {
+public class CreateKakfaConfig extends AbstractMultiCreateSDKConfig{
- private Long clusterId;
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateKubernetesConfig.java
similarity index 84%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateKubernetesConfig.java
index 82e6c7f..a60f12c 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateKubernetesConfig.java
@@ -15,12 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.core.function.SDK.config;
-@Data
-public class GlobalRequest {
+public class CreateKubernetesConfig extends AbstractSimpleCreateSDKConfig{
- private Long clusterId;
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateNacosConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateNacosConfig.java
index 7d7effa..7c64014 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateNacosConfig.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateNacosConfig.java
@@ -15,35 +15,18 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.config;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
import lombok.Data;
-import lombok.NoArgsConstructor;
+import lombok.EqualsAndHashCode;
@Data
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
-public class CreateNacosConfig implements CreateSDKConfig {
-
- private String serverAddress = "127.0.0.1:8848";
-
- private String namespace = "";
+@EqualsAndHashCode(callSuper = true)
+public class CreateNacosConfig extends AbstractSimpleCreateSDKConfig {
private String username = "nacos";
- private String password = "nacos";
-
- private String accessKey = "";
-
- private String secretKey = "";
-
- @Override
- public String getUniqueKey() {
- return serverAddress;
- }
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRedisConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRedisConfig.java
index fb42f88..0d81035 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRedisConfig.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRedisConfig.java
@@ -15,28 +15,16 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.config;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
import lombok.Data;
-import lombok.NoArgsConstructor;
+import lombok.EqualsAndHashCode;
@Data
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
-public class CreateRedisConfig implements CreateSDKConfig {
+@EqualsAndHashCode(callSuper = true)
+public class CreateRedisConfig extends AbstractSimpleCreateSDKConfig {
- private String redisUrl;
-
- private String password;
-
- @Builder.Default
private int timeOut = 10;
- @Override
- public String getUniqueKey() {
- return redisUrl;
- }
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRemotingConfig.java
similarity index 84%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRemotingConfig.java
index 82e6c7f..b39ac01 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRemotingConfig.java
@@ -15,12 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.core.function.SDK.config;
-@Data
-public class GlobalRequest {
+public class CreateRemotingConfig extends AbstractSimpleCreateSDKConfig{
- private Long clusterId;
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqAdminSDKConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqAdminSDKConfig.java
index f9d7833..3f5c430 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqAdminSDKConfig.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqAdminSDKConfig.java
@@ -15,20 +15,14 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.config;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class CreateRocketmqAdminSDKConfig implements CreateSDKConfig {
+@EqualsAndHashCode(callSuper = true)
+public class CreateRocketmqAdminSDKConfig extends AbstractMultiCreateSDKConfig {
- private String nameServerUrl;
-
- private String clusterName;
-
-
- @Override
- public String getUniqueKey() {
- return nameServerUrl;
- }
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqConfig.java
index 3670d64..a53bb0d 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqConfig.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqConfig.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.config;
import org.apache.rocketmq.client.consumer.listener.MessageListener;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqConsumerSDKConfig.java
similarity index 66%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqConsumerSDKConfig.java
index 344d02d..a3cee24 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqConsumerSDKConfig.java
@@ -15,28 +15,24 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.message;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+package org.apache.eventmesh.dashboard.core.function.SDK.config;
+
+import org.apache.rocketmq.remoting.protocol.heartbeat.MessageModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
-@EqualsAndHashCode(callSuper = true, exclude = "status")
-public class GroupMemberEntity extends BaseEntity {
+@EqualsAndHashCode(callSuper = true)
+public class CreateRocketmqConsumerSDKConfig extends AbstractMultiCreateSDKConfig {
- private Long id;
+ private String consumerGroup;
- private Long clusterId;
+ private MessageModel messageModel = MessageModel.CLUSTERING;
- private String topicName;
+ //topic
+ private String topic;
- private String groupName;
-
- private String eventMeshUser;
-
- private String state;
-
- private Integer status;
+ private String subExpression = "*";
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqProduceSDKConfig.java
similarity index 76%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqProduceSDKConfig.java
index bf167b1..b9b85eb 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqProduceSDKConfig.java
@@ -15,16 +15,15 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
+
+package org.apache.eventmesh.dashboard.core.function.SDK.config;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class ChangeConfigEntity {
+@EqualsAndHashCode(callSuper = true)
+public class CreateRocketmqProduceSDKConfig extends AbstractMultiCreateSDKConfig {
- private String configName;
-
- private String configValue;
-
- private Integer alreadyUpdate;
+ private String producerGroup;
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRuntimeConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRuntimeConfig.java
index 7ddfc80..828b1fd 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRuntimeConfig.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRuntimeConfig.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.config;
import org.apache.eventmesh.common.protocol.tcp.UserAgent;
@@ -28,7 +29,7 @@
@Builder
@AllArgsConstructor
@NoArgsConstructor
-public class CreateRuntimeConfig implements CreateSDKConfig {
+public class CreateRuntimeConfig extends AbstractSimpleCreateSDKConfig {
// 127.0.0.1:10105;127.0.0.2:10105
private String runtimeServerAddress;
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateSDKConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateSDKConfig.java
index 23b3c11..4a2d47d 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateSDKConfig.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateSDKConfig.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.config;
/**
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateZookeeperConfig.java
similarity index 84%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateZookeeperConfig.java
index 82e6c7f..6e02d0f 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateZookeeperConfig.java
@@ -15,12 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.core.function.SDK.config;
-@Data
-public class GlobalRequest {
+public class CreateZookeeperConfig extends AbstractMultiCreateSDKConfig{
- private Long clusterId;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/NetAddress.java
similarity index 64%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/NetAddress.java
index 344d02d..93246a6 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/NetAddress.java
@@ -15,28 +15,31 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.entity.message;
-import org.apache.eventmesh.dashboard.console.entity.BaseEntity;
+package org.apache.eventmesh.dashboard.core.function.SDK.config;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
-@EqualsAndHashCode(callSuper = true, exclude = "status")
-public class GroupMemberEntity extends BaseEntity {
+@EqualsAndHashCode
+public class NetAddress {
- private Long id;
- private Long clusterId;
+ public static NetAddress create(String address, int port) {
+ NetAddress netAddress = new NetAddress();
+ netAddress.address = address;
+ netAddress.port = port;
+ return netAddress;
+ }
- private String topicName;
+ private String address;
- private String groupName;
+ private Integer port;
- private String eventMeshUser;
- private String state;
+ public String doUniqueKey() {
+ return this.address + ":" + this.port;
+ }
- private Integer status;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/NullCreateSDKConfig.java
similarity index 74%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/NullCreateSDKConfig.java
index bf167b1..7dce5ea 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/NullCreateSDKConfig.java
@@ -15,16 +15,18 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.core.function.SDK.config;
-@Data
-public class ChangeConfigEntity {
+public class NullCreateSDKConfig extends AbstractCreateSDKConfig {
- private String configName;
+ @Override
+ protected String uniqueKey() {
+ return "null_";
+ }
- private String configValue;
-
- private Integer alreadyUpdate;
+ @Override
+ String doUniqueKey() {
+ return "";
+ }
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKOperation.java
index 29e3fb3..57fc78f 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKOperation.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKOperation.java
@@ -15,46 +15,39 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.operation;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.RemotingType;
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKMetadata;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateEtcdConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
import java.time.Duration;
-import java.util.AbstractMap.SimpleEntry;
import io.etcd.jetcd.Client;
-import io.etcd.jetcd.KV;
-import io.etcd.jetcd.common.exception.EtcdException;
import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class EtcdSDKOperation extends AbstractSDKOperation<KV> {
+@SDKMetadata(clusterType = {ClusterType.EVENTMESH_META_ETCD}, remotingType = RemotingType.EVENT_MESH_ETCD, sdkTypeEnum = {SDKTypeEnum.ADMIN,
+ SDKTypeEnum.PING})
+public class EtcdSDKOperation extends AbstractSDKOperation<Client, CreateEtcdConfig> {
- private static String[] getSplitEndpoints(CreateEtcdConfig etcdConfig) {
- return etcdConfig.getEtcdServerAddress().split(";");
+ @Override
+ public Client createClient(CreateEtcdConfig clientConfig) throws Exception {
+ Client client = Client.builder()
+ .endpoints(clientConfig.getNetAddresses())
+ .connectTimeout(Duration.ofSeconds(clientConfig.getConnectTime()))
+ .build();
+ return client;
+
}
@Override
- public SimpleEntry<String, KV> createClient(CreateSDKConfig clientConfig) {
- final CreateEtcdConfig etcdConfig = (CreateEtcdConfig) clientConfig;
- KV kvClient = null;
- try {
- final Client client = Client.builder()
- .endpoints(getSplitEndpoints(etcdConfig))
- .connectTimeout(Duration.ofSeconds(etcdConfig.getConnectTime()))
- .build();
- kvClient = client.getKVClient();
- } catch (EtcdException e) {
- log.error("create etcd client failed", e);
- }
- return new SimpleEntry<>(clientConfig.getUniqueKey(), kvClient);
- }
-
- @Override
- public void close(Object client) {
- castClient(client).close();
+ public void close(Client client) throws Exception {
+ client.close();
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosConfigSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosConfigSDKOperation.java
deleted file mode 100644
index b7a6769..0000000
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosConfigSDKOperation.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.function.SDK.operation;
-
-import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateNacosConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
-
-import java.util.AbstractMap.SimpleEntry;
-import java.util.Properties;
-
-import com.alibaba.nacos.api.NacosFactory;
-import com.alibaba.nacos.api.PropertyKeyConst;
-import com.alibaba.nacos.api.config.ConfigService;
-import com.alibaba.nacos.api.exception.NacosException;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class NacosConfigSDKOperation extends AbstractSDKOperation<ConfigService> {
-
- @Override
- public SimpleEntry<String, ConfigService> createClient(CreateSDKConfig clientConfig) {
- ConfigService configService = null;
- CreateNacosConfig config = (CreateNacosConfig) clientConfig;
- try {
- Properties properties = new Properties();
- properties.put(PropertyKeyConst.SERVER_ADDR, config.getServerAddress());
- properties.put(PropertyKeyConst.NAMESPACE, config.getNamespace());
- properties.put(PropertyKeyConst.USERNAME, config.getUsername());
- properties.put(PropertyKeyConst.PASSWORD, config.getPassword());
- properties.put(PropertyKeyConst.ACCESS_KEY, config.getAccessKey());
- properties.put(PropertyKeyConst.SECRET_KEY, config.getSecretKey());
- configService = NacosFactory.createConfigService(properties);
- } catch (NacosException e) {
- log.error("NacosCheck init failed caused by {}", e.getErrMsg());
- }
- return new SimpleEntry<>(config.getServerAddress(), configService);
- }
-
- @Override
- public void close(Object client) {
- try {
- castClient(client).shutDown();
- } catch (NacosException e) {
- log.error("NacosCheck close failed caused by {}", e.getErrMsg());
- }
- }
-}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosNamingSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosNamingSDKOperation.java
deleted file mode 100644
index ca2d722..0000000
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosNamingSDKOperation.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.function.SDK.operation;
-
-import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateNacosConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
-
-import java.util.AbstractMap.SimpleEntry;
-import java.util.Properties;
-
-import com.alibaba.nacos.api.NacosFactory;
-import com.alibaba.nacos.api.PropertyKeyConst;
-import com.alibaba.nacos.api.config.ConfigService;
-import com.alibaba.nacos.api.exception.NacosException;
-import com.alibaba.nacos.api.naming.NamingService;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class NacosNamingSDKOperation extends AbstractSDKOperation<NamingService> {
-
- @Override
- public SimpleEntry<String, NamingService> createClient(CreateSDKConfig clientConfig) {
- NamingService namingService = null;
- CreateNacosConfig config = (CreateNacosConfig) clientConfig;
- try {
- Properties properties = new Properties();
- properties.put(PropertyKeyConst.SERVER_ADDR, config.getServerAddress());
- properties.put(PropertyKeyConst.NAMESPACE, config.getNamespace());
- properties.put(PropertyKeyConst.USERNAME, config.getUsername());
- properties.put(PropertyKeyConst.PASSWORD, config.getPassword());
- properties.put(PropertyKeyConst.ACCESS_KEY, config.getAccessKey());
- properties.put(PropertyKeyConst.SECRET_KEY, config.getSecretKey());
- namingService = NacosFactory.createNamingService(properties);
- } catch (NacosException e) {
- log.error("NacosCheck init failed caused by {}", e.getErrMsg());
- }
- return new SimpleEntry<>(config.getUniqueKey(), namingService);
- }
-
- @Override
- public void close(Object client) {
- try {
- ((ConfigService) client).shutDown();
- } catch (NacosException e) {
- log.error("NacosCheck close failed caused by {}", e.getErrMsg());
- }
- }
-}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosSDKOperation.java
index ba78cbb..473f5ca 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosSDKOperation.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosSDKOperation.java
@@ -15,42 +15,79 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.operation;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.RemotingType;
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKMetadata;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateNacosConfig;
import org.apache.eventmesh.dashboard.core.function.SDK.wrapper.NacosSDKWrapper;
-import java.util.AbstractMap.SimpleEntry;
-import java.util.Objects;
+import java.util.Properties;
+import com.alibaba.nacos.api.NacosFactory;
+import com.alibaba.nacos.api.PropertyKeyConst;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.naming.NamingService;
-public class NacosSDKOperation extends AbstractSDKOperation<NacosSDKWrapper> {
+@SDKMetadata(clusterType = {ClusterType.EVENTMESH_META_NACOS}, remotingType = RemotingType.EVENT_MESH_NACOS, sdkTypeEnum = {SDKTypeEnum.ADMIN,
+ SDKTypeEnum.PING})
+public class NacosSDKOperation extends AbstractSDKOperation<NacosSDKWrapper, CreateNacosConfig> {
+
+
+ private static Properties createProperties(CreateNacosConfig clientConfig) {
+ Properties properties = new Properties();
+ properties.put(PropertyKeyConst.SERVER_ADDR, clientConfig.doUniqueKey());
+ properties.put(PropertyKeyConst.NAMESPACE, clientConfig.getNamespace());
+ properties.put(PropertyKeyConst.USERNAME, clientConfig.getUsername());
+ properties.put(PropertyKeyConst.PASSWORD, clientConfig.getPassword());
+ properties.put(PropertyKeyConst.ACCESS_KEY, clientConfig.getAccessKey());
+ properties.put(PropertyKeyConst.SECRET_KEY, clientConfig.getSecretKey());
+ return properties;
+ }
private final NacosConfigSDKOperation nacosConfigClientCreateOperation = new NacosConfigSDKOperation();
+
private final NacosNamingSDKOperation nacosNamingClientCreateOperation = new NacosNamingSDKOperation();
@Override
- public SimpleEntry<String, NacosSDKWrapper> createClient(CreateSDKConfig createClientConfig) {
- SimpleEntry<String, ConfigService> configSimpleEntry = nacosConfigClientCreateOperation.createClient(createClientConfig);
- SimpleEntry<String, NamingService> namingSimpleEntry = nacosNamingClientCreateOperation.createClient(createClientConfig);
- if (!Objects.equals(configSimpleEntry.getKey(), namingSimpleEntry.getKey())) {
- throw new RuntimeException("Nacos config and naming server address not match");
- }
- NacosSDKWrapper nacosClient = new NacosSDKWrapper(
- (ConfigService) configSimpleEntry.getValue(), (NamingService) namingSimpleEntry.getValue()
- );
- return new SimpleEntry<>(configSimpleEntry.getKey(), nacosClient);
+ public NacosSDKWrapper createClient(CreateNacosConfig createClientConfig) throws Exception {
+ ConfigService configSimpleEntry = nacosConfigClientCreateOperation.createClient(createClientConfig);
+ NamingService namingSimpleEntry = nacosNamingClientCreateOperation.createClient(createClientConfig);
+ return new NacosSDKWrapper(configSimpleEntry, namingSimpleEntry);
}
@Override
- public void close(Object client) {
- try {
- castClient(client).shutdown();
- } catch (Exception e) {
- throw new RuntimeException("Nacos client close failed", e);
+ public void close(NacosSDKWrapper client) throws Exception {
+ client.shutdown();
+ }
+
+ public static class NacosConfigSDKOperation extends AbstractSDKOperation<ConfigService, CreateNacosConfig> {
+
+ @Override
+ public ConfigService createClient(CreateNacosConfig clientConfig) throws Exception {
+ return NacosFactory.createConfigService(createProperties(clientConfig));
+ }
+
+ @Override
+ public void close(ConfigService client) throws Exception {
+ client.shutDown();
+ }
+ }
+
+ public static class NacosNamingSDKOperation extends AbstractSDKOperation<NamingService, CreateNacosConfig> {
+
+ @Override
+ public NamingService createClient(CreateNacosConfig clientConfig) throws Exception {
+ return NacosFactory.createNamingService(createProperties(clientConfig));
+ }
+
+ @Override
+ public void close(NamingService client) throws Exception {
+ client.shutDown();
}
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RedisSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RedisSDKOperation.java
index aba1807..32131a0 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RedisSDKOperation.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RedisSDKOperation.java
@@ -15,39 +15,41 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.operation;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.RemotingType;
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKMetadata;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRedisConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
import java.time.Duration;
-import java.util.AbstractMap.SimpleEntry;
import io.lettuce.core.RedisClient;
import io.lettuce.core.RedisURI;
import io.lettuce.core.api.StatefulRedisConnection;
-public class RedisSDKOperation extends AbstractSDKOperation<StatefulRedisConnection<String, String>> {
+
+@SDKMetadata(clusterType = {
+ ClusterType.STORAGE_REDIS_BROKER}, remotingType = RemotingType.REDIS, sdkTypeEnum = SDKTypeEnum.ALL, config = CreateRedisConfig.class)
+public class RedisSDKOperation extends AbstractSDKOperation<StatefulRedisConnection<String, String>, CreateRedisConfig> {
@Override
- public SimpleEntry<String, StatefulRedisConnection<String, String>> createClient(CreateSDKConfig clientConfig) {
- CreateRedisConfig redisConfig = (CreateRedisConfig) clientConfig;
- String redisUrl = redisConfig.getRedisUrl();
- String clientHost = redisUrl.split(":")[0];
- int clientPort = Integer.parseInt(redisUrl.split(":")[1]);
+ public StatefulRedisConnection<String, String> createClient(CreateRedisConfig clientConfig) {
RedisURI redisURI = RedisURI.builder()
- .withHost(clientHost)
- .withPort(clientPort)
- .withPassword(redisConfig.getPassword() == null ? "" : redisConfig.getPassword())
- .withTimeout(Duration.ofSeconds(redisConfig.getTimeOut()))
+ .withHost(clientConfig.getNetAddress().getAddress())
+ .withPort(clientConfig.getNetAddress().getPort())
+ .withPassword(clientConfig.getPassword() == null ? "" : clientConfig.getPassword())
+ .withTimeout(Duration.ofSeconds(clientConfig.getTimeOut()))
.build();
RedisClient redisClient = RedisClient.create(redisURI);
- return new SimpleEntry<>(clientConfig.getUniqueKey(), redisClient.connect());
+ return redisClient.connect();
}
@Override
- public void close(Object client) {
- castClient(client).close();
+ public void close(StatefulRedisConnection<String, String> client) {
+ client.close();
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/jvm/JvmAdmin.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/jvm/JvmAdmin.java
new file mode 100644
index 0000000..b602b5f
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/jvm/JvmAdmin.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.function.SDK.operation.jvm;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.RemotingType;
+import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKMetadata;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateJvmConfig;
+
+@SDKMetadata(clusterType = ClusterType.STORAGE_JVM_BROKER, remotingType = RemotingType.JVM, sdkTypeEnum = SDKTypeEnum.ALL)
+public class JvmAdmin extends AbstractSDKOperation<Object, CreateJvmConfig> {
+
+ @Override
+ public Object createClient(CreateJvmConfig clientConfig) throws Exception {
+ return new Object();
+ }
+
+ @Override
+ public void close(Object client) throws Exception {
+
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/jvm/JvmCapAdmin.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/jvm/JvmCapAdmin.java
new file mode 100644
index 0000000..2aa8305
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/jvm/JvmCapAdmin.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.function.SDK.operation.jvm;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.RemotingType;
+import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKMetadata;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateJvmCapConfig;
+
+@SDKMetadata(clusterType = ClusterType.STORAGE_JVM_CAP_BROKER, remotingType = RemotingType.JVM, sdkTypeEnum = SDKTypeEnum.ALL)
+public class JvmCapAdmin extends AbstractSDKOperation<Object, CreateJvmCapConfig> {
+
+ @Override
+ public Object createClient(CreateJvmCapConfig clientConfig) throws Exception {
+ return new Object();
+ }
+
+ @Override
+ public void close(Object client) throws Exception {
+
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/kafka/KafkaAdminOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/kafka/KafkaAdminOperation.java
new file mode 100644
index 0000000..98b0051
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/kafka/KafkaAdminOperation.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.function.SDK.operation.kafka;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.RemotingType;
+import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKMetadata;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateKakfaConfig;
+
+import org.apache.kafka.clients.admin.AdminClient;
+
+import java.util.Properties;
+
+@SDKMetadata(clusterType = {ClusterType.STORAGE_KAFKA_BROKER, ClusterType.STORAGE_KAFKA_RAFT}, remotingType = RemotingType.KAFKA, sdkTypeEnum = {
+ SDKTypeEnum.ADMIN, SDKTypeEnum.PING})
+public class KafkaAdminOperation extends AbstractSDKOperation<AdminClient, CreateKakfaConfig> {
+
+ @Override
+ public AdminClient createClient(CreateKakfaConfig clientConfig) throws Exception {
+ Properties props = new Properties();
+ AdminClient adminClient = AdminClient.create(props);
+ return adminClient;
+ }
+
+ @Override
+ public void close(AdminClient client) throws Exception {
+ client.close();
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/kafka/KafkaZkAdminOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/kafka/KafkaZkAdminOperation.java
new file mode 100644
index 0000000..72decf0
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/kafka/KafkaZkAdminOperation.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.function.SDK.operation.kafka;
+
+import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateKafkaZkConfig;
+
+import org.apache.zookeeper.ZooKeeper;
+
+/**
+ * user ZooKeeper or KafkaZkClient or ZookeeperAdmin
+ *
+ * @see org.apache.eventmesh.dashboard.core.function.SDK.operation.zookeeper.ZookeeperAdmin
+ */
+public class KafkaZkAdminOperation extends AbstractSDKOperation<ZooKeeper, CreateKafkaZkConfig> {
+
+ @Override
+ public ZooKeeper createClient(CreateKafkaZkConfig clientConfig) throws Exception {
+ return null;
+ }
+
+ @Override
+ public void close(ZooKeeper client) throws Exception {
+ client.close();
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/kubernetes/KubernetesClientOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/kubernetes/KubernetesClientOperation.java
new file mode 100644
index 0000000..6b888f1
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/kubernetes/KubernetesClientOperation.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.function.SDK.operation.kubernetes;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.RemotingType;
+import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKMetadata;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateKubernetesConfig;
+
+import io.fabric8.kubernetes.client.KubernetesClient;
+import io.fabric8.kubernetes.client.KubernetesClientBuilder;
+
+
+@SDKMetadata(clusterType = ClusterType.KUBERNETES_RUNTIME, remotingType = RemotingType.KUBERNETES, sdkTypeEnum = {
+ SDKTypeEnum.ADMIN, SDKTypeEnum.PING})
+public class KubernetesClientOperation extends AbstractSDKOperation<KubernetesClient, CreateKubernetesConfig> {
+
+ @Override
+ public KubernetesClient createClient(CreateKubernetesConfig clientConfig) throws Exception {
+ KubernetesClientBuilder kubernetesClientBuilder = new KubernetesClientBuilder();
+ kubernetesClientBuilder.withConfig(this.getBaseSyncBase().getConfig());
+ return kubernetesClientBuilder.build();
+ }
+
+ @Override
+ public void close(KubernetesClient client) throws Exception {
+
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQAdminOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQAdminOperation.java
index f655fe1..4baa746 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQAdminOperation.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQAdminOperation.java
@@ -15,40 +15,29 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq;
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqAdminSDKConfig;
-import org.apache.rocketmq.client.exception.MQClientException;
-import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.tools.admin.DefaultMQAdminExt;
-import java.util.AbstractMap.SimpleEntry;
-
import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class RocketMQAdminOperation extends AbstractSDKOperation<DefaultMQAdminExt> {
+public class RocketMQAdminOperation extends AbstractSDKOperation<DefaultMQAdminExt, CreateRocketmqAdminSDKConfig> {
@Override
- public SimpleEntry<String, DefaultMQAdminExt> createClient(CreateSDKConfig clientConfig) {
- DefaultMQAdminExt admin = null;
- try {
-
- CreateRocketmqConfig config = (CreateRocketmqConfig) clientConfig;
- admin = new DefaultMQAdminExt();
- admin.setNamesrvAddr(config.getNameServerUrl());
- admin.start();
- } catch (MQClientException e) {
- log.error("create rocketmq producer failed", e);
- }
- return new SimpleEntry<>(clientConfig.getUniqueKey(), admin);
+ public DefaultMQAdminExt createClient(CreateRocketmqAdminSDKConfig clientConfig) throws Exception {
+ DefaultMQAdminExt admin = new DefaultMQAdminExt();
+ admin.setNamesrvAddr(clientConfig.doUniqueKey());
+ admin.start();
+ return admin;
}
@Override
- public void close(Object client) {
- ((DefaultMQProducer) client).shutdown();
+ public void close(DefaultMQAdminExt client) throws Exception {
+ client.shutdown();
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQProduceSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQProduceSDKOperation.java
index a31aede..81c40ac 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQProduceSDKOperation.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQProduceSDKOperation.java
@@ -15,39 +15,35 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.RemotingType;
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKMetadata;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqProduceSDKConfig;
-import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
-import java.util.AbstractMap.SimpleEntry;
-
import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class RocketMQProduceSDKOperation extends AbstractSDKOperation<DefaultMQProducer> {
+@SDKMetadata(clusterType = ClusterType.RUNTIME_ROCKETMQ_BROKER, remotingType = RemotingType.ROCKETMQ, sdkTypeEnum = SDKTypeEnum.PRODUCER)
+public class RocketMQProduceSDKOperation extends AbstractSDKOperation<DefaultMQProducer, CreateRocketmqProduceSDKConfig> {
@Override
- public SimpleEntry<String, DefaultMQProducer> createClient(CreateSDKConfig clientConfig) {
- DefaultMQProducer producer = null;
- try {
- CreateRocketmqConfig config = (CreateRocketmqConfig) clientConfig;
- producer = new DefaultMQProducer(config.getProducerGroup());
- producer.setNamesrvAddr(config.getNameServerUrl());
- producer.setCompressMsgBodyOverHowmuch(16);
- producer.start();
- } catch (MQClientException e) {
- log.error("create rocketmq producer failed", e);
- }
- return new SimpleEntry<>(clientConfig.getUniqueKey(), producer);
+ public DefaultMQProducer createClient(CreateRocketmqProduceSDKConfig clientConfig) throws Exception {
+ DefaultMQProducer producer = new DefaultMQProducer(clientConfig.getProducerGroup());
+ producer.setNamesrvAddr(clientConfig.doUniqueKey());
+ producer.setCompressMsgBodyOverHowmuch(16);
+ producer.start();
+ return producer;
}
@Override
- public void close(Object client) {
- ((DefaultMQProducer) client).shutdown();
+ public void close(DefaultMQProducer client) {
+ client.shutdown();
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQPushConsumerSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQPushConsumerSDKOperation.java
index 37d71c2..055a3d4 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQPushConsumerSDKOperation.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQPushConsumerSDKOperation.java
@@ -15,41 +15,35 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.RemotingType;
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKMetadata;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConsumerSDKConfig;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
-import org.apache.rocketmq.client.exception.MQClientException;
-
-import java.util.AbstractMap.SimpleEntry;
import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class RocketMQPushConsumerSDKOperation extends AbstractSDKOperation<DefaultMQPushConsumer> {
+@SDKMetadata(clusterType = ClusterType.RUNTIME_ROCKETMQ_BROKER, remotingType = RemotingType.ROCKETMQ, sdkTypeEnum = SDKTypeEnum.CONSUMER)
+public class RocketMQPushConsumerSDKOperation extends AbstractSDKOperation<DefaultMQPushConsumer, CreateRocketmqConsumerSDKConfig> {
@Override
- public SimpleEntry<String, DefaultMQPushConsumer> createClient(CreateSDKConfig clientConfig) {
- DefaultMQPushConsumer consumer = null;
- try {
- CreateRocketmqConfig config = (CreateRocketmqConfig) clientConfig;
- consumer = new DefaultMQPushConsumer(config.getConsumerGroup());
- consumer.setMessageModel(config.getMessageModel());
- consumer.setNamesrvAddr(config.getNameServerUrl());
- consumer.subscribe(config.getTopic(), config.getSubExpression());
- //consumer.registerMessageListener(config.getMessageListener());
- consumer.start();
- } catch (MQClientException e) {
- log.error("create rocketmq push consumer failed", e);
- }
- return new SimpleEntry(((CreateRocketmqConfig) clientConfig).getNameServerUrl(), consumer);
+ public DefaultMQPushConsumer createClient(CreateRocketmqConsumerSDKConfig clientConfig) throws Exception {
+ DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(clientConfig.getConsumerGroup());
+ consumer.setMessageModel(clientConfig.getMessageModel());
+ consumer.setNamesrvAddr(clientConfig.doUniqueKey());
+ consumer.subscribe(clientConfig.getTopic(), clientConfig.getSubExpression());
+ return consumer;
}
@Override
- public void close(Object client) {
- ((DefaultMQPushConsumer) client).shutdown();
+ public void close(DefaultMQPushConsumer client) {
+ client.shutdown();
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQRemotingSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQRemotingSDKOperation.java
index 00ad867..f0e3f6b 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQRemotingSDKOperation.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQRemotingSDKOperation.java
@@ -15,30 +15,148 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.RemotingType;
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKMetadata;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRemotingConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq.RocketMQRemotingSDKOperation.DefaultRemotingClient;
+import org.apache.rocketmq.remoting.InvokeCallback;
+import org.apache.rocketmq.remoting.RPCHook;
import org.apache.rocketmq.remoting.RemotingClient;
+import org.apache.rocketmq.remoting.exception.RemotingConnectException;
+import org.apache.rocketmq.remoting.exception.RemotingSendRequestException;
+import org.apache.rocketmq.remoting.exception.RemotingTimeoutException;
+import org.apache.rocketmq.remoting.exception.RemotingTooMuchRequestException;
import org.apache.rocketmq.remoting.netty.NettyClientConfig;
import org.apache.rocketmq.remoting.netty.NettyRemotingClient;
+import org.apache.rocketmq.remoting.netty.NettyRequestProcessor;
+import org.apache.rocketmq.remoting.protocol.RemotingCommand;
-import java.util.AbstractMap.SimpleEntry;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
-public class RocketMQRemotingSDKOperation extends AbstractSDKOperation<RemotingClient> {
+@SDKMetadata(clusterType = {ClusterType.STORAGE_ROCKETMQ_BROKER_MAIN_SLAVE,
+ ClusterType.STORAGE_ROCKETMQ_NAMESERVER, ClusterType.STORAGE_ROCKETMQ_BROKER_RAFT}, remotingType = RemotingType.ROCKETMQ,
+ sdkTypeEnum = {SDKTypeEnum.ADMIN, SDKTypeEnum.PING})
+public class RocketMQRemotingSDKOperation extends AbstractSDKOperation<DefaultRemotingClient, CreateRemotingConfig> {
- @Override
- public SimpleEntry<String, RemotingClient> createClient(CreateSDKConfig clientConfig) {
+ private RemotingClient remotingClient;
+
+ {
+ // TODO
NettyClientConfig config = new NettyClientConfig();
config.setUseTLS(false);
- RemotingClient remotingClient = new NettyRemotingClient(config);
+ remotingClient = new NettyRemotingClient(config);
remotingClient.start();
- return new SimpleEntry<>(clientConfig.getUniqueKey(), remotingClient);
+ }
+
+ /**
+ * 是否需要封装下 RemotingClient 没有 addr
+ *
+ * @param clientConfig
+ * @return
+ */
+ @Override
+ public DefaultRemotingClient createClient(CreateRemotingConfig clientConfig) {
+ DefaultRemotingClient defaultRemotingClient = new DefaultRemotingClient();
+ defaultRemotingClient.remotingClient = this.remotingClient;
+ defaultRemotingClient.addr = clientConfig.getNetAddress().getAddress();
+ return defaultRemotingClient;
}
@Override
- public void close(Object client) {
- ((RemotingClient) client).shutdown();
+ public void close(DefaultRemotingClient client) {
+ client.shutdown();
+ }
+
+ public static class DefaultRemotingClient {
+
+ private String addr;
+
+ private RemotingClient remotingClient;
+
+
+ public void updateNameServerAddressList(List<String> addrs) {
+ this.remotingClient.updateNameServerAddressList(addrs);
+ }
+
+
+ public List<String> getNameServerAddressList() {
+ return this.remotingClient.getNameServerAddressList();
+ }
+
+
+ public List<String> getAvailableNameSrvList() {
+ return this.remotingClient.getAvailableNameSrvList();
+ }
+
+
+ public RemotingCommand invokeSync(RemotingCommand request, long timeoutMillis)
+ throws InterruptedException, RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException {
+ return this.remotingClient.invokeSync(this.addr, request, timeoutMillis);
+ }
+
+
+ public void invokeAsync(RemotingCommand request, long timeoutMillis, InvokeCallback invokeCallback)
+ throws InterruptedException, RemotingConnectException, RemotingTooMuchRequestException, RemotingTimeoutException,
+ RemotingSendRequestException {
+ this.remotingClient.invokeAsync(this.addr, request, timeoutMillis, invokeCallback);
+ }
+
+
+ public void invokeOneway(RemotingCommand request, long timeoutMillis)
+ throws InterruptedException, RemotingConnectException, RemotingTooMuchRequestException, RemotingTimeoutException,
+ RemotingSendRequestException {
+ this.remotingClient.invokeOneway(this.addr, request, timeoutMillis);
+ }
+
+
+ public void registerProcessor(int requestCode, NettyRequestProcessor processor, ExecutorService executor) {
+ this.remotingClient.registerProcessor(requestCode, processor, executor);
+ }
+
+
+ public boolean isChannelWritable(String addr) {
+ return this.remotingClient.isChannelWritable(this.addr);
+ }
+
+
+ public boolean isAddressReachable(String addr) {
+ return this.remotingClient.isAddressReachable(this.addr);
+ }
+
+
+ public void closeChannels(List<String> addrList) {
+ this.remotingClient.closeChannels(addrList);
+ }
+
+
+ public void start() {
+ this.remotingClient.start();
+ }
+
+
+ public void shutdown() {
+ List<String> addrList = new ArrayList<>();
+ addrList.add(this.addr);
+ this.closeChannels(addrList);
+ }
+
+
+ public void registerRPCHook(RPCHook rpcHook) {
+
+ }
+
+
+ public void clearRPCHook() {
+
+ }
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeGrpcConsumerSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeGrpcConsumerSDKOperation.java
index 1386020..67ee0b1 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeGrpcConsumerSDKOperation.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeGrpcConsumerSDKOperation.java
@@ -15,40 +15,31 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime;
import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshGrpcConsumerConfig;
import org.apache.eventmesh.client.grpc.config.EventMeshGrpcClientConfig;
import org.apache.eventmesh.client.grpc.consumer.EventMeshGrpcConsumer;
-import org.apache.eventmesh.common.exception.EventMeshException;
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
-
-import java.util.AbstractMap.SimpleEntry;
import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class RuntimeGrpcConsumerSDKOperation extends AbstractSDKOperation<EventMeshGrpcConsumer> {
+public class RuntimeGrpcConsumerSDKOperation extends AbstractSDKOperation<EventMeshGrpcConsumer, CreateRuntimeConfig> {
@Override
- public SimpleEntry<String, EventMeshGrpcConsumer> createClient(CreateSDKConfig clientConfig) {
- final CreateRuntimeConfig runtimeConfig = (CreateRuntimeConfig) clientConfig;
- final EventMeshGrpcClientConfig grpcClientConfig = buildEventMeshGrpcConsumerConfig(runtimeConfig);
- EventMeshGrpcConsumer grpcConsumer = null;
- try {
- grpcConsumer = new EventMeshGrpcConsumer(grpcClientConfig);
- grpcConsumer.init();
- } catch (EventMeshException e) {
- log.error("create runtime grpc Consumer client failed", e);
- }
- return new SimpleEntry<>(clientConfig.getUniqueKey(), grpcConsumer);
+ public EventMeshGrpcConsumer createClient(CreateRuntimeConfig clientConfig) {
+ final EventMeshGrpcClientConfig grpcClientConfig = buildEventMeshGrpcConsumerConfig(clientConfig);
+ EventMeshGrpcConsumer grpcConsumer = new EventMeshGrpcConsumer(grpcClientConfig);
+ grpcConsumer.init();
+ return grpcConsumer;
}
@Override
- public void close(Object client) {
- castClient(client).close();
+ public void close(EventMeshGrpcConsumer client) {
+ client.close();
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeGrpcProducerSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeGrpcProducerSDKOperation.java
index 2c4c846..7fac2e9 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeGrpcProducerSDKOperation.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeGrpcProducerSDKOperation.java
@@ -15,39 +15,31 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime;
import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshGrpcProducerConfig;
import org.apache.eventmesh.client.grpc.config.EventMeshGrpcClientConfig;
import org.apache.eventmesh.client.grpc.producer.EventMeshGrpcProducer;
-import org.apache.eventmesh.common.exception.EventMeshException;
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
-
-import java.util.AbstractMap.SimpleEntry;
import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class RuntimeGrpcProducerSDKOperation extends AbstractSDKOperation<EventMeshGrpcProducer> {
+public class RuntimeGrpcProducerSDKOperation extends AbstractSDKOperation<EventMeshGrpcProducer, CreateRuntimeConfig> {
@Override
- public SimpleEntry<String, EventMeshGrpcProducer> createClient(CreateSDKConfig clientConfig) {
- final CreateRuntimeConfig runtimeConfig = (CreateRuntimeConfig) clientConfig;
- final EventMeshGrpcClientConfig grpcClientConfig = buildEventMeshGrpcProducerConfig(runtimeConfig);
- EventMeshGrpcProducer grpcProducer = null;
- try {
- grpcProducer = new EventMeshGrpcProducer(grpcClientConfig);
- } catch (EventMeshException e) {
- log.error("create runtime grpc Producer client failed", e);
- }
- return new SimpleEntry<>(clientConfig.getUniqueKey(), grpcProducer);
+ public EventMeshGrpcProducer createClient(CreateRuntimeConfig clientConfig) throws Exception {
+ final EventMeshGrpcClientConfig grpcClientConfig = buildEventMeshGrpcProducerConfig(clientConfig);
+ EventMeshGrpcProducer grpcProducer = new EventMeshGrpcProducer(grpcClientConfig);
+ return grpcProducer;
+
}
@Override
- public void close(Object client) {
- castClient(client).close();
+ public void close(EventMeshGrpcProducer client) throws Exception {
+ client.close();
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeHttpConsumerSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeHttpConsumerSDKOperation.java
index 553ed3c..6dfd111 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeHttpConsumerSDKOperation.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeHttpConsumerSDKOperation.java
@@ -15,39 +15,29 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime;
import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshHttpConsumerConfig;
import org.apache.eventmesh.client.http.conf.EventMeshHttpClientConfig;
import org.apache.eventmesh.client.http.consumer.EventMeshHttpConsumer;
-import org.apache.eventmesh.common.exception.EventMeshException;
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
-
-import java.util.AbstractMap.SimpleEntry;
import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class RuntimeHttpConsumerSDKOperation extends AbstractSDKOperation<EventMeshHttpConsumer> {
+public class RuntimeHttpConsumerSDKOperation extends AbstractSDKOperation<EventMeshHttpConsumer, CreateRuntimeConfig> {
@Override
- public SimpleEntry<String, EventMeshHttpConsumer> createClient(CreateSDKConfig clientConfig) {
- final CreateRuntimeConfig runtimeConfig = (CreateRuntimeConfig) clientConfig;
+ public EventMeshHttpConsumer createClient(CreateRuntimeConfig runtimeConfig) {
final EventMeshHttpClientConfig httpClientConfig = buildEventMeshHttpConsumerConfig(runtimeConfig);
- EventMeshHttpConsumer httpConsumer = null;
- try {
- httpConsumer = new EventMeshHttpConsumer(httpClientConfig);
- } catch (EventMeshException e) {
- log.error("create runtime http Consumer client failed", e);
- }
- return new SimpleEntry<>(clientConfig.getUniqueKey(), httpConsumer);
+ return new EventMeshHttpConsumer(httpClientConfig);
}
@Override
- public void close(Object client) {
- castClient(client).close();
+ public void close(EventMeshHttpConsumer client) {
+ client.close();
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeHttpProducerSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeHttpProducerSDKOperation.java
index 6caa0b1..7d657dd 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeHttpProducerSDKOperation.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeHttpProducerSDKOperation.java
@@ -15,39 +15,31 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime;
import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshHttpProducerConfig;
import org.apache.eventmesh.client.http.conf.EventMeshHttpClientConfig;
import org.apache.eventmesh.client.http.producer.EventMeshHttpProducer;
-import org.apache.eventmesh.common.exception.EventMeshException;
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
-
-import java.util.AbstractMap.SimpleEntry;
import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class RuntimeHttpProducerSDKOperation extends AbstractSDKOperation<EventMeshHttpProducer> {
+public class RuntimeHttpProducerSDKOperation extends AbstractSDKOperation<EventMeshHttpProducer, CreateRuntimeConfig> {
@Override
- public SimpleEntry<String, EventMeshHttpProducer> createClient(CreateSDKConfig clientConfig) {
- final CreateRuntimeConfig runtimeConfig = (CreateRuntimeConfig) clientConfig;
+ public EventMeshHttpProducer createClient(CreateRuntimeConfig runtimeConfig) throws Exception {
final EventMeshHttpClientConfig httpClientConfig = buildEventMeshHttpProducerConfig(runtimeConfig);
- EventMeshHttpProducer httpProducer = null;
- try {
- httpProducer = new EventMeshHttpProducer(httpClientConfig);
- } catch (EventMeshException e) {
- log.error("create runtime http Producer client failed", e);
- }
- return new SimpleEntry<>(clientConfig.getUniqueKey(), httpProducer);
+
+ return new EventMeshHttpProducer(httpClientConfig);
+
}
@Override
- public void close(Object client) {
- castClient(client).close();
+ public void close(EventMeshHttpProducer client) throws Exception {
+ client.close();
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeSDKOperation.java
index a51bb8a..7be25b5 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeSDKOperation.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeSDKOperation.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime;
import org.apache.eventmesh.client.grpc.consumer.EventMeshGrpcConsumer;
@@ -25,17 +26,19 @@
import org.apache.eventmesh.client.tcp.impl.eventmeshmessage.EventMeshMessageTCPClient;
import org.apache.eventmesh.client.tcp.impl.openmessage.OpenMessageTCPClient;
import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.RemotingType;
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKMetadata;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
import org.apache.eventmesh.dashboard.core.function.SDK.wrapper.RuntimeSDKWrapper;
-import java.util.AbstractMap.SimpleEntry;
-
import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class RuntimeSDKOperation extends AbstractSDKOperation<RuntimeSDKWrapper> {
+@SDKMetadata(clusterType = {ClusterType.EVENTMESH_RUNTIME}, remotingType = RemotingType.EVENT_MESH_RUNTIME, sdkTypeEnum = SDKTypeEnum.ALL)
+public class RuntimeSDKOperation extends AbstractSDKOperation<RuntimeSDKWrapper, CreateRuntimeConfig> {
private final RuntimeTcpCloudEventSDKOperation tcpCloudEventSDKOperation = new RuntimeTcpCloudEventSDKOperation();
private final RuntimeTcpEventMeshSDKOperation tcpEventMeshSDKOperation = new RuntimeTcpEventMeshSDKOperation();
@@ -48,33 +51,32 @@
private final RuntimeGrpcConsumerSDKOperation grpcConsumerSDKOperation = new RuntimeGrpcConsumerSDKOperation();
@Override
- public SimpleEntry<String, RuntimeSDKWrapper> createClient(CreateSDKConfig clientConfig) {
- CreateRuntimeConfig runtimeConfig = (CreateRuntimeConfig) clientConfig;
- final String protocol = ((CreateRuntimeConfig) clientConfig).getProtocol();
- final String protocolName = ((CreateRuntimeConfig) clientConfig).getProtocolName();
- final String clientType = ((CreateRuntimeConfig) clientConfig).getClientType();
+ public RuntimeSDKWrapper createClient(CreateRuntimeConfig runtimeConfig) throws Exception {
+ final String protocol = runtimeConfig.getProtocol();
+ final String protocolName = runtimeConfig.getProtocolName();
+ final String clientType = runtimeConfig.getClientType();
- SimpleEntry<String, CloudEventTCPClient> cloudSimpleEntry = null;
- SimpleEntry<String, EventMeshMessageTCPClient> eventMeshMessageSimpleEntry = null;
- SimpleEntry<String, OpenMessageTCPClient> openMessageSimpleEntry = null;
+ CloudEventTCPClient cloudSimple = null;
+ EventMeshMessageTCPClient eventMeshMessageSimple = null;
+ OpenMessageTCPClient openMessageSimple = null;
- SimpleEntry<String, EventMeshHttpProducer> httpProducerSimpleEntry = null;
- SimpleEntry<String, EventMeshHttpConsumer> httpConsumerSimpleEntry = null;
+ EventMeshHttpProducer httpProducerSimple = null;
+ EventMeshHttpConsumer httpConsumerSimple = null;
- SimpleEntry<String, EventMeshGrpcProducer> grpcProducerSimpleEntry = null;
- SimpleEntry<String, EventMeshGrpcConsumer> grpcConsumerSimpleEntry = null;
+ EventMeshGrpcProducer grpcProducerSimple = null;
+ EventMeshGrpcConsumer grpcConsumerSimple = null;
switch (protocol) {
case Constants.TCP:
switch (protocolName) {
case Constants.CLOUD_EVENTS_PROTOCOL_NAME:
- cloudSimpleEntry = tcpCloudEventSDKOperation.createClient(runtimeConfig);
+ cloudSimple = tcpCloudEventSDKOperation.createClient(runtimeConfig);
break;
case Constants.EM_MESSAGE_PROTOCOL_NAME:
- eventMeshMessageSimpleEntry = tcpEventMeshSDKOperation.createClient(runtimeConfig);
+ eventMeshMessageSimple = tcpEventMeshSDKOperation.createClient(runtimeConfig);
break;
case Constants.OPEN_MESSAGE_PROTOCOL_NAME:
- openMessageSimpleEntry = tcpOpenMessageSDKOperation.createClient(runtimeConfig);
+ openMessageSimple = tcpOpenMessageSDKOperation.createClient(runtimeConfig);
break;
default:
break;
@@ -83,10 +85,10 @@
case Constants.HTTP:
switch (clientType) {
case "producer":
- httpProducerSimpleEntry = httpProducerSDKOperation.createClient(runtimeConfig);
+ httpProducerSimple = httpProducerSDKOperation.createClient(runtimeConfig);
break;
case "consumer":
- httpConsumerSimpleEntry = httpConsumerSDKOperation.createClient(runtimeConfig);
+ httpConsumerSimple = httpConsumerSDKOperation.createClient(runtimeConfig);
break;
default:
break;
@@ -95,10 +97,10 @@
case Constants.GRPC:
switch (clientType) {
case "producer":
- grpcProducerSimpleEntry = grpcProducerSDKOperation.createClient(runtimeConfig);
+ grpcProducerSimple = grpcProducerSDKOperation.createClient(runtimeConfig);
break;
case "consumer":
- grpcConsumerSimpleEntry = grpcConsumerSDKOperation.createClient(runtimeConfig);
+ grpcConsumerSimple = grpcConsumerSDKOperation.createClient(runtimeConfig);
break;
default:
break;
@@ -108,20 +110,13 @@
log.warn("clients that do not support the current protocol");
break;
}
- RuntimeSDKWrapper runtimeClient = new RuntimeSDKWrapper(
- cloudSimpleEntry != null ? cloudSimpleEntry.getValue() : null,
- eventMeshMessageSimpleEntry != null ? eventMeshMessageSimpleEntry.getValue() : null,
- openMessageSimpleEntry != null ? openMessageSimpleEntry.getValue() : null,
- httpProducerSimpleEntry != null ? httpProducerSimpleEntry.getValue() : null,
- httpConsumerSimpleEntry != null ? httpConsumerSimpleEntry.getValue() : null,
- grpcProducerSimpleEntry != null ? grpcProducerSimpleEntry.getValue() : null,
- grpcConsumerSimpleEntry != null ? grpcConsumerSimpleEntry.getValue() : null
- );
- return new SimpleEntry<>(clientConfig.getUniqueKey(), runtimeClient);
+ return new RuntimeSDKWrapper(cloudSimple, eventMeshMessageSimple, openMessageSimple, httpProducerSimple, httpConsumerSimple,
+ grpcProducerSimple, grpcConsumerSimple);
+
}
@Override
- public void close(Object client) {
- castClient(client).close();
+ public void close(RuntimeSDKWrapper client) throws Exception {
+ client.close();
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpCloudEventSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpCloudEventSDKOperation.java
index 1b8dd73..0e59aaf 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpCloudEventSDKOperation.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpCloudEventSDKOperation.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime;
import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshTCPClientConfig;
@@ -22,41 +23,28 @@
import org.apache.eventmesh.client.tcp.conf.EventMeshTCPClientConfig;
import org.apache.eventmesh.client.tcp.impl.cloudevent.CloudEventTCPClient;
-import org.apache.eventmesh.common.exception.EventMeshException;
import org.apache.eventmesh.common.protocol.tcp.UserAgent;
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
-
-import java.util.AbstractMap.SimpleEntry;
import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class RuntimeTcpCloudEventSDKOperation extends AbstractSDKOperation<CloudEventTCPClient> {
+public class RuntimeTcpCloudEventSDKOperation extends AbstractSDKOperation<CloudEventTCPClient, CreateRuntimeConfig> {
@Override
- public SimpleEntry<String, CloudEventTCPClient> createClient(CreateSDKConfig clientConfig) {
- final CreateRuntimeConfig runtimeConfig = (CreateRuntimeConfig) clientConfig;
- CloudEventTCPClient cloudEventTCPClient = null;
- try {
- final UserAgent userAgent = buildUserAgent(runtimeConfig.getUserAgent());
- final EventMeshTCPClientConfig eventMeshTCPClientConfig = buildEventMeshTCPClientConfig(
- runtimeConfig.getRuntimeServerAddress(), userAgent);
- cloudEventTCPClient = new CloudEventTCPClient(eventMeshTCPClientConfig);
- cloudEventTCPClient.init();
- } catch (EventMeshException e) {
- log.error("create runtime CloudEvent tcp client failed", e);
- }
- return new SimpleEntry<>(clientConfig.getUniqueKey(), cloudEventTCPClient);
+ public CloudEventTCPClient createClient(CreateRuntimeConfig clientConfig) throws Exception {
+ final UserAgent userAgent = buildUserAgent(clientConfig.getUserAgent());
+ final EventMeshTCPClientConfig eventMeshTCPClientConfig = buildEventMeshTCPClientConfig(
+ clientConfig.getRuntimeServerAddress(), userAgent);
+ CloudEventTCPClient cloudEventTCPClient = new CloudEventTCPClient(eventMeshTCPClientConfig);
+ cloudEventTCPClient.init();
+ return cloudEventTCPClient;
+
}
@Override
- public void close(Object client) {
- try {
- castClient(client).close();
- } catch (Exception e) {
- log.error("close eventmesh runtime tcp client failed");
- }
+ public void close(CloudEventTCPClient client) throws Exception {
+ client.close();
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpEventMeshSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpEventMeshSDKOperation.java
index e13843b..3ad0edb 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpEventMeshSDKOperation.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpEventMeshSDKOperation.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime;
import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshTCPClientConfig;
@@ -22,41 +23,27 @@
import org.apache.eventmesh.client.tcp.conf.EventMeshTCPClientConfig;
import org.apache.eventmesh.client.tcp.impl.eventmeshmessage.EventMeshMessageTCPClient;
-import org.apache.eventmesh.common.exception.EventMeshException;
import org.apache.eventmesh.common.protocol.tcp.UserAgent;
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
-
-import java.util.AbstractMap.SimpleEntry;
import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class RuntimeTcpEventMeshSDKOperation extends AbstractSDKOperation<EventMeshMessageTCPClient> {
+public class RuntimeTcpEventMeshSDKOperation extends AbstractSDKOperation<EventMeshMessageTCPClient, CreateRuntimeConfig> {
@Override
- public SimpleEntry<String, EventMeshMessageTCPClient> createClient(CreateSDKConfig clientConfig) {
- final CreateRuntimeConfig runtimeConfig = (CreateRuntimeConfig) clientConfig;
- EventMeshMessageTCPClient eventMeshTCPClient = null;
- try {
- UserAgent userAgent = buildUserAgent(runtimeConfig.getUserAgent());
- final EventMeshTCPClientConfig eventMeshTCPClientConfig = buildEventMeshTCPClientConfig(
- runtimeConfig.getRuntimeServerAddress(), userAgent);
- eventMeshTCPClient = new EventMeshMessageTCPClient(eventMeshTCPClientConfig);
- eventMeshTCPClient.init();
- } catch (EventMeshException e) {
- log.error("create runtime EventMeshMessage tcp client failed", e);
- }
- return new SimpleEntry<>(clientConfig.getUniqueKey(), eventMeshTCPClient);
+ public EventMeshMessageTCPClient createClient(CreateRuntimeConfig runtimeConfig) throws Exception {
+ UserAgent userAgent = buildUserAgent(runtimeConfig.getUserAgent());
+ final EventMeshTCPClientConfig eventMeshTCPClientConfig = buildEventMeshTCPClientConfig(
+ runtimeConfig.getRuntimeServerAddress(), userAgent);
+ EventMeshMessageTCPClient eventMeshTCPClient = new EventMeshMessageTCPClient(eventMeshTCPClientConfig);
+ eventMeshTCPClient.init();
+ return eventMeshTCPClient;
}
@Override
- public void close(Object client) {
- try {
- castClient(client).close();
- } catch (Exception e) {
- log.error("EventMeshMessage client close failed", e);
- }
+ public void close(EventMeshMessageTCPClient client) throws Exception {
+ client.close();
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpOpenMessageSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpOpenMessageSDKOperation.java
index 5086ce9..7cf8f11 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpOpenMessageSDKOperation.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpOpenMessageSDKOperation.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime;
import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshTCPClientConfig;
@@ -25,33 +26,24 @@
import org.apache.eventmesh.common.protocol.tcp.UserAgent;
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
-
-import java.util.AbstractMap;
import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class RuntimeTcpOpenMessageSDKOperation extends AbstractSDKOperation<OpenMessageTCPClient> {
+public class RuntimeTcpOpenMessageSDKOperation extends AbstractSDKOperation<OpenMessageTCPClient, CreateRuntimeConfig> {
@Override
- public AbstractMap.SimpleEntry<String, OpenMessageTCPClient> createClient(CreateSDKConfig clientConfig) {
- final CreateRuntimeConfig runtimeConfig = (CreateRuntimeConfig) clientConfig;
- OpenMessageTCPClient openMessageTCPClient = null;
- try {
- UserAgent userAgent = buildUserAgent(runtimeConfig.getUserAgent());
- final EventMeshTCPClientConfig eventMeshTCPClientConfig = buildEventMeshTCPClientConfig(
- runtimeConfig.getRuntimeServerAddress(), userAgent);
- openMessageTCPClient = new OpenMessageTCPClient(eventMeshTCPClientConfig);
- openMessageTCPClient.init();
- } catch (Exception e) {
- log.error("create runtime eventmesh OpenMessage client failed", e);
- }
- return new AbstractMap.SimpleEntry<>(clientConfig.getUniqueKey(), openMessageTCPClient);
+ public OpenMessageTCPClient createClient(CreateRuntimeConfig clientConfig) throws Exception {
+ UserAgent userAgent = buildUserAgent(clientConfig.getUserAgent());
+ final EventMeshTCPClientConfig eventMeshTCPClientConfig = buildEventMeshTCPClientConfig(
+ clientConfig.getRuntimeServerAddress(), userAgent);
+ OpenMessageTCPClient openMessageTCPClient = new OpenMessageTCPClient(eventMeshTCPClientConfig);
+ openMessageTCPClient.init();
+ return openMessageTCPClient;
}
@Override
- public void close(Object client) {
- castClient(client).close();
+ public void close(OpenMessageTCPClient client) throws Exception {
+ client.close();
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/zookeeper/ZookeeperAdmin.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/zookeeper/ZookeeperAdmin.java
new file mode 100644
index 0000000..f51fb77
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/zookeeper/ZookeeperAdmin.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.function.SDK.operation.zookeeper;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.RemotingType;
+import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKMetadata;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateZookeeperConfig;
+
+import org.apache.zookeeper.ZooKeeper;
+
+@SDKMetadata(clusterType = {ClusterType.STORAGE_KAFKA_ZK}, remotingType = RemotingType.KAFKA, sdkTypeEnum = {
+ SDKTypeEnum.ADMIN, SDKTypeEnum.PING})
+public class ZookeeperAdmin extends AbstractSDKOperation<ZooKeeper, CreateZookeeperConfig> {
+
+ @Override
+ public ZooKeeper createClient(CreateZookeeperConfig clientConfig) throws Exception {
+
+ return null;
+ }
+
+ @Override
+ public void close(ZooKeeper client) throws Exception {
+ client.close();
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/util/RuntimeSDKOperationUtils.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/util/RuntimeSDKOperationUtils.java
index 435949c..01c5621 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/util/RuntimeSDKOperationUtils.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/util/RuntimeSDKOperationUtils.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.util;
import org.apache.eventmesh.client.grpc.config.EventMeshGrpcClientConfig;
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/NacosSDKWrapper.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/NacosSDKWrapper.java
index 617331d..64927b5 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/NacosSDKWrapper.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/NacosSDKWrapper.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.wrapper;
import com.alibaba.nacos.api.config.ConfigService;
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/RuntimeSDKWrapper.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/RuntimeSDKWrapper.java
index 9e6370b..0441cf7 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/RuntimeSDKWrapper.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/RuntimeSDKWrapper.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.function.SDK.wrapper;
import org.apache.eventmesh.client.grpc.consumer.EventMeshGrpcConsumer;
@@ -24,17 +25,14 @@
import org.apache.eventmesh.client.tcp.impl.cloudevent.CloudEventTCPClient;
import org.apache.eventmesh.client.tcp.impl.eventmeshmessage.EventMeshMessageTCPClient;
import org.apache.eventmesh.client.tcp.impl.openmessage.OpenMessageTCPClient;
-import org.apache.eventmesh.common.exception.EventMeshException;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
@Data
@AllArgsConstructor
@NoArgsConstructor
-@Slf4j
public class RuntimeSDKWrapper {
private CloudEventTCPClient tcpCloudEventClient;
@@ -47,25 +45,21 @@
private EventMeshGrpcProducer grpcProducerClient;
private EventMeshGrpcConsumer grpcConsumerClient;
- public void close() {
- try {
- if (tcpCloudEventClient != null) {
- tcpCloudEventClient.close();
- } else if (tcpEventMeshClient != null) {
- tcpEventMeshClient.close();
- } else if (openMessageTCPClient != null) {
- openMessageTCPClient.close();
- } else if (httpProducerClient != null) {
- httpProducerClient.close();
- } else if (httpConsumerClient != null) {
- httpConsumerClient.close();
- } else if (grpcProducerClient != null) {
- grpcProducerClient.close();
- } else if (grpcConsumerClient != null) {
- grpcConsumerClient.close();
- }
- } catch (EventMeshException e) {
- log.error("runtime client close failed", e);
+ public void close() throws Exception {
+ if (tcpCloudEventClient != null) {
+ tcpCloudEventClient.close();
+ } else if (tcpEventMeshClient != null) {
+ tcpEventMeshClient.close();
+ } else if (openMessageTCPClient != null) {
+ openMessageTCPClient.close();
+ } else if (httpProducerClient != null) {
+ httpProducerClient.close();
+ } else if (httpConsumerClient != null) {
+ httpConsumerClient.close();
+ } else if (grpcProducerClient != null) {
+ grpcProducerClient.close();
+ } else if (grpcConsumerClient != null) {
+ grpcConsumerClient.close();
}
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/gather/jmx/JmxConnector.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/gather/jmx/JmxConnector.java
new file mode 100644
index 0000000..914d640
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/gather/jmx/JmxConnector.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.gather.jmx;
+
+import javax.management.remote.JMXConnector;
+
+public class JmxConnector {
+
+ private JMXConnector jmxConnector;
+
+ private void createJmxConnector() {
+ /* String jmxUrl = String.format("service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi", jmxHost, jmxPort);
+ try {
+ Map<String, Object> environment = new HashMap<String, Object>();
+ if (!ValidateUtils.isBlank(this.jmxConfig.getUsername()) && !ValidateUtils.isBlank(this.jmxConfig.getToken())) {
+ // fixed by riyuetianmu
+ environment.put(JMXConnector.CREDENTIALS, new String[] {this.jmxConfig.getUsername(), this.jmxConfig.getToken()});
+ }
+ if (jmxConfig.getOpenSSL() != null && this.jmxConfig.getOpenSSL()) {
+ environment.put(Context.SECURITY_PROTOCOL, "ssl");
+ SslRMIClientSocketFactory clientSocketFactory = new SslRMIClientSocketFactory();
+ environment.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, clientSocketFactory);
+ environment.put("com.sun.jndi.rmi.factory.socket", clientSocketFactory);
+ }
+
+ jmxConnector = JMXConnectorFactory.connect(new JMXServiceURL(jmxUrl), environment);
+ LOGGER.info(
+ "method=createJmxConnector||clientLogIdent={}||jmxHost={}||jmxPort={}||msg=jmx connect success.",
+ clientLogIdent, jmxHost, jmxPort
+ );
+ return true;
+ }catch (Exception e){
+
+ }*/
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/MessageManage.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/MessageManage.java
new file mode 100644
index 0000000..a1e03b3
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/MessageManage.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.message;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.util.ClasspathScanner;
+import org.apache.eventmesh.dashboard.core.function.SDK.ConfigManage;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKManage;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.AbstractMultiCreateSDKConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
+import org.apache.eventmesh.dashboard.core.message.model.AbstractMessageDTO;
+import org.apache.eventmesh.dashboard.core.message.model.ConsumerDTO;
+import org.apache.eventmesh.dashboard.core.message.model.ProducerDTO;
+import org.apache.eventmesh.dashboard.core.message.operate.AbstractConsumerOperate;
+import org.apache.eventmesh.dashboard.core.message.operate.AbstractMessageOperate;
+import org.apache.eventmesh.dashboard.core.message.operate.ConsumerOperate;
+import org.apache.eventmesh.dashboard.core.message.operate.ProducerOperate;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class MessageManage {
+
+ private static final Map<ClusterType, Map<Class<?>, Class<?>>> MESSAGE_CLASSES = new HashMap<>();
+
+ static {
+ Set<Class<?>> interfaceSet = new HashSet<>();
+ interfaceSet.add(ProducerOperate.class);
+ interfaceSet.add(ConsumerOperate.class);
+ ClasspathScanner classpathScanner = ClasspathScanner.builder().base(SDKManage.class).subPath("/operation").interfaceSet(interfaceSet).build();
+ try {
+ List<Class<?>> classList = classpathScanner.getClazz();
+ classList.forEach(MessageManage::createMessageOperate);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ static void createMessageOperate(Class<?> clazz) {
+
+ }
+
+
+ private Map<Class<?>, Map<String, AbstractMessageOperate>> classMapConcurrentHashMap = new ConcurrentHashMap<>();
+
+
+ {
+ classMapConcurrentHashMap.put(ProducerOperate.class, new ConcurrentHashMap<>());
+ classMapConcurrentHashMap.put(ConsumerOperate.class, new ConcurrentHashMap<>());
+ }
+
+ public ProducerOperate createProducerOperate(ProducerDTO producerDTO) throws Exception {
+ return this.createOperate(producerDTO, ProducerOperate.class, SDKTypeEnum.PRODUCER);
+ }
+
+ public ConsumerOperate createConsumerOperate(ConsumerDTO consumerDTO) throws Exception {
+ return this.createOperate(consumerDTO, ConsumerOperate.class, SDKTypeEnum.CONSUMER);
+ }
+
+ private <T> T createOperate(AbstractMessageDTO abstractMessageDTO, Class<?> operateClazz, SDKTypeEnum sdkTypeEnum) throws Exception {
+ Class<?> clazz = MESSAGE_CLASSES.get(abstractMessageDTO.getClusterType()).get(operateClazz);
+
+ AbstractConsumerOperate abstractConsumerOperate = (AbstractConsumerOperate) clazz.newInstance();
+ AbstractMultiCreateSDKConfig abstractMultiCreateSDKConfig =
+ ConfigManage.getInstance().getMultiCreateSDKConfig(abstractMessageDTO.getClusterType(), sdkTypeEnum);
+
+ CreateSDKConfig consumerConfig = abstractConsumerOperate.createSDKConfig(abstractMultiCreateSDKConfig, null);
+ // RocketMQ,模式如何处理?
+ Object client = null;
+ //SDKManage.getInstance().createClient(sdkTypeEnum, consumerConfig, abstractMessageDTO.getClusterType());
+ abstractConsumerOperate.setClient(client);
+ abstractConsumerOperate.setAbstractMessageDTO(abstractMessageDTO);
+
+ abstractConsumerOperate.start();
+ String uuId = java.util.UUID.randomUUID().toString();
+ classMapConcurrentHashMap.get(operateClazz).put(uuId, abstractConsumerOperate);
+ return (T) abstractConsumerOperate;
+ }
+
+
+ public List<Object> pull(String uuId) {
+ ConsumerOperate consumerOperate = (ConsumerOperate) classMapConcurrentHashMap.get(ConsumerOperate.class).get(uuId);
+
+ return consumerOperate.pull();
+ }
+
+ public void send(String uuId) {
+ ProducerOperate producerOperate = (ProducerOperate) classMapConcurrentHashMap.get(ProducerOperate.class).get(uuId);
+ }
+}
+
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/model/AbstractMessageDTO.java
similarity index 65%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/model/AbstractMessageDTO.java
index 2102c5c..fa40d8f 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/model/AbstractMessageDTO.java
@@ -15,36 +15,32 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.cluster;
-import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+package org.apache.eventmesh.dashboard.core.message.model;
+
import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.model.metadata.QueueMetadata;
-import javax.validation.constraints.NotNull;
+import java.util.List;
import lombok.Data;
+
@Data
-public class CreateClusterDTO {
+public class AbstractMessageDTO {
- @NotNull
- private String name;
+ private Long clusterId;
- @NotNull
- private ClusterTrusteeshipType trusteeshipType;
-
- @NotNull
private ClusterType clusterType;
- @NotNull
- private String version;
+ private String consumerGroup;
+ private String topic;
- private String jmxProperties = "";
+ private String group;
- private String description = "";
+ private boolean simulate;
-
- private Integer authType = 0;
+ private List<QueueMetadata> queueMetadataList;
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/model/ConsumerDTO.java
similarity index 81%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/model/ConsumerDTO.java
index 82e6c7f..7130a91 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/model/ConsumerDTO.java
@@ -15,12 +15,17 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
+
+package org.apache.eventmesh.dashboard.core.message.model;
import lombok.Data;
+import lombok.EqualsAndHashCode;
@Data
-public class GlobalRequest {
+@EqualsAndHashCode(callSuper = true)
+public class ConsumerDTO extends AbstractMessageDTO {
- private Long clusterId;
+
+
+
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingServiceType.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/model/ProducerDTO.java
similarity index 87%
rename from eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingServiceType.java
rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/model/ProducerDTO.java
index 2da47e6..11325f2 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingServiceType.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/model/ProducerDTO.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.service.remoting;
-public enum RemotingServiceType {
+package org.apache.eventmesh.dashboard.core.message.model;
+public class ProducerDTO extends AbstractMessageDTO {
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingServiceType.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/model/SendTDO.java
similarity index 87%
copy from eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingServiceType.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/model/SendTDO.java
index 2da47e6..b590f04 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingServiceType.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/model/SendTDO.java
@@ -15,9 +15,11 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.service.remoting;
-public enum RemotingServiceType {
+package org.apache.eventmesh.dashboard.core.message.model;
+public class SendTDO {
+
+ private String body;
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/operate/AbstractConsumerOperate.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/operate/AbstractConsumerOperate.java
new file mode 100644
index 0000000..37bf33d
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/operate/AbstractConsumerOperate.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.message.operate;
+
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
+import org.apache.eventmesh.dashboard.core.message.model.ConsumerDTO;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+public abstract class AbstractConsumerOperate<CL, C extends CreateSDKConfig>
+ extends AbstractMessageOperate<CL, C, ConsumerDTO> implements ConsumerOperate {
+
+ private List<Object> data = new ArrayList<>();
+
+ private int tate;
+
+
+ public List<Object> pull() {
+ synchronized (this.data) {
+ List<Object> data = this.data;
+ this.data = new ArrayList<>();
+ return data;
+ }
+ }
+
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingServiceRuntimeConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/operate/AbstractMessageOperate.java
similarity index 60%
copy from eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingServiceRuntimeConfig.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/operate/AbstractMessageOperate.java
index 2b76a70..89c86bd 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingServiceRuntimeConfig.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/operate/AbstractMessageOperate.java
@@ -15,23 +15,28 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.core.remoting;
+package org.apache.eventmesh.dashboard.core.message.operate;
+
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
-import org.apache.eventmesh.dashboard.service.remoting.RemotingServiceType;
+import org.apache.eventmesh.dashboard.core.message.model.AbstractMessageDTO;
-import java.util.HashMap;
-import java.util.Map;
-
-import lombok.Data;
-
-@Data
-public class RemotingServiceRuntimeConfig {
+import lombok.Setter;
- private CreateSDKConfig runtimeConfig;
+@Setter
+public abstract class AbstractMessageOperate<CL, C extends CreateSDKConfig, DTO extends AbstractMessageDTO> {
- private CreateSDKConfig storageConfig;
+ private DTO abstractMessageDTO;
- private Map<RemotingServiceType, String> remotingServiceTypeStringMap = new HashMap<>();
+
+ /**
+ * TODO 不负责, 节点的改变造成的问题
+ */
+ private CL client;
+
+ public abstract CreateSDKConfig createSDKConfig(C createSDKConfig, BaseSyncBase baseSyncBase);
+
+
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingServiceRuntimeConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/operate/AbstractProducerOperate.java
similarity index 67%
copy from eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingServiceRuntimeConfig.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/operate/AbstractProducerOperate.java
index 2b76a70..54cc45e 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingServiceRuntimeConfig.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/operate/AbstractProducerOperate.java
@@ -15,23 +15,20 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.core.remoting;
+
+package org.apache.eventmesh.dashboard.core.message.operate;
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
-import org.apache.eventmesh.dashboard.service.remoting.RemotingServiceType;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import lombok.Data;
-
-@Data
-public class RemotingServiceRuntimeConfig {
+import org.apache.eventmesh.dashboard.core.message.model.ProducerDTO;
- private CreateSDKConfig runtimeConfig;
+public abstract class AbstractProducerOperate<CL, C extends CreateSDKConfig>
+ extends AbstractMessageOperate<CL, C, ProducerDTO> implements ProducerOperate {
- private CreateSDKConfig storageConfig;
+ /**
+ * 是否模拟数据
+ */
+ private boolean simulate;
- private Map<RemotingServiceType, String> remotingServiceTypeStringMap = new HashMap<>();
+
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/operate/ConsumerOperate.java
similarity index 80%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/operate/ConsumerOperate.java
index 82e6c7f..5b76897 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/operate/ConsumerOperate.java
@@ -15,12 +15,20 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.core.message.operate;
-@Data
-public class GlobalRequest {
+import java.util.List;
- private Long clusterId;
+/**
+ *
+ */
+public interface ConsumerOperate {
+
+
+ void start();
+
+ void stop();
+
+ List<Object> pull();
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingOperate.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/operate/ProducerOperate.java
similarity index 85%
copy from eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingOperate.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/operate/ProducerOperate.java
index 24cf7f8..28febf8 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingOperate.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/message/operate/ProducerOperate.java
@@ -15,13 +15,16 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.service.remoting;
-public enum RemotingOperate {
+package org.apache.eventmesh.dashboard.core.message.operate;
- ADD,
- UPDATE,
+/**
+ *
+ */
+public interface ProducerOperate {
- DELETE;
+
+ void send(Object data);
+
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/connection/EtcdConnectionCore.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/connection/EtcdConnectionCore.java
index 0a994bc..644783c 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/connection/EtcdConnectionCore.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/connection/EtcdConnectionCore.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.meta.connection;
import org.apache.eventmesh.dashboard.service.meta.ConnectionCore;
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/connection/NacosConnectionCore.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/connection/NacosConnectionCore.java
index 6f02652..ae94f67 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/connection/NacosConnectionCore.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/connection/NacosConnectionCore.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.meta.connection;
import org.apache.eventmesh.dashboard.service.meta.ConnectionCore;
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/runtime/NacosRuntimeCore.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/runtime/NacosRuntimeCore.java
deleted file mode 100644
index 2859c1b..0000000
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/runtime/NacosRuntimeCore.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.meta.runtime;
-
-import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
-import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeRequest;
-import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeResponse;
-import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeResult;
-import org.apache.eventmesh.dashboard.core.function.SDK.SDKManager;
-import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateNacosConfig;
-import org.apache.eventmesh.dashboard.service.remoting.MetaRemotingService;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.CompletableFuture;
-
-import com.alibaba.nacos.api.exception.NacosException;
-import com.alibaba.nacos.api.naming.pojo.Instance;
-import com.alibaba.nacos.client.naming.NacosNamingService;
-
-public class NacosRuntimeCore implements MetaRemotingService {
-
- @Override
- public GetRuntimeResult getRuntime(GetRuntimeRequest getRuntimeRequest) {
- CreateNacosConfig createNacosConfig = new CreateNacosConfig();
- createNacosConfig.setServerAddress(getRuntimeRequest.getRegistryAddress());
- NacosNamingService nacosNamingService = (NacosNamingService) SDKManager.getInstance()
- .createClient(SDKTypeEnum.META_NACOS_NAMING, createNacosConfig).getValue();
- GetRuntimeResult getRuntimeResult = new GetRuntimeResult();
-
- CompletableFuture<GetRuntimeResponse> future = CompletableFuture.supplyAsync(() -> {
- try {
- Map<String, RuntimeMetadata> runtimeMetadataMap = new HashMap<>();
- //If service name or group name is changed, please modify the following code
- List<String> protocols = Arrays.asList("GRPC", "HTTP", "TCP");
-
- for (String protocol : protocols) {
- List<Instance> instances =
- nacosNamingService.getAllInstances("EVENTMESH-runtime-" + protocol, protocol + "-GROUP");
- instances.forEach(instance -> {
- if (!runtimeMetadataMap.containsKey(instance.getIp())) {
- RuntimeMetadata runtimeMetadata = RuntimeMetadata.builder()
- .host(instance.getIp())
- .port(instance.getPort())
- .rack(instance.getClusterName())
- .storageClusterId(0L)
- .clusterName(Objects.isNull(instance.getClusterName()) ? instance.getClusterName() : "NORMAL")
- .registryAddress(getRuntimeRequest.getRegistryAddress())
- .jmxPort(0)
- .endpointMap("")
- .build();
- runtimeMetadata.setRegistryAddress(getRuntimeRequest.getRegistryAddress());
- runtimeMetadataMap.put(instance.getIp(), runtimeMetadata);
- }
- });
- }
-
- return new GetRuntimeResponse(new ArrayList<>(runtimeMetadataMap.values()));
- } catch (NacosException e) {
- throw new RuntimeException(e);
- }
- });
-
- getRuntimeResult.setFuture(future);
- return getRuntimeResult;
- }
-}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/subscription/EtcdSubscriptionCore.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/subscription/EtcdSubscriptionCore.java
deleted file mode 100644
index 4fd39c8..0000000
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/subscription/EtcdSubscriptionCore.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.meta.subscription;
-
-import org.apache.eventmesh.dashboard.common.dto.Result;
-import org.apache.eventmesh.dashboard.common.model.SubscriptionInfo;
-import org.apache.eventmesh.dashboard.service.meta.SubscriptionCore;
-
-import java.util.List;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class EtcdSubscriptionCore implements SubscriptionCore {
-
- @Override
- public String retrieveConfig(String dataId, String group) {
- return null;
- }
-
- @Override
- public Result<List<SubscriptionInfo>> retrieveConfigs(Integer page, Integer size, String dataId, String group) {
- return null;
- }
-}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/subscription/NacosSubscriptionCore.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/subscription/NacosSubscriptionCore.java
deleted file mode 100644
index db6d505..0000000
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/subscription/NacosSubscriptionCore.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.meta.subscription;
-
-import static org.apache.eventmesh.dashboard.common.enums.Status.NACOS_EMPTY_RESP_ERR;
-import static org.apache.eventmesh.dashboard.common.enums.Status.NACOS_GET_CONFIGS_ERR;
-import static org.apache.eventmesh.dashboard.common.enums.Status.NACOS_LOGIN_EMPTY_RESP_ERR;
-import static org.apache.eventmesh.dashboard.common.enums.Status.NACOS_LOGIN_ERR;
-import static org.apache.eventmesh.dashboard.common.enums.Status.NACOS_SDK_CONFIG_ERR;
-
-import org.apache.eventmesh.dashboard.common.constant.ConfigConst;
-import org.apache.eventmesh.dashboard.common.constant.NacosConst;
-import org.apache.eventmesh.dashboard.common.dto.Result;
-import org.apache.eventmesh.dashboard.common.exception.EventMeshAdminException;
-import org.apache.eventmesh.dashboard.common.exception.MetaException;
-import org.apache.eventmesh.dashboard.common.model.SubscriptionInfo;
-import org.apache.eventmesh.dashboard.core.config.AdminProperties;
-import org.apache.eventmesh.dashboard.service.meta.SubscriptionCore;
-
-import java.util.ArrayList;
-import java.util.Base64;
-import java.util.Collections;
-import java.util.List;
-import java.util.Properties;
-
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
-import org.springframework.web.client.RestTemplate;
-import org.springframework.web.util.UriComponentsBuilder;
-
-import com.alibaba.fastjson2.JSON;
-import com.alibaba.fastjson2.JSONObject;
-import com.alibaba.nacos.api.NacosFactory;
-import com.alibaba.nacos.api.PropertyKeyConst;
-import com.alibaba.nacos.api.config.ConfigService;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class NacosSubscriptionCore implements SubscriptionCore {
-
- private static String HTTP_PREFIX = ConfigConst.HTTP_PREFIX;
- AdminProperties adminProperties;
- Properties nacosProps = new Properties();
- RestTemplate restTemplate = new RestTemplate();
-
- public NacosSubscriptionCore(AdminProperties adminProperties) {
- this.adminProperties = adminProperties;
-
- nacosProps.setProperty(PropertyKeyConst.SERVER_ADDR, adminProperties.getMeta().getNacos().getAddr());
- nacosProps.setProperty(PropertyKeyConst.NAMESPACE, adminProperties.getMeta().getNacos().getNamespace());
- if (adminProperties.getMeta().getNacos().isAuthEnabled()) {
- if (!adminProperties.getMeta().getNacos().getUsername().isEmpty()) {
- nacosProps.setProperty(PropertyKeyConst.USERNAME, adminProperties.getMeta().getNacos().getUsername());
- }
- if (!adminProperties.getMeta().getNacos().getPassword().isEmpty()) {
- nacosProps.setProperty(PropertyKeyConst.PASSWORD, adminProperties.getMeta().getNacos().getPassword());
- }
- if (!adminProperties.getMeta().getNacos().getAccessKey().isEmpty()) {
- nacosProps.setProperty(PropertyKeyConst.ACCESS_KEY, adminProperties.getMeta().getNacos().getAccessKey());
- }
- if (!adminProperties.getMeta().getNacos().getSecretKey().isEmpty()) {
- nacosProps.setProperty(PropertyKeyConst.SECRET_KEY, adminProperties.getMeta().getNacos().getSecretKey());
- }
- }
- if (adminProperties.getMeta().getNacos().getProtocol().equalsIgnoreCase("https")) {
- HTTP_PREFIX = ConfigConst.HTTPS_PREFIX;
- }
- }
-
- /**
- * Retrieve a specified config with Nacos SDK.
- */
- @Override
- public String retrieveConfig(String dataId, String group) {
- ConfigService configService;
- try {
- configService = NacosFactory.createConfigService(nacosProps);
- } catch (Exception e) {
- log.error(NACOS_SDK_CONFIG_ERR.getDesc(), e);
- throw new EventMeshAdminException(NACOS_SDK_CONFIG_ERR, e);
- }
- try {
- return configService.getConfig(dataId, group, adminProperties.getMeta().getTimeoutMs());
- } catch (Exception e) {
- log.error(NACOS_GET_CONFIGS_ERR.getDesc(), e);
- throw new MetaException(NACOS_GET_CONFIGS_ERR, e);
- }
- }
-
- /**
- * Retrieve a list of configs with Nacos OpenAPI, because Nacos SDK doesn't support listing and fuzzy matching.
- * <p>
- * TODO Granularity should be based on subscriptions rather than Runtime;
- * retrieve all subscriptions for each Runtime, rather than retrieving subscriptions for each individual Runtime.
- */
- @Override
- public Result<List<SubscriptionInfo>> retrieveConfigs(Integer page, Integer size, String dataId, String group) {
- UriComponentsBuilder urlBuilder = UriComponentsBuilder
- .fromHttpUrl(HTTP_PREFIX + nacosProps.getProperty(PropertyKeyConst.SERVER_ADDR) + NacosConst.CONFIGS_API)
- .queryParam(NacosConst.CONFIGS_REQ_PAGE, page)
- .queryParam(NacosConst.CONFIGS_REQ_PAGE_SIZE, size)
- .queryParam(NacosConst.CONFIGS_REQ_DATAID, dataId)
- .queryParam(NacosConst.CONFIGS_REQ_GROUP, group)
- .queryParam(NacosConst.CONFIGS_REQ_SEARCH, "blur");
-
- if (adminProperties.getMeta().getNacos().isAuthEnabled()) {
- urlBuilder.queryParam(NacosConst.CONFIGS_REQ_TOKEN, loginGetAccessToken());
- }
-
- ResponseEntity<String> response;
- try {
- response = restTemplate.getForEntity(urlBuilder.toUriString(), String.class);
- } catch (Exception e) {
- log.error(NACOS_GET_CONFIGS_ERR.getDesc(), e);
- throw new MetaException(NACOS_GET_CONFIGS_ERR, e);
- }
- if (response.getBody() == null || response.getBody().isEmpty()) {
- log.error(NACOS_EMPTY_RESP_ERR.getDesc());
- throw new MetaException(NACOS_EMPTY_RESP_ERR);
- }
-
- JSONObject obj = JSON.parseObject(response.getBody());
- return new Result<>(toSubscriptionInfos(obj), obj.getInteger(NacosConst.CONFIGS_RESP_PAGES));
- }
-
- private List<SubscriptionInfo> toSubscriptionInfos(JSONObject obj) {
- List<SubscriptionInfo> subscriptionInfos = new ArrayList<>();
- for (Object pageItem : obj.getJSONArray(NacosConst.CONFIGS_RESP_CONTENT_LIST)) {
- JSONObject pageItemObj = (JSONObject) pageItem;
- subscriptionInfos.add(toSubscriptionInfo(pageItemObj));
- }
- return subscriptionInfos;
- }
-
- private SubscriptionInfo toSubscriptionInfo(JSONObject obj) {
- String content = obj.getString(NacosConst.CONFIGS_RESP_CONTENT);
- return SubscriptionInfo.builder()
- .clientName(obj.getString(NacosConst.CONFIGS_RESP_DATAID))
- .group(obj.getString(NacosConst.CONFIGS_RESP_GROUP))
- // The subscription content of Nacos config should be base64 encoded to protect special characters.
- .subscription(Base64.getEncoder().encodeToString(content.getBytes()))
- .build();
- }
-
- /**
- * Login if auth enabled and return accessToken.
- */
- private String loginGetAccessToken() {
- HttpHeaders headers = new HttpHeaders();
- headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
-
- MultiValueMap<String, String> bodyParams = new LinkedMultiValueMap<>();
- bodyParams.put(NacosConst.LOGIN_REQ_USERNAME, Collections.singletonList(nacosProps.getProperty(PropertyKeyConst.USERNAME)));
- bodyParams.put(NacosConst.LOGIN_REQ_PASSWORD, Collections.singletonList(nacosProps.getProperty(PropertyKeyConst.PASSWORD)));
-
- String loginUrl = HTTP_PREFIX + nacosProps.getProperty(PropertyKeyConst.SERVER_ADDR) + NacosConst.LOGIN_API;
- HttpEntity<MultiValueMap<String, String>> loginRequest = new HttpEntity<>(bodyParams, headers);
- ResponseEntity<String> loginResponse;
- try {
- loginResponse = restTemplate.postForEntity(loginUrl, loginRequest, String.class);
- } catch (Exception e) {
- log.error(NACOS_LOGIN_ERR.getDesc(), e);
- throw new MetaException(NACOS_LOGIN_ERR, e);
- }
- if (loginResponse.getBody() == null || loginResponse.getBody().isEmpty()) {
- log.error(NACOS_LOGIN_EMPTY_RESP_ERR + " Status code: {}", loginResponse.getStatusCode());
- throw new MetaException(NACOS_LOGIN_EMPTY_RESP_ERR + " Status code: " + loginResponse.getStatusCode());
- }
- return JSON.parseObject(loginResponse.getBody()).getString(NacosConst.LOGIN_RESP_TOKEN);
- }
-}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/DataMetadataHandler.java
similarity index 81%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/DataMetadataHandler.java
index 82e6c7f..4428cc1 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/DataMetadataHandler.java
@@ -15,12 +15,12 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.core.metadata;
-@Data
-public class GlobalRequest {
+/**
+ * @param <T>
+ */
+public interface DataMetadataHandler<T> extends FullMetadataHandler<T>, GetMetadataHandler<T> {
- private Long clusterId;
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/FullMetadataHandler.java
similarity index 68%
copy from eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/FullMetadataHandler.java
index 2e63772..715d08a 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/FullMetadataHandler.java
@@ -15,21 +15,22 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.service.store;
-import org.apache.eventmesh.dashboard.service.dto.TopicProperties;
+package org.apache.eventmesh.dashboard.core.metadata;
import java.util.List;
/**
- * Manage topics of eventmesh-storage-plugin (EventMesh Store).
+ * @param <T>
*/
+public interface FullMetadataHandler<T> {
-public interface TopicCore {
- List<TopicProperties> getTopics();
+ void handleAll(List<T> addData, List<T> updateData, List<T> deleteData);
- Boolean createTopic(String topicName);
- Boolean deleteTopic(String topicName);
+
+ default void handleAllObject(List<Object> addData, List<Object> updateData, List<Object> deleteData) {
+ handleAll((List<T>) addData, (List<T>) updateData, (List<T>) deleteData);
+ }
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsRequest.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/GetMetadataHandler.java
similarity index 75%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsRequest.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/GetMetadataHandler.java
index 37d78ec..9b5ba1a 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsRequest.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/GetMetadataHandler.java
@@ -15,11 +15,21 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting.acl;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
+package org.apache.eventmesh.dashboard.core.metadata;
-public class GetAclsRequest extends GlobalRequest {
+import org.apache.eventmesh.dashboard.common.model.remoting.Global2Request;
+import java.util.List;
+/**
+ * @param <T>
+ */
+public interface GetMetadataHandler<T> {
+
+ List<T> getData();
+
+ default List<T> getData(Global2Request global2Request) {
+ return getData();
+ }
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataHandler.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataHandler.java
index 86419bd..a5790d2 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataHandler.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataHandler.java
@@ -15,95 +15,15 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.metadata;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
-
-import java.util.List;
-
/**
* @param <T> metadata type or entity type, {@code <T>} is the source type of handler, there should be a converter in the handler to convert
* {@code <T>} to the target type.<p> method in this interface should be implemented as async method, if the method is eventmesh manage
* operation.
*/
-public interface MetadataHandler<T> {
+public interface MetadataHandler<T> extends DataMetadataHandler<T>, UpdateMetadataHandler<T> {
- default void handleAll(List<T> addData, List<T> updateData, List<T> deleteData) {
- if (addData != null) {
- addData.forEach(this::addMetadata);
- }
- if (updateData != null) {
- updateData.forEach(this::updateMetadata);
- }
- if (deleteData != null) {
- deleteData.forEach(this::deleteMetadata);
- }
- }
-
- default void handleAllObject(List<Object> addData, List<Object> updateData, List<Object> deleteData) {
- handleAll((List<T>) addData, (List<T>) updateData, (List<T>) deleteData);
- }
-
- //metaData: topic, center, etc. add meta is to create a topic.
- void addMetadata(T meta);
-
- default void addMetadata(List<T> meta) {
- if (meta != null) {
- meta.forEach(this::addMetadata);
- }
- }
-
- default void addMetadataObject(Object meta) {
- addMetadata((T) meta);
- }
-
- default void addMetadataObject(List<Object> meta) {
- if (meta != null) {
- meta.forEach(t -> addMetadata((T) t));
- }
- }
-
- default void replaceMetadata(List<Object> meta) {
- if (meta != null) {
- deleteMetadata((List<T>) meta);
- addMetadataObject(meta);
- }
- }
-
- default void updateMetadata(T meta) {
- this.addMetadata(meta);
- }
-
- /**
- * If this handler is db handler, do implement this method to improve performance
- *
- * @param meta
- */
- default void updateMetadata(List<T> meta) {
- if (meta != null) {
- meta.forEach(this::updateMetadata);
- }
- }
-
- default void updateMetadataObject(Object meta) {
- this.addMetadata((T) meta);
- }
-
- void deleteMetadata(T meta);
-
- default void deleteMetadata(List<T> meta) {
- if (meta != null) {
- meta.forEach(this::deleteMetadata);
- }
- }
-
- default void deleteMetadataObject(Object meta) {
- deleteMetadata((T) meta);
- }
-
- List<T> getData();
-
- List<T> getData(GlobalRequest globalRequest);
-
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManage.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManage.java
new file mode 100644
index 0000000..400487f
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManage.java
@@ -0,0 +1,279 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.metadata;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterSyncMetadataEnum;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType.FirstToWhom;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.enums.MetadataType;
+import org.apache.eventmesh.dashboard.common.model.ClusterSyncMetadata;
+import org.apache.eventmesh.dashboard.common.model.ConvertMetaData;
+import org.apache.eventmesh.dashboard.common.model.DatabaseAndMetadataMapper;
+import org.apache.eventmesh.dashboard.common.model.base.BaseClusterIdBase;
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
+import org.apache.eventmesh.dashboard.core.metadata.result.MetadataSyncResult;
+import org.apache.eventmesh.dashboard.core.metadata.result.MetadataSyncResultHandler;
+import org.apache.eventmesh.dashboard.core.remoting.Remoting2Manage;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import lombok.Data;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 启动应该进行差异化对比。进行差异化增量,差异化删除 表 -> increment-> remote -> function -> data -> conver -> request
+ * <p>
+ * 怎么把 SyncMetadataManage 合进来
+ */
+@Slf4j
+public class MetadataSyncManage {
+
+
+ private final ThreadPoolExecutor dbThreadPoolExecutor = new ThreadPoolExecutor(10, 10, 20, TimeUnit.SECONDS, new LinkedBlockingDeque<>(),
+ new ThreadFactory() {
+ final AtomicInteger counter = new AtomicInteger(0);
+
+ @Override
+ public Thread newThread(Runnable r) {
+ return new Thread(r, "db-metadata-manager-" + counter.incrementAndGet());
+ }
+ });
+
+ private final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(32, 32, 10, TimeUnit.MINUTES, new LinkedBlockingQueue<>(),
+ new ThreadFactory() {
+ final AtomicInteger counter = new AtomicInteger(0);
+
+ @Override
+ public Thread newThread(Runnable r) {
+ return new Thread(r, "metadata-manager-" + counter.incrementAndGet());
+ }
+ });
+
+
+ private final Remoting2Manage remoting2Manage = Remoting2Manage.getInstance();
+
+ private final ScheduledThreadPoolExecutor scheduledExecutorService = new ScheduledThreadPoolExecutor(2);
+
+
+ /**
+ * db
+ */
+ private final Map<MetadataType, SyncMetadataCreateFactory> syncMetadataCreateFactoryMap = new HashMap<>();
+
+
+ private final Map<String, List<MetadataSyncWrapper>> metadataSyncConfigMap = new ConcurrentHashMap<>();
+
+ private final AtomicInteger atomicInteger = new AtomicInteger(0);
+
+ @Setter
+ private List<DataMetadataHandler<Object>> dataMetadataHandlerList;
+
+
+ @Setter
+ private MetadataSyncResultHandler metadataSyncResultHandler;
+
+
+ public void init(Integer initialDelay, Integer period, List<DatabaseAndMetadataMapper> databaseAndMetadataMapperList) {
+
+ Map<Class<?>, DatabaseAndMetadataMapper> databaseAndMetadataMapperMap = new HashMap<>();
+ databaseAndMetadataMapperList.forEach(value -> {
+ databaseAndMetadataMapperMap.put(value.getDatabaseHandlerClass(), value);
+ });
+ this.init(initialDelay, period, databaseAndMetadataMapperMap);
+ }
+
+ public void init(Integer initialDelay, Integer period, Map<Class<?>, DatabaseAndMetadataMapper> databaseAndMetadataMapperMap) {
+
+ dataMetadataHandlerList.forEach((v) -> {
+ Class<?> clazz = v.getClass();
+ DatabaseAndMetadataMapper databaseAndMetadataMapper = databaseAndMetadataMapperMap.get(clazz);
+ if (Objects.isNull(databaseAndMetadataMapper)) {
+ String className = clazz.getName();
+ className = className.substring(0, className.indexOf("$$"));
+ try {
+ clazz = Class.forName(className);
+ databaseAndMetadataMapper = databaseAndMetadataMapperMap.get(clazz);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ if (Objects.isNull(databaseAndMetadataMapper)) {
+ log.error("can not find databaseAndMetadataMapper for class {}", v);
+ return;
+ }
+ SyncMetadataCreateFactory syncMetadataCreateFactory = new SyncMetadataCreateFactory();
+ syncMetadataCreateFactory.setDataMetadataHandler(v);
+ syncMetadataCreateFactory.setConvertMetaData((ConvertMetaData<Object, BaseClusterIdBase>) databaseAndMetadataMapper.getConvertMetaData());
+ syncMetadataCreateFactory.setMetadataType(databaseAndMetadataMapper.getMetaType());
+ syncMetadataCreateFactory.setDatabaseAndMetadataMapper(databaseAndMetadataMapper);
+
+ syncMetadataCreateFactoryMap.put(databaseAndMetadataMapper.getMetaType(), syncMetadataCreateFactory);
+ });
+
+ scheduledExecutorService.scheduleAtFixedRate(this::run, initialDelay, period, TimeUnit.MILLISECONDS);
+ }
+
+ public void run() {
+ final long startTime = System.currentTimeMillis();
+ int index = atomicInteger.incrementAndGet();
+ if (log.isDebugEnabled()) {
+ log.debug("{} run , index {}", this.getClass().getSimpleName(), index);
+ }
+ CountDownLatch countDownLatch = new CountDownLatch(syncMetadataCreateFactoryMap.size());
+ syncMetadataCreateFactoryMap.forEach((k, value) -> {
+ dbThreadPoolExecutor.execute(() -> {
+ try {
+ // 这里可以打印日志
+ if (log.isDebugEnabled()) {
+ log.debug("index {} sync data is {} ", index, k);
+ }
+ value.persistence();
+ value.loadData();
+ if (log.isDebugEnabled()) {
+ log.debug("index {} sync time {} ", index, (System.currentTimeMillis() - startTime));
+ }
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+ } finally {
+ countDownLatch.countDown();
+ }
+ });
+ });
+ dbThreadPoolExecutor.execute(() -> {
+ try {
+ this.metadataSyncResultHandler.persistence();
+ if (log.isDebugEnabled()) {
+ log.debug("index {} , result complete persistence, time {} ", index, (System.currentTimeMillis() - startTime));
+ }
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+ }
+ });
+ try {
+ countDownLatch.await();
+ } catch (InterruptedException e) {
+ log.error(e.getMessage(), e);
+ }
+ log.info("syc db and result data persistence complete. time:{}", (System.currentTimeMillis() - startTime));
+ metadataSyncConfigMap.forEach((key, value) -> {
+ value.forEach(v -> {
+ threadPoolExecutor.execute(v);
+ });
+ });
+ }
+
+
+ public void register(BaseSyncBase baseSyncBase) {
+ if (Objects.equals(baseSyncBase.getTrusteeshipType(), ClusterTrusteeshipType.NO_TRUSTEESHIP)) {
+ return;
+ }
+ List<MetadataSyncWrapper> metadataSyncWrappers = new ArrayList<>();
+ List<MetadataSyncResult> metadataSyncResultList = new ArrayList<>();
+
+ ClusterType clusterType = baseSyncBase.getClusterType();
+
+ ClusterSyncMetadata clusterSyncMetadata = ClusterSyncMetadataEnum.getClusterSyncMetadata(clusterType);
+ List<MetadataType> metadataTypeList = clusterSyncMetadata.getMetadataTypeList();
+ metadataTypeList.forEach((value -> {
+ // build MetadataSyncResult
+ MetadataSyncResult metadataSyncResult = new MetadataSyncResult();
+ metadataSyncResult.setMetadataType(value);
+ metadataSyncResult.setKey(baseSyncBase.getUnique());
+ metadataSyncResult.setBaseSyncBase(baseSyncBase);
+ metadataSyncResultList.add(metadataSyncResult);
+
+ SyncMetadataCreateFactory syncMetadataCreateFactory = syncMetadataCreateFactoryMap.get(value);
+ // build MetadataSyncConfig
+ MetadataSyncConfig metadataSyncConfig = new MetadataSyncConfig();
+ metadataSyncConfig.setMetadataSyncResult(metadataSyncResult);
+ metadataSyncConfig.setClusterServiceType(baseSyncBase.getTrusteeshipType());
+ metadataSyncConfig.setFirstToWhom(baseSyncBase.getFirstToWhom());
+ metadataSyncConfig.setDataBasesHandler(syncMetadataCreateFactory.createDataMetadataHandler(baseSyncBase));
+
+ DataMetadataHandler<BaseClusterIdBase> object = remoting2Manage.createDataMetadataHandler(
+ syncMetadataCreateFactory.getDatabaseAndMetadataMapper().getMetadataHandlerClass(), baseSyncBase);
+ metadataSyncConfig.setClusterService(object);
+ metadataSyncConfig.setBaseSyncBase(baseSyncBase);
+ metadataSyncConfig.setMetadataType(value);
+
+ // build MetadataSyncWrapper
+ MetadataSyncWrapper metadataSyncWrapper = new MetadataSyncWrapper();
+ metadataSyncWrapper.setMetadataSyncConfig(metadataSyncConfig);
+ metadataSyncWrapper.setMetadataSyncResultHandler(metadataSyncResultHandler);
+
+ metadataSyncWrapper.createDifference();
+ metadataSyncWrappers.add(metadataSyncWrapper);
+
+ }));
+ this.metadataSyncConfigMap.put(baseSyncBase.getUnique(), metadataSyncWrappers);
+ this.metadataSyncResultHandler.register(metadataSyncResultList);
+
+ }
+
+ public void unRegister(BaseSyncBase baseSyncBase) {
+ this.metadataSyncConfigMap.remove(baseSyncBase.getUnique());
+ this.metadataSyncResultHandler.unregister(baseSyncBase);
+ }
+
+
+ @Data
+ public static class MetadataSyncConfig {
+
+ private MetadataType metadataType;
+
+ private BaseSyncBase baseSyncBase;
+
+ private MetadataSyncResult metadataSyncResult;
+
+ private ClusterTrusteeshipType clusterServiceType;
+
+ /**
+ * 当 ClusterTrusteeshipType.TRUSTEESHIP_FIND_REVERSE 时,FirstToWhom 为 FirstToWhom.RUNTIME ,无效
+ * <p>
+ * 当 ClusterTrusteeshipType.TRUSTEESHIP 时,FirstToWhom 为 FirstToWhom.DASHBOARD ,无效
+ */
+ private FirstToWhom firstToWhom;
+
+ private DataMetadataHandler<BaseClusterIdBase> dataBasesHandler;
+
+ // 直接映射 api? config 是直接读取整个runtime 里面的数据
+ // 还是封装一层?
+ // 这里如何变简单。直接 remote api?
+ private DataMetadataHandler<BaseClusterIdBase> clusterService;
+
+
+ }
+
+
+}
\ No newline at end of file
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManager.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManager.java
deleted file mode 100644
index 481e88b..0000000
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManager.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.metadata;
-
-import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
-import org.apache.eventmesh.dashboard.common.model.metadata.MetadataConfig;
-import org.apache.eventmesh.dashboard.core.remoting.RemotingManager;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import lombok.Data;
-import lombok.Setter;
-
-/**
- * 启动应该进行差异化对比。进行差异化增量,差异化删除 表 -> increment-> remote -> function -> data -> conver -> request
- */
-public class MetadataSyncManager {
-
- private final ScheduledThreadPoolExecutor scheduledExecutorService = new ScheduledThreadPoolExecutor(2);
- private final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(32, 32, 10, TimeUnit.MINUTES, new LinkedBlockingQueue<>(),
- new ThreadFactory() {
- final AtomicInteger counter = new AtomicInteger(0);
-
- @Override
- public Thread newThread(Runnable r) {
- return new Thread(r, "metadata-manager-" + counter.incrementAndGet());
- }
- });
- @Setter
- private Map<Class<?>, MetadataSyncWrapper> metadataSyncWrapperMap = new HashMap<>();
- @Setter
- private RemotingManager remotingManager;
-
-
- public void register(MetadataSyncConfig metadataSyncConfig) {
- MetadataSyncWrapper metadataSyncWrapper = new MetadataSyncWrapper();
- metadataSyncWrapper.setMetadataClass(metadataSyncConfig.getMetadataClass());
- metadataSyncWrapper.setEntityClass(metadataSyncConfig.getEntityClass());
- metadataSyncWrapper.setDataBasesHandler(metadataSyncConfig.getDataBasesHandler());
- metadataSyncWrapper.setClusterService(metadataSyncConfig.getClusterService());
- metadataSyncWrapperMap.put(metadataSyncWrapper.getMetadataClass(), metadataSyncWrapper);
- }
-
- public void init(Integer initialDelay, Integer period) {
- scheduledExecutorService.scheduleAtFixedRate(this::run, initialDelay, period, TimeUnit.SECONDS);
- }
-
-
- public void run() {
- for (MetadataSyncWrapper metadataSyncWrapper : metadataSyncWrapperMap.values()) {
- // 一个MetadataSyncWrapper 一个线程
- threadPoolExecutor.execute(metadataSyncWrapper);
- }
- }
-
-
- @Data
- public static class MetadataSyncConfig {
-
- private Class<?> metadataClass;
-
- private Class<?> entityClass;
-
- private MetadataHandler dataBasesHandler;
-
- // 直接映射 api? config 是直接读取整个runtime 里面的数据
- // 还是封装一层?
- // 这里如何变简单。直接 remote api?
- private MetadataHandler clusterService;
- }
-
- @Data
- public class MetadataSyncWrapper implements Runnable {
-
- private Class<?> metadataClass;
-
- private Class<?> entityClass;
-
- private MetadataHandler dataBasesHandler;
-
- // 直接映射 api? config 是直接读取整个runtime 里面的数据
- // 还是封装一层?
- // 这里如何变简单。直接 remote api?
- private MetadataHandler clusterService;
-
- private CountDownLatch countDownLatch = new CountDownLatch(2);
-
-
- private Map<String, MetadataConfig> clusterData = new HashMap<>();
-
- private Map<String, MetadataConfig> dataBasesData = new HashMap<>();
-
- private List<MetadataConfig> toClusterUpdate = new ArrayList<>();
-
-
- private List<MetadataConfig> toDataUpdate = new ArrayList<>();
-
- private List<MetadataConfig> toDelete = new ArrayList<>();
-
- private List<MetadataConfig> toInsert = new ArrayList<>();
-
- private long lastTime = System.currentTimeMillis();
-
- @Override
- public void run() {
-
- try {
- // 全程托管,托管都需要,异步 读取 cluster 信息
- threadPoolExecutor.execute(this::syncClusterData);
- // 异步 读取数据库信息。是否进行增量处理
- threadPoolExecutor.execute(this::syncDatabasesData);
- this.lastTime = System.currentTimeMillis();
- countDownLatch.await();
- // 对读取的数据进行分类,
- this.difference();
- // 托管的进行差异化之后。进行写库。
- if (this.toInsert.isEmpty() && this.toClusterUpdate.isEmpty() && this.toDelete.isEmpty() && this.toDataUpdate.isEmpty()) {
- return;
- }
- this.toTrusteeship();
- this.toFullTrusteeship();
- // 全程托管的 cluster 存在,数据库不存在就删除。 进行删除, 新增的直接操作 cluster
-
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- } finally {
- countDownLatch = new CountDownLatch(2);
- clusterData.clear();
- dataBasesData.clear();
- }
-
-
- }
-
- public void syncClusterData() {
- try {
- List<MetadataConfig> metadataConfigList = this.clusterService.getData();
- this.arrange(this.clusterData, metadataConfigList);
- } finally {
- countDownLatch.countDown();
- }
-
- }
-
- public void syncDatabasesData() {
- try {
- List<MetadataConfig> metadataConfigList = this.dataBasesHandler.getData();
- this.arrange(this.dataBasesData, metadataConfigList);
- } finally {
- countDownLatch.countDown();
- }
- }
-
- public void arrange(Map<String, MetadataConfig> data, List<MetadataConfig> metadataConfigList) {
- for (MetadataConfig metadataConfig : metadataConfigList) {
- data.put(metadataConfig.getUnique(), metadataConfig);
- }
- }
-
- /**
- * TODO 一定要注意。这个就得是 cluster 的差集。如果要对 database 操作 就要反翻过啦
- */
- public void difference() {
-
- this.toDataUpdate = new ArrayList<>();
- this.toClusterUpdate = new ArrayList<>();
- this.toDelete = new ArrayList<>();
- this.toInsert = new ArrayList<>();
- Map<String, MetadataConfig> newClusterData = new HashMap<>(this.clusterData);
- Map<String, MetadataConfig> newDataBasesData = new HashMap<>(this.dataBasesData);
- for (Map.Entry<String, MetadataConfig> entry : newClusterData.entrySet()) {
- MetadataConfig serviceObject = newDataBasesData.remove(entry.getKey());
- if (Objects.isNull(serviceObject)) {
- toDelete.add(entry.getValue());
- } else {
- if (!serviceObject.equals(entry.getValue())) {
- this.toClusterUpdate.add(entry.getValue());
- this.toDataUpdate.add(serviceObject);
- }
- }
- }
- this.toInsert = new ArrayList<>(newDataBasesData.values());
-
- }
-
- public void toTrusteeship() {
- // 如果 update 中 cluster 与 databases 数据不一致。 以谁为主
- //
- this.dataBasesHandler.updateMetadata(this.filterTrusteeship(this.toClusterUpdate));
- this.dataBasesHandler.addMetadata(this.filterTrusteeship(this.toDelete));
- }
-
- public void toFullTrusteeship() {
- //
- this.clusterService.addMetadata(this.filterFullTrusteeship(this.toInsert));
- this.clusterService.addMetadata(this.filterFullTrusteeship(this.toDataUpdate));
- this.clusterService.deleteMetadata(this.filterTrusteeship(this.toDelete));
- }
-
- private List<MetadataConfig> filterFullTrusteeship(List<MetadataConfig> metadataConfigList) {
- return this.filter(metadataConfigList, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP);
- }
-
- private List<MetadataConfig> filterTrusteeship(List<MetadataConfig> metadataConfigList) {
- return this.filter(metadataConfigList, ClusterTrusteeshipType.TRUSTEESHIP);
- }
-
- private List<MetadataConfig> filter(List<MetadataConfig> metadataConfigList, ClusterTrusteeshipType clusterTrusteeshipType) {
- List<MetadataConfig> newMetadataConfigList = new ArrayList<>();
- for (MetadataConfig metadataConfig : metadataConfigList) {
- if (remotingManager.isClusterTrusteeshipType(metadataConfig.getClusterId(), clusterTrusteeshipType)) {
- newMetadataConfigList.add(metadataConfig);
- }
- }
- return newMetadataConfigList;
- }
- }
-
-}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncWrapper.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncWrapper.java
new file mode 100644
index 0000000..80c0494
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncWrapper.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.metadata;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType.FirstToWhom;
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
+import org.apache.eventmesh.dashboard.core.metadata.MetadataSyncManage.MetadataSyncConfig;
+import org.apache.eventmesh.dashboard.core.metadata.difference.BodyDataDifference;
+import org.apache.eventmesh.dashboard.core.metadata.difference.BothDifference;
+import org.apache.eventmesh.dashboard.core.metadata.difference.BufferDifference;
+import org.apache.eventmesh.dashboard.core.metadata.difference.NotDifference;
+import org.apache.eventmesh.dashboard.core.metadata.result.MetadataSyncResult;
+import org.apache.eventmesh.dashboard.core.metadata.result.MetadataSyncResultHandler;
+
+import java.util.Objects;
+import java.util.Random;
+
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+
+@Data
+@Slf4j
+public class MetadataSyncWrapper implements Runnable {
+
+ private MetadataSyncResultHandler metadataSyncResultHandler;
+
+ private MetadataSyncConfig metadataSyncConfig;
+
+ private BaseSyncBase baseSyncBase;
+
+ private NotDifference notDifference;
+
+ private BodyDataDifference bodyDataDifference;
+
+ private BufferDifference bufferDifference;
+
+ private BothDifference bothDifference;
+
+
+ private volatile boolean check = false;
+
+ private long intervalTime;
+
+ private long checkTime;
+
+ private int fistSyncRetry = 0;
+
+
+ public void createDifference() {
+ this.baseSyncBase = this.metadataSyncConfig.getBaseSyncBase();
+ if (this.readOnly()) {
+ NotDifference notDifference = new NotDifference();
+ notDifference.setSourceHandler(this.metadataSyncConfig.getClusterService());
+ notDifference.setTargetHandler(this.metadataSyncConfig.getDataBasesHandler());
+ this.notDifference = notDifference;
+ return;
+ }
+ this.intervalTime = 1000 * 60 * 60 + new Random().nextInt(10000);
+
+ this.checkTime = System.currentTimeMillis() - intervalTime;
+ BodyDataDifference bodyDataDifference = new BodyDataDifference();
+ bodyDataDifference.setSourceHandler(this.metadataSyncConfig.getClusterService());
+ bodyDataDifference.setTargetHandler(this.metadataSyncConfig.getDataBasesHandler());
+ this.bodyDataDifference = bodyDataDifference;
+
+ BufferDifference bufferDifference = new BufferDifference();
+ bufferDifference.setSourceHandler(this.metadataSyncConfig.getDataBasesHandler());
+ bufferDifference.setTargetHandler(this.metadataSyncConfig.getClusterService());
+ this.bufferDifference = bufferDifference;
+
+ BothDifference bothDifference = new BothDifference();
+ if (this.metadataSyncConfig.getClusterServiceType().isSelf()) {
+ bothDifference.setSourceHandler(this.metadataSyncConfig.getDataBasesHandler());
+ bothDifference.setTargetHandler(this.metadataSyncConfig.getClusterService());
+ } else {
+ bothDifference.setSourceHandler(this.metadataSyncConfig.getClusterService());
+ bothDifference.setTargetHandler(this.metadataSyncConfig.getDataBasesHandler());
+ }
+ this.bufferDifference = bufferDifference;
+ }
+
+
+ @Override
+ public void run() {
+ MetadataSyncResult metadataSyncResult = this.metadataSyncConfig.getMetadataSyncResult();
+ try {
+ long lastTime = System.currentTimeMillis();
+ if (this.fistSyncRetry >= 5) {
+ log.error("baseSyncBase {} fistSyncRetry 5", baseSyncBase.getId());
+ }
+ if (this.readOnly()) {
+ this.notDifference.difference();
+ } else if (this.check()) {
+ this.bothDifference.difference();
+ } else if (this.isSyncClusterData()) {
+ this.bufferDifference.difference();
+ } else if (this.isSyncDatabasesData()) {
+ this.bodyDataDifference.difference();
+ }
+ if (Objects.equals(baseSyncBase.getFirstSyncState(), FirstToWhom.UNDER_WAY)) {
+ baseSyncBase.setFirstSyncState(FirstToWhom.COMPLETE);
+ metadataSyncResult.setFirstToWhom(FirstToWhom.COMPLETE);
+ }
+ } catch (Exception e) {
+ // 失败三次,停止同步吗?
+ if (Objects.equals(baseSyncBase.getFirstSyncState(), FirstToWhom.UNDER_WAY)) {
+ this.fistSyncRetry++;
+ baseSyncBase.setFirstSyncState(FirstToWhom.WAIT_START);
+ metadataSyncResult.setFirstToWhom(FirstToWhom.FAIL);
+ }
+ log.error(e.getMessage(), e);
+ } finally {
+ this.metadataSyncResultHandler.handleMetadataSyncResult(metadataSyncResult);
+ }
+ }
+
+
+ private boolean readOnly() {
+ return this.metadataSyncConfig.getMetadataType().isReadOnly();
+ }
+
+ private boolean check() {
+ if (!this.check) {
+ return false;
+ }
+ if (System.currentTimeMillis() < this.checkTime) {
+ return false;
+ }
+ this.checkTime = System.currentTimeMillis() + this.intervalTime;
+ return true;
+ }
+
+
+ private boolean isSyncClusterData() {
+ if (Objects.equals(baseSyncBase.getFirstToWhom(), FirstToWhom.RUNTIME)
+ && Objects.equals(baseSyncBase.getFirstSyncState(), FirstToWhom.WAIT_START)) {
+ baseSyncBase.setFirstSyncState(FirstToWhom.UNDER_WAY);
+ return true;
+ }
+ if (Objects.equals(baseSyncBase.getTrusteeshipType(), ClusterTrusteeshipType.SELF)) {
+ return true;
+ }
+ return Objects.equals(baseSyncBase.getTrusteeshipType(), ClusterTrusteeshipType.TRUSTEESHIP);
+
+ }
+
+ private boolean isSyncDatabasesData() {
+ if (Objects.equals(baseSyncBase.getFirstToWhom(), FirstToWhom.DASHBOARD)
+ && !Objects.equals(baseSyncBase.getFirstSyncState(), FirstToWhom.WAIT_START)) {
+ baseSyncBase.setFirstSyncState(FirstToWhom.UNDER_WAY);
+ return true;
+ }
+ if (Objects.equals(baseSyncBase.getTrusteeshipType(), ClusterTrusteeshipType.TRUSTEESHIP_FIND)) {
+ return true;
+ }
+ return Objects.equals(baseSyncBase.getTrusteeshipType(), ClusterTrusteeshipType.TRUSTEESHIP_FIND_REVERSE);
+ }
+
+}
\ No newline at end of file
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/SyncMetadataCreateFactory.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/SyncMetadataCreateFactory.java
new file mode 100644
index 0000000..260f95e
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/SyncMetadataCreateFactory.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.metadata;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterFramework;
+import org.apache.eventmesh.dashboard.common.enums.ClusterSyncMetadataEnum;
+import org.apache.eventmesh.dashboard.common.enums.MetadataType;
+import org.apache.eventmesh.dashboard.common.model.ConvertMetaData;
+import org.apache.eventmesh.dashboard.common.model.DatabaseAndMetadataMapper;
+import org.apache.eventmesh.dashboard.common.model.base.BaseClusterIdBase;
+import org.apache.eventmesh.dashboard.common.model.base.BaseRuntimeIdBase;
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
+import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * MetadataHandler。 读写行为 每个 runtime or cluster 。所有 MetadataType 的 MetadataHandler 已经关系 从 runtime(Cluster) -> 读 -> createDataMetadataHandler 缓存 -> 定时写
+ * 从 db 定时读 发动 -> SyncMetadataCreateFactory -> createDataMetadataHandler 获得 runtime 或则 cluster 维度数据,在写入 runtime 1000个节点,进行一千次db操作, db直接费了。
+ */
+public class SyncMetadataCreateFactory {
+
+ @Setter
+ private DataMetadataHandler<Object> dataMetadataHandler;
+
+ @Setter
+ private MetadataType metadataType;
+
+ @Getter
+ @Setter
+ private ConvertMetaData<Object, BaseClusterIdBase> convertMetaData;
+
+
+ @Getter
+ @Setter
+ private DatabaseAndMetadataMapper databaseAndMetadataMapper;
+
+ private final Map<Long, List<BaseClusterIdBase>> runtimeMetadataMap = new ConcurrentHashMap<>();
+
+ private final Map<Long, List<BaseClusterIdBase>> clusterMetadataMap = new ConcurrentHashMap<>();
+
+ private List<Object> addData = new ArrayList<>();
+
+ private List<Object> updateData = new ArrayList<>();
+
+ private List<Object> deleteData = new ArrayList<>();
+
+ public void loadData() {
+ // TODO 加载的时候, 目前永远不会加载 Runtime
+ if (metadataType.isReadOnly()) {
+ return;
+ }
+
+ dataMetadataHandler.getData().forEach(data -> {
+ BaseRuntimeIdBase baseRuntimeIdBase = (BaseRuntimeIdBase) this.convertMetaData.toMetaData(data);
+ ClusterFramework clusterFramework =
+ ClusterSyncMetadataEnum.getClusterFramework(baseRuntimeIdBase.getClusterType());
+ if (clusterFramework.isCAP()) {
+ this.clusterMetadataMap.computeIfAbsent(baseRuntimeIdBase.getClusterId(), (value) -> new ArrayList<>()).add(baseRuntimeIdBase);
+ } else {
+ this.runtimeMetadataMap.computeIfAbsent(baseRuntimeIdBase.getRuntimeId(), (value) -> new ArrayList<>()).add(baseRuntimeIdBase);
+ }
+ });
+
+ }
+
+ public void persistence() {
+ if (this.deleteData.isEmpty() && this.updateData.isEmpty() && this.clusterMetadataMap.isEmpty()) {
+ return;
+ }
+ this.dataMetadataHandler.handleAll(this.addData, this.updateData, this.deleteData);
+ this.addData = new ArrayList<>();
+ this.updateData = new ArrayList<>();
+ this.deleteData = new ArrayList<>();
+ }
+
+ public MetadataHandler<BaseClusterIdBase> createDataMetadataHandler(BaseSyncBase baseSyncBase) {
+ Map<Long, List<BaseClusterIdBase>> mapetadataMap =
+ Objects.equals(baseSyncBase.getClass(), RuntimeMetadata.class) ? this.runtimeMetadataMap : this.clusterMetadataMap;
+
+ return new MetadataHandler<BaseClusterIdBase>() {
+ @Override
+ public void addMetadata(BaseClusterIdBase meta) {
+ SyncMetadataCreateFactory.this.addData.add(SyncMetadataCreateFactory.this.convertMetaData.toEntity(meta));
+ }
+
+ @Override
+ public void deleteMetadata(BaseClusterIdBase meta) {
+ SyncMetadataCreateFactory.this.deleteData.add(SyncMetadataCreateFactory.this.convertMetaData.toEntity(meta));
+ }
+
+ @Override
+ public void updateMetadata(BaseClusterIdBase meta) {
+ SyncMetadataCreateFactory.this.updateData.add(meta);
+ }
+
+ @Override
+ public void handleAll(List<BaseClusterIdBase> addData, List<BaseClusterIdBase> updateData, List<BaseClusterIdBase> deleteData) {
+ this.addAll(SyncMetadataCreateFactory.this.addData, addData);
+ this.addAll(SyncMetadataCreateFactory.this.updateData, updateData);
+ this.addAll(SyncMetadataCreateFactory.this.deleteData, deleteData);
+ }
+
+ private void addAll(List<Object> persistenceData, List<BaseClusterIdBase> handleData) {
+ handleData.forEach(data -> {
+ persistenceData.add(SyncMetadataCreateFactory.this.convertMetaData.toEntity(data));
+ });
+ }
+
+ @Override
+ public List<BaseClusterIdBase> getData() {
+ return mapetadataMap.remove(baseSyncBase.getId());
+ }
+
+ };
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/UpdateMetadataHandler.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/UpdateMetadataHandler.java
new file mode 100644
index 0000000..90c0755
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/UpdateMetadataHandler.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.metadata;
+
+import java.util.List;
+
+/**
+ *
+ */
+public interface UpdateMetadataHandler<T> {
+
+
+ //metaData: topic, center, etc. add meta is to create a topic.
+ void addMetadata(T meta);
+
+ default void addMetadata(List<T> meta) {
+ if (meta != null) {
+ meta.forEach(this::addMetadata);
+ }
+ }
+
+ default void addMetadataObject(List<Object> meta) {
+ if (meta != null) {
+ meta.forEach(t -> addMetadata((T) t));
+ }
+ }
+
+ default void replaceMetadata(List<Object> meta) {
+ if (meta != null) {
+ deleteMetadata((List<T>) meta);
+ addMetadataObject(meta);
+ }
+ }
+
+ default void updateMetadata(T meta) {
+ this.addMetadata(meta);
+ }
+
+ /**
+ * If this handler is db handler, do implement this method to improve performance
+ *
+ * @param meta
+ */
+ default void updateMetadata(List<T> meta) {
+ if (meta != null) {
+ meta.forEach(this::updateMetadata);
+ }
+ }
+
+ void deleteMetadata(T meta);
+
+ default void deleteMetadata(List<T> meta) {
+ if (meta != null) {
+ meta.forEach(this::deleteMetadata);
+ }
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AbstractMetadataHandler.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AbstractMetadataHandler.java
deleted file mode 100644
index 939dd8a..0000000
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AbstractMetadataHandler.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.metadata.cluster;
-
-import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
-import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler;
-import org.apache.eventmesh.dashboard.core.remoting.RemotingManager;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import lombok.Setter;
-
-public abstract class AbstractMetadataHandler<T, S, RE> implements MetadataHandler<T>, RemotingManager.RemotingRequestWrapper<S, RE> {
-
-
- protected S request;
- @Setter
- private RemotingManager remotingManager;
-
- public void init() {
- this.request = (S) remotingManager.getProxyObject();
- }
-
-
- /**
- * 同步的时候,只同步runtime 的数据,还是会同步 storage 的数据。这个可以进行配置。
- *
- * @return
- */
- @Override
- public List<T> getData() {
- List<RemotingManager.RemotingWrapper> remotingWrapperList = new ArrayList<>();
- remotingWrapperList.addAll(
- remotingManager.getEventMeshClusterDO(ClusterTrusteeshipType.TRUSTEESHIP, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP));
- remotingWrapperList.addAll(
- remotingManager.getStorageCluster(ClusterTrusteeshipType.TRUSTEESHIP, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP));
- return remotingManager.request(this,
- remotingManager.getEventMeshClusterDO(ClusterTrusteeshipType.TRUSTEESHIP, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP));
- }
-
-}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AclSyncFromClusterService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AclSyncFromClusterService.java
deleted file mode 100644
index 98ec6aa..0000000
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AclSyncFromClusterService.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.metadata.cluster;
-
-import org.apache.eventmesh.dashboard.common.model.metadata.AclMetadata;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult;
-import org.apache.eventmesh.dashboard.common.model.remoting.acl.GetAclsRequest;
-import org.apache.eventmesh.dashboard.service.remoting.AclRemotingService;
-
-import java.util.List;
-
-import org.springframework.stereotype.Service;
-
-import lombok.Setter;
-
-@Service
-public class AclSyncFromClusterService extends AbstractMetadataHandler<AclMetadata, AclRemotingService, GetAclsRequest> {
-
- @Setter
- private AclRemotingService aclRemotingService;
-
- @Override
- public void addMetadata(AclMetadata meta) {
-
- }
-
- @Override
- public void deleteMetadata(AclMetadata meta) {
-
- }
-
-
- @Override
- public List<AclMetadata> getData(GlobalRequest globalRequest) {
- GetAclsRequest getAclsRequest = new GetAclsRequest();
- getAclsRequest.setClusterId(globalRequest.getClusterId());
- return (List<AclMetadata>) this.request(this.request, getAclsRequest).getData();
- }
-
-
- @Override
- public GlobalResult request(AclRemotingService key, GetAclsRequest getAclsRequest) {
- return key.getAllAcls(getAclsRequest);
- }
-}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/ConfigSyncFromClusterService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/ConfigSyncFromClusterService.java
deleted file mode 100644
index b8ffab6..0000000
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/ConfigSyncFromClusterService.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.metadata.cluster;
-
-import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult;
-import org.apache.eventmesh.dashboard.common.model.remoting.config.GetConfigRequest;
-import org.apache.eventmesh.dashboard.service.remoting.ConfigRemotingService;
-
-import java.util.List;
-
-import org.springframework.stereotype.Service;
-
-import lombok.Setter;
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Service
-public class ConfigSyncFromClusterService extends AbstractMetadataHandler<ConfigMetadata, ConfigRemotingService, GetConfigRequest> {
-
- @Setter
- ConfigRemotingService configRemotingService;
-
- @Override
- public void addMetadata(ConfigMetadata meta) {
-
- }
-
- @Override
- public void deleteMetadata(ConfigMetadata meta) {
-
- }
-
- @Override
- public List<ConfigMetadata> getData() {
- // topic
- // group
- // runtime
- // broker
-
- return null;
- }
-
- @Override
- public List<ConfigMetadata> getData(GlobalRequest globalRequest) {
- return null;
- }
-
-
- @Override
- public GlobalResult request(ConfigRemotingService configRemotingService, GetConfigRequest key) {
- return null;
- }
-}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/GroupSyncFromClusterService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/GroupSyncFromClusterService.java
deleted file mode 100644
index bae1ad1..0000000
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/GroupSyncFromClusterService.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.metadata.cluster;
-
-import org.apache.eventmesh.dashboard.common.model.metadata.GroupMetadata;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult;
-import org.apache.eventmesh.dashboard.common.model.remoting.group.GetGroupsRequest;
-import org.apache.eventmesh.dashboard.core.remoting.RemotingManager;
-import org.apache.eventmesh.dashboard.service.remoting.GroupRemotingService;
-
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-public class GroupSyncFromClusterService extends AbstractMetadataHandler<GroupMetadata, GroupRemotingService, GetGroupsRequest> {
-
- @Autowired
- private RemotingManager remotingManager;
-
- @Override
- public void addMetadata(GroupMetadata meta) {
-
- }
-
- @Override
- public void deleteMetadata(GroupMetadata meta) {
-
- }
-
- @Override
- public List<GroupMetadata> getData() {
- List<GroupMetadata> eventMeshGroupList = this.remotingManager.request(this, remotingManager.getEventMeshClusterDO());
- //List<GroupMetadata> rocketMQMeshGroupList = this.remotingManager.request(this,remotingManager.getRocketMQClusterDO() );
- //eventMeshGroupList.addAll(rocketMQMeshGroupList);
- return eventMeshGroupList;
- }
-
- @Override
- public List<GroupMetadata> getData(GlobalRequest globalRequest) {
- return null;
- }
-
- @Override
- public GlobalResult request(GroupRemotingService groupRemotingService, GetGroupsRequest key) {
- return null;
- }
-}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/RuntimeSyncFromClusterService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/RuntimeSyncFromClusterService.java
deleted file mode 100644
index f9d3249..0000000
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/RuntimeSyncFromClusterService.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.metadata.cluster;
-
-import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult;
-import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeRequest;
-import org.apache.eventmesh.dashboard.service.remoting.RuntimeRemotingService;
-
-import java.util.List;
-
-import org.springframework.stereotype.Service;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Service
-public class RuntimeSyncFromClusterService extends AbstractMetadataHandler<RuntimeMetadata, RuntimeRemotingService, GetRuntimeRequest> {
-
-
- @Override
- public void addMetadata(RuntimeMetadata meta) {
-
- }
-
- @Override
- public void deleteMetadata(RuntimeMetadata meta) {
-
- }
-
- @Override
- public List<RuntimeMetadata> getData(GlobalRequest globalRequest) {
- GetRuntimeRequest getRuntimeRequest = new GetRuntimeRequest();
- getRuntimeRequest.setClusterId(globalRequest.getClusterId());
- return (List<RuntimeMetadata>) this.request(this.request, getRuntimeRequest).getData();
- }
-
- @Override
- public GlobalResult request(RuntimeRemotingService runtimeRemotingService, GetRuntimeRequest key) {
- return runtimeRemotingService.getRuntimeMetadata(key);
- }
-}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/TopicSyncFromClusterService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/TopicSyncFromClusterService.java
deleted file mode 100644
index a12dee5..0000000
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/TopicSyncFromClusterService.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.metadata.cluster;
-
-import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult;
-import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsRequest;
-import org.apache.eventmesh.dashboard.service.remoting.TopicRemotingService;
-
-import java.util.List;
-
-import org.springframework.stereotype.Service;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Service
-public class TopicSyncFromClusterService extends AbstractMetadataHandler<TopicMetadata, TopicRemotingService, GetTopicsRequest> {
-
- @Override
- public void addMetadata(TopicMetadata meta) {
-
- }
-
- @Override
- public void deleteMetadata(TopicMetadata meta) {
-
- }
-
-
- @Override
- public List<TopicMetadata> getData(GlobalRequest globalRequest) {
- return null;
- }
-
-
- @Override
- public GlobalResult request(TopicRemotingService topicRemotingService, GetTopicsRequest key) {
- return null;
- }
-}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/AbstractBothDifference.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/AbstractBothDifference.java
new file mode 100644
index 0000000..5ea6c5a
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/AbstractBothDifference.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.metadata.difference;
+
+import org.apache.eventmesh.dashboard.common.model.base.BaseClusterIdBase;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+public abstract class AbstractBothDifference extends AbstractBufferDifference {
+
+
+ protected Map<String, BaseClusterIdBase> difference(List<BaseClusterIdBase> sourcetList, List<BaseClusterIdBase> targetList) {
+ Map<String, BaseClusterIdBase> targetAllData = new HashMap<>();
+ targetList.forEach((value) -> {
+ targetAllData.put(value.nodeUnique(), value);
+ });
+ return this.difference(sourcetList, targetAllData);
+ }
+
+ /**
+ * database 与 cluster 求结果
+ */
+ protected Map<String, BaseClusterIdBase> difference(List<BaseClusterIdBase> sourcetList, Map<String, BaseClusterIdBase> targetAllData) {
+ if (sourcetList.isEmpty()) {
+ return targetAllData;
+ }
+ Map<String, BaseClusterIdBase> newAllData = new HashMap<>();
+ sourcetList.forEach((value) -> {
+ String key = value.nodeUnique();
+ BaseClusterIdBase oldValue = this.allData.remove(key);
+ if (Objects.isNull(oldValue)) {
+ this.insertData.add(value);
+ newAllData.put(key, value);
+ } else if (!Objects.equals(oldValue, value)) {
+ this.updateData.add(value);
+ newAllData.put(key, value);
+ } else {
+ newAllData.put(key, value);
+ }
+
+ });
+ this.deleteData.addAll(this.allData.values());
+ return newAllData;
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/AbstractBufferDifference.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/AbstractBufferDifference.java
new file mode 100644
index 0000000..eaf3b70
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/AbstractBufferDifference.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.metadata.difference;
+
+import org.apache.eventmesh.dashboard.common.model.base.BaseClusterIdBase;
+import org.apache.eventmesh.dashboard.core.metadata.DataMetadataHandler;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import lombok.Getter;
+import lombok.Setter;
+
+public abstract class AbstractBufferDifference extends AbstractDifference implements DataMetadataHandler<BaseClusterIdBase> {
+
+ @Getter
+ @Setter
+ protected Map<String, BaseClusterIdBase> allData = new HashMap<>();
+
+
+ public void handleAll(List<BaseClusterIdBase> addData, List<BaseClusterIdBase> updateData, List<BaseClusterIdBase> deleteData) {
+ this.targetHandler.handleAll(addData, updateData, deleteData);
+ }
+
+ /**
+ * BothDifference 是否进行一次识别
+ *
+ * @return
+ */
+ public List<BaseClusterIdBase> getData() {
+ return new ArrayList<>(allData.values());
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/AbstractDifference.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/AbstractDifference.java
new file mode 100644
index 0000000..dcce7f7
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/AbstractDifference.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.metadata.difference;
+
+import org.apache.eventmesh.dashboard.common.model.base.BaseClusterIdBase;
+import org.apache.eventmesh.dashboard.core.metadata.DataMetadataHandler;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import lombok.Setter;
+
+public abstract class AbstractDifference implements Difference<BaseClusterIdBase> {
+
+
+ protected Map<String, BaseClusterIdBase> allData = new HashMap<>();
+
+
+ protected List<BaseClusterIdBase> deleteData = new ArrayList<>();
+
+ protected List<BaseClusterIdBase> insertData = new ArrayList<>();
+
+ protected List<BaseClusterIdBase> updateData = new ArrayList<>();
+
+ @Setter
+ protected DataMetadataHandler<BaseClusterIdBase> sourceHandler;
+
+ @Setter
+ protected DataMetadataHandler<BaseClusterIdBase> targetHandler;
+
+
+ @Override
+ public void difference() {
+ try {
+ this.doDifference();
+ targetHandler.handleAll(this.insertData, this.updateData, this.deleteData);
+ } catch (Exception e) {
+ // TODO
+ } finally {
+ this.closeUpdate();
+ }
+ }
+
+ public void closeAll() {
+ this.allData.clear();
+ }
+
+ public void closeUpdate() {
+ this.deleteData.clear();
+ this.updateData.clear();
+ this.insertData.clear();
+ }
+
+
+ abstract void doDifference();
+
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/BodyDataDifference.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/BodyDataDifference.java
new file mode 100644
index 0000000..35faa6a
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/BodyDataDifference.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.metadata.difference;
+
+
+import org.apache.eventmesh.dashboard.common.model.base.BaseClusterIdBase;
+
+import java.util.List;
+
+public class BodyDataDifference extends AbstractBufferDifference {
+
+
+ @Override
+ void doDifference() {
+ List<BaseClusterIdBase> objectList = sourceHandler.getData();
+ if (objectList.isEmpty()) {
+ return;
+ }
+ objectList.forEach((value) -> {
+ String key = value.nodeUnique();
+ if (value.isInsert()) {
+ this.insertData.add(value);
+ this.allData.put(key, value);
+ } else if (value.isUpdate()) {
+ this.updateData.add(value);
+ this.allData.put(key, value);
+ } else if (value.isDelete()) {
+ this.deleteData.add(value);
+ this.allData.remove(key);
+ }
+ });
+
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/BothDifference.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/BothDifference.java
new file mode 100644
index 0000000..c8a2376
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/BothDifference.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.metadata.difference;
+
+import org.apache.eventmesh.dashboard.common.model.base.BaseClusterIdBase;
+
+import org.apache.commons.collections4.CollectionUtils;
+
+import java.util.List;
+
+public class BothDifference extends AbstractBothDifference {
+
+ @Override
+ void doDifference() {
+ List<BaseClusterIdBase> sourcetList = sourceHandler.getData();
+ List<BaseClusterIdBase> targetList = targetHandler.getData();
+ if (CollectionUtils.isEmpty(sourcetList)) {
+ /**
+ * TODO
+ * 有这种极端环境吗?
+ * 两边都删除 缓存为空
+ *
+ */
+ this.deleteData.addAll(targetList);
+ } else if (targetList.isEmpty()) {
+ // TODO 全量加入缓存
+ this.insertData.addAll(sourcetList);
+ targetList.forEach((value) -> {
+ this.allData.put(value.nodeUnique(), value);
+ });
+ }
+ this.allData = this.difference(sourcetList, targetList);
+ }
+}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/BufferDifference.java
similarity index 69%
rename from eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java
rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/BufferDifference.java
index 2e63772..6f77a45 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/BufferDifference.java
@@ -15,21 +15,19 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.service.store;
-import org.apache.eventmesh.dashboard.service.dto.TopicProperties;
+package org.apache.eventmesh.dashboard.core.metadata.difference;
+
+import org.apache.eventmesh.dashboard.common.model.base.BaseClusterIdBase;
import java.util.List;
-/**
- * Manage topics of eventmesh-storage-plugin (EventMesh Store).
- */
+public class BufferDifference extends AbstractBothDifference {
-public interface TopicCore {
- List<TopicProperties> getTopics();
-
- Boolean createTopic(String topicName);
-
- Boolean deleteTopic(String topicName);
+ @Override
+ void doDifference() {
+ List<BaseClusterIdBase> sourcetList = sourceHandler.getData();
+ this.difference(sourcetList, allData);
+ }
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingOperate.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/Difference.java
similarity index 85%
copy from eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingOperate.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/Difference.java
index 24cf7f8..733b33e 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingOperate.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/Difference.java
@@ -15,13 +15,15 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.service.remoting;
-public enum RemotingOperate {
+package org.apache.eventmesh.dashboard.core.metadata.difference;
- ADD,
+/**
+ *
+ */
+public interface Difference<T> {
- UPDATE,
- DELETE;
+ void difference();
+
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/NotDifference.java
similarity index 68%
copy from eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/NotDifference.java
index 2e63772..0542120 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/difference/NotDifference.java
@@ -15,21 +15,18 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.service.store;
-import org.apache.eventmesh.dashboard.service.dto.TopicProperties;
+package org.apache.eventmesh.dashboard.core.metadata.difference;
+
+import org.apache.eventmesh.dashboard.common.model.base.BaseClusterIdBase;
import java.util.List;
-/**
- * Manage topics of eventmesh-storage-plugin (EventMesh Store).
- */
+public class NotDifference extends AbstractDifference {
-public interface TopicCore {
-
- List<TopicProperties> getTopics();
-
- Boolean createTopic(String topicName);
-
- Boolean deleteTopic(String topicName);
+ @Override
+ void doDifference() {
+ List<BaseClusterIdBase> bothDifferenceList = this.sourceHandler.getData();
+ this.insertData.addAll(bothDifferenceList);
+ }
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/request/RuntimeDataRequest.java
similarity index 84%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/request/RuntimeDataRequest.java
index 82e6c7f..f823609 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/request/RuntimeDataRequest.java
@@ -15,12 +15,13 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.core.metadata.request;
-@Data
-public class GlobalRequest {
+@Deprecated
+public class RuntimeDataRequest {
- private Long clusterId;
+
+ private Long runtimeId;
+
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/result/MetadataSyncResult.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/result/MetadataSyncResult.java
new file mode 100644
index 0000000..fab2ded
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/result/MetadataSyncResult.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.metadata.result;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
+import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType.FirstToWhom;
+import org.apache.eventmesh.dashboard.common.enums.MetadataType;
+import org.apache.eventmesh.dashboard.common.enums.SyncErrorType;
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
+
+import lombok.Data;
+
+
+@Data
+public class MetadataSyncResult {
+
+ private String key;
+
+ private BaseSyncBase baseSyncBase;
+
+ private MetadataType metadataType;
+
+ private ClusterTrusteeshipType clusterTrusteeshipType;
+
+ private SyncErrorType syncErrorType;
+
+ private FirstToWhom firstToWhom = FirstToWhom.NOT;
+
+ private boolean success = false;
+
+
+}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/result/MetadataSyncResultHandler.java
similarity index 67%
copy from eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/result/MetadataSyncResultHandler.java
index 2e63772..2ade570 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/result/MetadataSyncResultHandler.java
@@ -15,21 +15,26 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.service.store;
-import org.apache.eventmesh.dashboard.service.dto.TopicProperties;
+package org.apache.eventmesh.dashboard.core.metadata.result;
+
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
import java.util.List;
/**
- * Manage topics of eventmesh-storage-plugin (EventMesh Store).
+ *
*/
+public interface MetadataSyncResultHandler {
-public interface TopicCore {
- List<TopicProperties> getTopics();
+ void register(List<MetadataSyncResult> metadataSyncResults);
- Boolean createTopic(String topicName);
+ void unregister(BaseSyncBase baseSyncBase);
- Boolean deleteTopic(String topicName);
+ void handleMetadataSyncResult(MetadataSyncResult metadataSyncResult);
+
+ void persistence();
+
+
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/AbstractRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/AbstractRemotingService.java
index f15ee08..1db0f48 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/AbstractRemotingService.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/AbstractRemotingService.java
@@ -15,85 +15,21 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.remoting;
-import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
-import org.apache.eventmesh.dashboard.core.cluster.ClusterDO;
-import org.apache.eventmesh.dashboard.core.cluster.ColonyDO;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import com.alibaba.fastjson.JSONObject;
-
-import lombok.Setter;
+import org.apache.eventmesh.dashboard.core.function.SDK.AbstractClientInfo;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
/**
* 默认是一个集群,操作是基于集群操作还是单个操作
*/
-public abstract class AbstractRemotingService {
-
- @Setter
- protected ColonyDO colonyDO;
-
- protected ClusterDO clusterDO;
+public abstract class AbstractRemotingService<T> extends AbstractClientInfo<T> {
- public void init() {
- this.clusterDO = colonyDO.getClusterDO();
- this.createConfig();
- this.doInit();
+ @Override
+ protected SDKTypeEnum getSDKTypeEnum() {
+ return SDKTypeEnum.ADMIN;
}
- public abstract void createConfig();
-
- public List<String> getMeta() {
- List<String> list = new ArrayList<>();
- for (ColonyDO c : colonyDO.getMetaColonyDOList().values()) {
- for (RuntimeMetadata runtimeMetadata : c.getClusterDO().getRuntimeMap().values()) {
- list.add(runtimeMetadata.getHost() + ":" + runtimeMetadata.getPort());
- }
- }
- return list;
- }
-
- public String getMetaString() {
- StringBuilder sb = new StringBuilder();
- List<String> list = new ArrayList<>();
- for (ColonyDO c : colonyDO.getMetaColonyDOList().values()) {
- for (RuntimeMetadata runtimeMetadata : c.getClusterDO().getRuntimeMap().values()) {
- sb.append(runtimeMetadata.getHost() + ":" + runtimeMetadata.getPort());
- sb.append(";");
- }
- }
- return sb.substring(0, sb.length() - 1);
- }
-
- public void update() {
-
- }
-
- public Long getClusterId() {
- return clusterDO.getClusterInfo().getClusterId();
- }
-
- public Long getId() {
- return clusterDO.getClusterInfo().getId();
- }
-
- public <T> T toDataOjbect(Object object, Class<?> clazz) {
- if (object instanceof JSONObject) {
- JSONObject jsonObject = (JSONObject) object;
- return (T) jsonObject.toJavaObject(clazz);
- } else if (object instanceof String) {
- return (T) JSONObject.parseObject((String) object, clazz);
- } else if (object instanceof Map) {
- return null;
- }
- return null;
- }
-
-
- protected abstract void doInit();
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/Remoting2Manage.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/Remoting2Manage.java
new file mode 100644
index 0000000..e05592a
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/Remoting2Manage.java
@@ -0,0 +1,228 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.remoting;
+
+import org.apache.eventmesh.dashboard.common.annotation.RemotingServiceMapper;
+import org.apache.eventmesh.dashboard.common.annotation.RemotingServiceMethodMapper;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.model.base.BaseClusterIdBase;
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
+import org.apache.eventmesh.dashboard.common.model.remoting.AbstractGlobal2Request;
+import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult;
+import org.apache.eventmesh.dashboard.common.model.remoting.RemotingActionType;
+import org.apache.eventmesh.dashboard.common.util.ClasspathScanner;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKManage;
+import org.apache.eventmesh.dashboard.core.metadata.DataMetadataHandler;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.ArrayUtils;
+
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+
+import lombok.extern.slf4j.Slf4j;
+
+
+@Slf4j
+public class Remoting2Manage {
+
+ private static final Remoting2Manage INSTANCE = new Remoting2Manage();
+
+ private static final Map<ClusterType, Map<Class<?>, RemotingServiceMetadataWrapper>> REMOTING_SERVICE_METADATA_WRAPPER_MAP = new HashMap<>();
+
+ private static final Map<Class<?>, Map<RemotingActionType, RemotingServiceMethodMapperWrapper>> CLASS_METHOD_MAPPER = new HashMap<>();
+
+ static {
+ ClasspathScanner classpathScanner = ClasspathScanner.builder().base(Remoting2Manage.class).subPath("/**").build();
+ try {
+ classpathScanner.getClazz().forEach(Remoting2Manage::registerService);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void registerService(Class<?> clazz) {
+ if (ArrayUtils.isEmpty(clazz.getInterfaces())) {
+ return;
+ }
+ if (Objects.isNull(clazz.getSuperclass())) {
+ return;
+ }
+ RemotingServiceMapper remotingServiceMapper = clazz.getSuperclass().getAnnotation(RemotingServiceMapper.class);
+ if (Objects.isNull(remotingServiceMapper)) {
+ return;
+ }
+ final Class<?> interfaces = clazz.getInterfaces()[0];
+
+ final Map<Class<?>, RemotingServiceMetadataWrapper> remotingServiceMetadataWrapperMap =
+ REMOTING_SERVICE_METADATA_WRAPPER_MAP.computeIfAbsent(remotingServiceMapper.clusterType(), k -> new ConcurrentHashMap<>());
+
+ RemotingServiceMetadataWrapper remotingServiceMetadataWrapper = new RemotingServiceMetadataWrapper();
+ remotingServiceMetadataWrapper.clusterType = remotingServiceMapper.clusterType();
+ remotingServiceMetadataWrapper.remotingServiceType = clazz;
+ remotingServiceMetadataWrapper.remotingServiceMapper = remotingServiceMapper;
+ remotingServiceMetadataWrapper.targetClass = interfaces;
+ remotingServiceMetadataWrapperMap.put(interfaces, remotingServiceMetadataWrapper);
+
+ Map<RemotingActionType, RemotingServiceMethodMapperWrapper> actionMap = CLASS_METHOD_MAPPER.get(interfaces);
+ if (Objects.isNull(actionMap)) {
+ actionMap = new HashMap<>();
+ CLASS_METHOD_MAPPER.put(interfaces, actionMap);
+ Method[] methods = interfaces.getMethods();
+ for (Method method : methods) {
+ RemotingServiceMethodMapper remotingServiceMethodMappers = method.getAnnotation(RemotingServiceMethodMapper.class);
+ if (Objects.isNull(remotingServiceMethodMappers)) {
+ continue;
+ }
+ RemotingServiceMethodMapperWrapper remotingServiceMethodMapperWrapper = new RemotingServiceMethodMapperWrapper();
+ remotingServiceMethodMapperWrapper.remotingServiceMethod = method;
+
+ for (RemotingActionType remotingActionType : remotingServiceMethodMappers.value()) {
+ actionMap.put(remotingActionType, remotingServiceMethodMapperWrapper);
+ }
+
+ Class<?>[] clazzs = method.getParameterTypes();
+ if (ArrayUtils.isNotEmpty(clazzs)) {
+ remotingServiceMethodMapperWrapper.parameterTypes = clazzs[0];
+ }
+ }
+
+ }
+ remotingServiceMetadataWrapper.actionMap = actionMap;
+
+ }
+
+
+ public static Remoting2Manage getInstance() {
+ return INSTANCE;
+ }
+
+ private Remoting2Manage() {}
+
+ /**
+ * @param clazz Remoting Service
+ * @param baseSyncBase baseSyncBase
+ * @return RemotingService
+ */
+ public DataMetadataHandler<BaseClusterIdBase> createDataMetadataHandler(Class<?> clazz, BaseSyncBase baseSyncBase) {
+ RemotingServiceMetadataWrapper remotingServiceMetadataWrapper =
+ REMOTING_SERVICE_METADATA_WRAPPER_MAP.get(baseSyncBase.getClusterType()).get(clazz);
+ AbstractRemotingService<BaseClusterIdBase> proxyObject =
+ SDKManage.getInstance().createAbstractClientInfo(remotingServiceMetadataWrapper.remotingServiceType, baseSyncBase);
+ RemotingService<BaseClusterIdBase> remotingService = new RemotingService<>();
+ remotingService.execution = proxyObject;
+ remotingService.wrapper = remotingServiceMetadataWrapper;
+ return remotingService;
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public static class RemotingService<T> implements DataMetadataHandler<T> {
+
+ private RemotingServiceMetadataWrapper wrapper;
+
+ private Object execution;
+
+ @Override
+ public void handleAll(List<T> addData, List<T> updateData, List<T> deleteData) {
+ this.execute(addData, RemotingActionType.ADD);
+ this.execute(addData, RemotingActionType.UPDATE);
+ this.execute(addData, RemotingActionType.DELETE);
+ }
+
+ private void execute(List<T> data, RemotingActionType remotingActionType) {
+ if (CollectionUtils.isEmpty(data)) {
+ return;
+ }
+ data.forEach((value) -> {
+ this.execution(value, remotingActionType);
+ });
+ }
+
+ @SuppressWarnings("unchecked")
+ private Object execution(T object, RemotingActionType remotingActionType) {
+ RemotingServiceMethodMapperWrapper methodMapper = wrapper.actionMap.get(remotingActionType);
+ Object arg = null;
+ try {
+ if (Objects.nonNull(methodMapper.parameterTypes)) {
+ AbstractGlobal2Request<Object> request =
+ (AbstractGlobal2Request<Object>) methodMapper.parameterTypes.newInstance();
+ request.setMetaData(object);
+ arg = request;
+ }
+ GlobalResult<T> result = (GlobalResult<T>) methodMapper.remotingServiceMethod.invoke(execution, arg);
+ if (Objects.isNull(result)) {
+ log.error(" result is null, service is {} action is {} , arg is {}", wrapper.remotingServiceType.getSimpleName(),
+ remotingActionType, object);
+ if (Objects.equals(RemotingActionType.QUEUE_ALL, remotingActionType)) {
+ return Collections.EMPTY_LIST;
+ }
+ return null;
+ }
+ return result.getData();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public List<T> getData() {
+ return (List<T>) this.execution(null, RemotingActionType.QUEUE_ALL);
+
+ }
+ }
+
+
+ static class RemotingServiceMetadataWrapper {
+
+ private RemotingServiceMapper remotingServiceMapper;
+
+ private ClusterType clusterType;
+
+ private Class<?> targetClass;
+
+ /**
+ * 通过这个找到
+ */
+ private Class<?> remotingServiceType;
+
+ private Map<RemotingActionType, RemotingServiceMethodMapperWrapper> actionMap;
+ }
+
+ static class RemotingServiceMethodMapperWrapper {
+
+ private RemotingServiceMethodMapper remotingServiceMethodMapper;
+
+ private Method remotingServiceMethod;
+
+ private Method targetMethod;
+
+ private String targetMethodName;
+
+ private Class<?> parameterTypes;
+
+
+ }
+
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManager.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManager.java
deleted file mode 100644
index 8e95d5a..0000000
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManager.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.remoting;
-
-import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
-import org.apache.eventmesh.dashboard.common.enums.ClusterType;
-import org.apache.eventmesh.dashboard.common.enums.RemotingType;
-import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata;
-import org.apache.eventmesh.dashboard.common.model.metadata.ClusterRelationshipMetadata;
-import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult;
-import org.apache.eventmesh.dashboard.common.model.remoting.RemotingAction;
-import org.apache.eventmesh.dashboard.core.cluster.ClusterDO;
-import org.apache.eventmesh.dashboard.core.cluster.ColonyDO;
-import org.apache.eventmesh.dashboard.core.remoting.rocketmq.RocketMQAclRemotingService;
-import org.apache.eventmesh.dashboard.core.remoting.rocketmq.RocketMQClientRemotingService;
-import org.apache.eventmesh.dashboard.core.remoting.rocketmq.RocketMQConfigRemotingService;
-import org.apache.eventmesh.dashboard.core.remoting.rocketmq.RocketMQGroupRemotingService;
-import org.apache.eventmesh.dashboard.core.remoting.rocketmq.RocketMQOffsetRemotingService;
-import org.apache.eventmesh.dashboard.core.remoting.rocketmq.RocketMQSubscriptionRemotingService;
-import org.apache.eventmesh.dashboard.core.remoting.rocketmq.RocketMQTopicRemotingService;
-import org.apache.eventmesh.dashboard.core.remoting.rocketmq.RocketMQUserRemotingService;
-import org.apache.eventmesh.dashboard.service.remoting.RemotingIntegrationService;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import lombok.Data;
-import lombok.Getter;
-
-
-/**
- *
- */
-public class RemotingManager {
-
-
- private final Map<RemotingType, List<Class<?>>> remotingServiceClasses = new HashMap<>();
-
- /**
- * key clusterId
- */
- private final Map<Long, RemotingWrapper> remotingWrapperMap = new ConcurrentHashMap<>();
-
- @Getter
- private final Object proxyObject;
-
-
- /**
- * Long key is clusterId
- */
- private final Map<Long, ColonyDO> colonyDOMap = new HashMap<>();
-
- private final AtomicBoolean loading = new AtomicBoolean(true);
-
-
- {
- for (RemotingType remotingType : RemotingType.values()) {
- remotingServiceClasses.put(remotingType, new ArrayList<>());
- }
- this.registerService(RemotingType.ROCKETMQ, RocketMQAclRemotingService.class, RocketMQConfigRemotingService.class,
- RocketMQClientRemotingService.class, RocketMQGroupRemotingService.class, RocketMQOffsetRemotingService.class,
- RocketMQSubscriptionRemotingService.class, RocketMQTopicRemotingService.class, RocketMQUserRemotingService.class);
-
- this.registerService(RemotingType.EVENT_MESH_RUNTIME, RocketMQAclRemotingService.class, RocketMQConfigRemotingService.class,
- RocketMQClientRemotingService.class, RocketMQGroupRemotingService.class, RocketMQOffsetRemotingService.class,
- RocketMQSubscriptionRemotingService.class, RocketMQTopicRemotingService.class, RocketMQUserRemotingService.class);
-
- RemotingServiceHandler remotingServiceHandler = new RemotingServiceHandler();
- Class<?>[] clazzList = new Class[] {RemotingIntegrationService.class};
- proxyObject = Proxy.newProxyInstance(this.getClass().getClassLoader(), clazzList, remotingServiceHandler);
- }
-
- public void registerService(RemotingType remotingType, Class<?>... clazzs) {
- List<Class<?>> serviceList = this.remotingServiceClasses.get(remotingType);
- Collections.addAll(serviceList, clazzs);
- }
-
-
- public void registerColony(ColonyDO colonyDO) throws Exception {
- if (loading.get()) {
- return;
- }
-
- if (colonyDO.getClusterDO().getClusterInfo().getClusterType().isMainCluster()) {
- ClusterType clusterType = colonyDO.getClusterDO().getClusterInfo().getClusterType();
- RemotingType remotingType = clusterType.getRemotingType();
- List<Class<?>> remotingServersClassList = remotingServiceClasses.get(remotingType);
- Map<Class<?>, Object> remotingServersMap = new HashMap<>();
- for (Class<?> clazz : remotingServersClassList) {
- AbstractRemotingService abstractRemotingService = (AbstractRemotingService) clazz.newInstance();
- abstractRemotingService.setColonyDO(colonyDO);
- abstractRemotingService.init();
- remotingServersMap.put(clazz.getInterfaces()[0], abstractRemotingService);
- }
- RemotingWrapper remotingWrapper = new RemotingWrapper();
- remotingWrapper.setColonyDO(colonyDO);
- remotingWrapper.setObject(remotingServersMap);
- this.remotingWrapperMap.put(colonyDO.getClusterId(), remotingWrapper);
- } else {
- this.updateColony(colonyDO);
- }
-
- }
-
- public void updateColony(ColonyDO colonyDO) {
- RemotingWrapper remotingWrapper = this.getMainRemotingWrapper(colonyDO);
- /*
- There is a delay
- */
- if (Objects.isNull(remotingWrapper)) {
- return;
- }
- ColonyDO mainColonyDO = this.getMainColonyDO(colonyDO);
- for (Object object : remotingWrapper.getObject().values()) {
- AbstractRemotingService abstractRemotingService = (AbstractRemotingService) object;
- abstractRemotingService.setColonyDO(mainColonyDO);
- abstractRemotingService.update();
- }
- }
-
- public RemotingWrapper getMainRemotingWrapper(ColonyDO colonyDO) {
- Long clusterId =
- colonyDO.getClusterDO().getClusterInfo().getClusterType().isMainCluster() ? colonyDO.getClusterId() : colonyDO.getSuperiorId();
- if (Objects.isNull(clusterId)) {
- return null;
- }
- return remotingWrapperMap.get(clusterId);
- }
-
- public ColonyDO getMainColonyDO(ColonyDO colonyDO) {
- Long clusterId =
- colonyDO.getClusterDO().getClusterInfo().getClusterType().isMainCluster() ? colonyDO.getClusterId() : colonyDO.getSuperiorId();
- return colonyDOMap.get(clusterId);
- }
-
- public void unregister(ColonyDO colonyDO) {
- remotingWrapperMap.remove(colonyDO.getClusterId());
- }
-
- public void loadingCompleted() throws Exception {
- this.loading.set(false);
- for (ColonyDO colonyDO : colonyDOMap.values()) {
- if (colonyDO.getClusterDO().getClusterInfo().getClusterType().isMainCluster()) {
- this.registerColony(colonyDO);
- }
- }
- }
-
-
- /**
- * 解除完关系,才能删除
- *
- * @param clusterEntityList
- */
- public void cacheCluster(List<ClusterMetadata> clusterEntityList) {
- for (ClusterMetadata cluster : clusterEntityList) {
- Long clusterId = cluster.getId();
- if (cluster.getStatus() == 1) {
- ColonyDO colonyDO = colonyDOMap.remove(cluster.getClusterId());
- this.unregister(colonyDO);
- continue;
- }
- ColonyDO colonyDO = this.colonyDOMap.computeIfAbsent(clusterId, key -> {
- ColonyDO newColonyDO = new ColonyDO();
- ClusterDO newClusterDO = new ClusterDO();
- newColonyDO.setClusterDO(newClusterDO);
- return newColonyDO;
- });
- if (Objects.isNull(colonyDO.getClusterDO().getClusterInfo())) {
- colonyDO.getClusterDO().setClusterInfo(cluster);
-
- try {
- this.registerColony(colonyDO);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- } else {
- colonyDO.getClusterDO().setClusterInfo(cluster);
- this.updateColony(colonyDO);
- }
- }
- }
-
- public void cacheRuntime(List<RuntimeMetadata> runtimeMeatadataList) {
- for (RuntimeMetadata runtimeMetadata : runtimeMeatadataList) {
- ColonyDO colonyDO = this.colonyDOMap.get(runtimeMetadata.getClusterId());
- if (Objects.equals(runtimeMetadata.getStatus(), 1)) {
- colonyDO.getClusterDO().getRuntimeMap().put(runtimeMetadata.getId(), runtimeMetadata);
- } else {
- colonyDO.getClusterDO().getRuntimeMap().remove(runtimeMetadata.getId());
- }
- }
- }
-
- /**
- * 解除关系是解除关系,不是删除
- *
- * @param clusterRelationshipEntityList
- */
- public void cacheClusterRelationship(List<ClusterRelationshipMetadata> clusterRelationshipEntityList) {
- for (ClusterRelationshipMetadata clusterRelationshipEntity : clusterRelationshipEntityList) {
- ClusterType relationshipType = clusterRelationshipEntity.getRelationshipType();
- ColonyDO colonyDO = this.colonyDOMap.get(clusterRelationshipEntity.getClusterId());
- if (Objects.equals(relationshipType.getAssemblyNodeType(), ClusterType.META)) {
- this.relationship(colonyDO, colonyDO.getMetaColonyDOList(), clusterRelationshipEntity);
- } else if (Objects.equals(relationshipType.getAssemblyNodeType(), ClusterType.RUNTIME)) {
- this.relationship(colonyDO, colonyDO.getRuntimeColonyDOList(), clusterRelationshipEntity);
- } else if (Objects.equals(relationshipType.getAssemblyNodeType(), ClusterType.STORAGE)) {
- this.relationship(colonyDO, colonyDO.getStorageColonyDOList(), clusterRelationshipEntity);
- }
- }
- }
-
- private void relationship(ColonyDO colonyDO, Map<Long, ColonyDO> clusterDOList, ClusterRelationshipMetadata clusterRelationshipMetadata) {
- if (Objects.equals(clusterRelationshipMetadata.getStatus(), 2)) {
- clusterDOList.remove(clusterRelationshipMetadata.getRelationshipId());
- } else {
- ColonyDO relationshiCcolonyDO = this.colonyDOMap.get(clusterRelationshipMetadata.getRelationshipId());
- clusterDOList.put(clusterRelationshipMetadata.getRelationshipId(), relationshiCcolonyDO);
- relationshiCcolonyDO.setSuperiorId(colonyDO.getClusterId());
- }
- this.updateColony(colonyDO);
- }
-
- public List<RemotingWrapper> getEventMeshClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) {
- return this.filterer(ClusterType.EVENTMESH, clusterTrusteeshipType);
- }
-
- public List<RemotingWrapper> getMetaNacosClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) {
- return this.filterer(ClusterType.EVENTMESH_META_ETCD, clusterTrusteeshipType);
- }
-
- public List<RemotingWrapper> getMetaEtcdClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) {
- return this.filterer(ClusterType.EVENTMESH_META_NACOS, clusterTrusteeshipType);
- }
-
- public List<RemotingWrapper> getRocketMQClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) {
- return this.filterer(ClusterType.STORAGE_ROCKETMQ, clusterTrusteeshipType);
- }
-
- public List<RemotingWrapper> getStorageCluster(ClusterTrusteeshipType... clusterTrusteeshipType) {
- List<RemotingWrapper> list = new ArrayList<>();
- for (ClusterType clusterType : ClusterType.STORAGE_TYPES) {
- list.addAll(this.filterer(clusterType, clusterTrusteeshipType));
- }
- return list;
- }
-
-
- public boolean isClusterTrusteeshipType(Long clusterId, ClusterTrusteeshipType clusterTrusteeshipType) {
- ColonyDO colonyDO = this.colonyDOMap.get(clusterId);
- if (Objects.isNull(colonyDO)) {
- return false;
- }
- return Objects.equals(colonyDO.getClusterDO().getClusterInfo().getTrusteeshipType(), clusterTrusteeshipType);
- }
-
-
- private List<RemotingWrapper> filterer(ClusterType clusterType, ClusterTrusteeshipType... clusterTrusteeshipTypes) {
- Set<ClusterTrusteeshipType> clusterTrusteeshipType = new HashSet<>();
- clusterTrusteeshipType.addAll(Arrays.asList(clusterTrusteeshipTypes));
- List<RemotingWrapper> remotingWrapperList = new ArrayList<>();
- for (RemotingWrapper remotingWrapper : remotingWrapperMap.values()) {
- ClusterMetadata clusterMetadata = remotingWrapper.getColonyDO().getClusterDO().getClusterInfo();
- if (Objects.equals(clusterMetadata.getClusterType(), clusterType)) {
- if (clusterTrusteeshipType.contains(clusterMetadata.getTrusteeshipType())) {
- remotingWrapperList.add(remotingWrapper);
- }
- }
- }
- return remotingWrapperList;
- }
-
-
- public <T> T request(RemotingRequestWrapper remotingRequestWrapper, List<RemotingWrapper> remotingWrapperList) {
- List<Object> resultData = new ArrayList<>();
-
- Class<?> clazz = remotingRequestWrapper.getClass();
- Type superclass = clazz.getGenericSuperclass();
- Class<GlobalRequest> globalRequestClass = null;
- Class<?> executeClass = null;
- if (superclass instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType) superclass;
- Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
- executeClass = (Class<GlobalRequest>) actualTypeArguments[0];
- globalRequestClass = (Class<GlobalRequest>) actualTypeArguments[1];
- }
- RemotingRequestWrapper<Object, Object> remotingRequestWrapper1 = (RemotingRequestWrapper<Object, Object>) remotingRequestWrapper;
- for (RemotingWrapper remotingWrapper : remotingWrapperList) {
- try {
- GlobalRequest globalRequest = globalRequestClass.newInstance();
- globalRequest.setClusterId(remotingWrapper.getColonyDO().getClusterId());
- GlobalResult<Object> globalResult = remotingRequestWrapper1.request(globalRequest, executeClass);
- if (globalResult.getData() instanceof List) {
- resultData.addAll((List<Object>) globalResult.getData());
- } else {
- resultData.add(globalResult.getData());
- }
- } catch (Exception e) {
- //TODO There should be no abnormal occurrence of InstantiationException, IllegalAccessException, Exception
- //
- }
- }
- return (T) resultData;
-
- }
-
- /**
- * @param <T>
- * @param <RE>
- */
- public interface RemotingRequestWrapper<T, RE> {
-
- GlobalResult request(T t, RE key);
- }
-
- @Data
- public static class RemotingWrapper {
-
- private ColonyDO colonyDO;
-
- private Map<Class<?>, Object> object = new HashMap<>();
- }
-
-
- public class RemotingServiceHandler implements InvocationHandler {
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-
- GlobalRequest globalRequest = (GlobalRequest) args[0];
- Long clusterId = globalRequest.getClusterId();
- // ClusterDO
- RemotingWrapper remotingWrapper = remotingWrapperMap.get(clusterId);
- // 完整执行对象
- Class<?> declaringClass = method.getDeclaringClass();
- Object object = remotingWrapper.getObject().get(declaringClass);
- if (Objects.isNull(object)) {
- return null;
- }
-
- Method currentMethod = object.getClass().getMethod(method.getName(), method.getParameterTypes());
- RemotingAction annotations = currentMethod.getAnnotation(RemotingAction.class);
- if (Objects.nonNull(annotations)) {
- if (!annotations.support()) {
- ColonyDO colonyDO = remotingWrapper.getColonyDO();
- Map<Long, ColonyDO> colonyDOMap1 = colonyDO.getStorageColonyDOList();
- for (ColonyDO c : colonyDOMap1.values()) {
- RemotingWrapper newRemotingWrapper = remotingWrapperMap.get(c.getClusterId());
- Object newObject = newRemotingWrapper.getObject().get(declaringClass);
- return method.invoke(newObject, args);
- }
- }
- }
- return method.invoke(object, args);
-
- }
- }
-}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingProxyBatchException.java
similarity index 80%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingProxyBatchException.java
index 82e6c7f..a25d939 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingProxyBatchException.java
@@ -15,12 +15,13 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.remoting;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.core.remoting;
-@Data
-public class GlobalRequest {
+public class RemotingProxyBatchException extends RuntimeException {
- private Long clusterId;
+ public RemotingProxyBatchException(String message) {
+
+ }
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingResultType.java
similarity index 78%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingResultType.java
index bf167b1..7b54c19 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingResultType.java
@@ -15,16 +15,18 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.core.remoting;
-@Data
-public class ChangeConfigEntity {
+/**
+ * return 错误结果 throw 处理,上层怎么处理
+ */
+public enum RemotingResultType {
- private String configName;
- private String configValue;
+ ERROR_THROW_EXCEPTION,
- private Integer alreadyUpdate;
+ RETURN_ERROR_THROW_EXCEPTION,
+
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/AbstractJvmRemotingService.java
similarity index 64%
copy from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/AbstractJvmRemotingService.java
index bf167b1..b0d3653 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/AbstractJvmRemotingService.java
@@ -15,16 +15,15 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.modle.config;
-import lombok.Data;
+package org.apache.eventmesh.dashboard.core.remoting.jvm;
-@Data
-public class ChangeConfigEntity {
+import org.apache.eventmesh.dashboard.common.annotation.RemotingServiceMapper;
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.core.remoting.AbstractRemotingService;
- private String configName;
+@RemotingServiceMapper(clusterType = ClusterType.STORAGE_JVM_BROKER)
+public abstract class AbstractJvmRemotingService extends AbstractRemotingService<Object> {
- private String configValue;
- private Integer alreadyUpdate;
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmAclRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmAclRemotingService.java
new file mode 100644
index 0000000..ea33d05
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmAclRemotingService.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.remoting.jvm;
+
+import org.apache.eventmesh.dashboard.common.model.remoting.acl.CreateAclRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.acl.CreateAclResult;
+import org.apache.eventmesh.dashboard.common.model.remoting.acl.DeleteAclRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.acl.DeleteAclResult;
+import org.apache.eventmesh.dashboard.common.model.remoting.acl.GetAcls2Request;
+import org.apache.eventmesh.dashboard.common.model.remoting.acl.GetAclsResult;
+import org.apache.eventmesh.dashboard.service.remoting.AclRemotingService;
+
+
+public class JvmAclRemotingService extends AbstractJvmRemotingService implements AclRemotingService {
+
+
+ @Override
+ public CreateAclResult createAcl(CreateAclRequest createAclRequest) {
+ //this.defaultMQAdminExt.createAndUpdatePlainAccessConfig();
+ return null;
+ }
+
+ @Override
+ public DeleteAclResult deleteAcl(DeleteAclRequest deleteAclRequest) {
+ return null;
+ }
+
+ @Override
+ public GetAclsResult getAllAcls(GetAcls2Request getAclsRequest) {
+ return null;
+ }
+}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmClientRemotingService.java
similarity index 66%
copy from eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java
copy to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmClientRemotingService.java
index 2e63772..32ee1d7 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmClientRemotingService.java
@@ -15,21 +15,21 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.service.store;
-import org.apache.eventmesh.dashboard.service.dto.TopicProperties;
+package org.apache.eventmesh.dashboard.core.remoting.jvm;
+
+
+
+import org.apache.eventmesh.dashboard.common.model.metadata.ClientMetadata;
+import org.apache.eventmesh.dashboard.service.remoting.ClientRemotingService;
import java.util.List;
-/**
- * Manage topics of eventmesh-storage-plugin (EventMesh Store).
- */
-public interface TopicCore {
+public class JvmClientRemotingService extends AbstractJvmRemotingService implements ClientRemotingService {
- List<TopicProperties> getTopics();
-
- Boolean createTopic(String topicName);
-
- Boolean deleteTopic(String topicName);
+ @Override
+ public List<ClientMetadata> getClientList() {
+ return null;
+ }
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmConfigRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmConfigRemotingService.java
new file mode 100644
index 0000000..483cf87
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmConfigRemotingService.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.remoting.jvm;
+
+
+import org.apache.eventmesh.dashboard.common.model.remoting.BaseGlobalResult;
+import org.apache.eventmesh.dashboard.common.model.remoting.config.AddConfigRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.config.GetConfigRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopics2Request;
+import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResult;
+import org.apache.eventmesh.dashboard.service.remoting.ConfigRemotingService;
+
+
+public class JvmConfigRemotingService extends AbstractJvmRemotingService implements ConfigRemotingService {
+
+ @Override
+ public BaseGlobalResult addConfig(AddConfigRequest addConfigRequest) {
+ return null;
+ }
+
+ @Override
+ public GetTopicsResult getConfig(GetConfigRequest getConfigRequest) {
+ return null;
+ }
+
+ @Override
+ public GetTopicsResult getAllTopics(GetTopics2Request getTopicsRequest) {
+ return null;
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmGroupRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmGroupRemotingService.java
new file mode 100644
index 0000000..9f9ad4c
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmGroupRemotingService.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.remoting.jvm;
+
+
+import org.apache.eventmesh.dashboard.common.model.remoting.BaseGlobalResult;
+import org.apache.eventmesh.dashboard.common.model.remoting.Global2Request;
+import org.apache.eventmesh.dashboard.common.model.remoting.group.GetGroupResult;
+import org.apache.eventmesh.dashboard.common.model.remoting.group.GetGroupsRequest;
+import org.apache.eventmesh.dashboard.service.remoting.GroupRemotingService;
+
+
+public class JvmGroupRemotingService extends AbstractJvmRemotingService implements GroupRemotingService {
+
+ @Override
+ public GetGroupResult getAllGroups(GetGroupsRequest getGroupsRequest) {
+ return null;
+ }
+
+ @Override
+ public BaseGlobalResult deleteGroup(Global2Request global2Request) {
+ return null;
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmOffsetRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmOffsetRemotingService.java
new file mode 100644
index 0000000..2069e58
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmOffsetRemotingService.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+package org.apache.eventmesh.dashboard.core.remoting.jvm;
+
+
+
+import org.apache.eventmesh.dashboard.common.model.remoting.offset.GetOffsetRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.offset.GetOffsetResult;
+import org.apache.eventmesh.dashboard.common.model.remoting.offset.ResetOffsetRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.offset.ResetOffsetResult;
+import org.apache.eventmesh.dashboard.service.remoting.OffsetRemotingService;
+
+
+public class JvmOffsetRemotingService extends AbstractJvmRemotingService implements OffsetRemotingService {
+
+ @Override
+ public GetOffsetResult getOffset(GetOffsetRequest getOffsetRequest) {
+ return null;
+ }
+
+ @Override
+ public ResetOffsetResult resetOffset(ResetOffsetRequest resetOffsetRequest) {
+ return null;
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmSubscriptionRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmSubscriptionRemotingService.java
new file mode 100644
index 0000000..b03a521
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmSubscriptionRemotingService.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.remoting.jvm;
+
+
+import org.apache.eventmesh.dashboard.common.model.remoting.subscription.GetSubscriptionRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.subscription.GetSubscriptionResult;
+import org.apache.eventmesh.dashboard.service.remoting.SubscriptionRemotingService;
+
+
+public class JvmSubscriptionRemotingService extends AbstractJvmRemotingService implements SubscriptionRemotingService {
+
+ @Override
+ public GetSubscriptionResult getSubscription(GetSubscriptionRequest request) {
+ return null;
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmTopicRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmTopicRemotingService.java
new file mode 100644
index 0000000..33579f2
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmTopicRemotingService.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.remoting.jvm;
+
+import org.apache.eventmesh.dashboard.common.model.remoting.topic.CreateTopic2Request;
+import org.apache.eventmesh.dashboard.common.model.remoting.topic.CreateTopicResult;
+import org.apache.eventmesh.dashboard.common.model.remoting.topic.DeleteTopicRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.topic.DeleteTopicResult;
+import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopics2Request;
+import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResult;
+import org.apache.eventmesh.dashboard.service.remoting.TopicRemotingService;
+
+
+
+public class JvmTopicRemotingService extends AbstractJvmRemotingService implements TopicRemotingService {
+
+ @Override
+ public CreateTopicResult createTopic(CreateTopic2Request createTopicRequest) {
+ CreateTopicResult createTopicResult = new CreateTopicResult();
+ //this.defaultMQAdminExt.createAndUpdateTopicConfig(master, topicConfig);
+ return null;
+ }
+
+ @Override
+ public DeleteTopicResult deleteTopic(DeleteTopicRequest deleteTopicRequest) {
+ DeleteTopicResult deleteTopicResult = new DeleteTopicResult();
+ //this.defaultMQAdminExt.deleteTopic(deleteTopicRequest.getTopicMetadata().getTopicName(), null);
+ return null;
+ }
+
+ @Override
+ public GetTopicsResult getAllTopics(GetTopics2Request getTopicsRequest)
+ throws Exception {
+
+ return null;
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmUserRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmUserRemotingService.java
new file mode 100644
index 0000000..69b5542
--- /dev/null
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/jvm/JvmUserRemotingService.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.remoting.jvm;
+
+import org.apache.eventmesh.dashboard.common.model.remoting.user.CreateUserRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.user.DeleterUserRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.user.GetUserRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.user.GetUserResult;
+import org.apache.eventmesh.dashboard.service.remoting.UserRemotingService;
+
+
+public class JvmUserRemotingService extends AbstractJvmRemotingService implements UserRemotingService {
+
+ @Override
+ public CreateUserRequest createInstanceUser(CreateUserRequest request) {
+ return null;
+ }
+
+ @Override
+ public DeleterUserRequest deleteInstanceUser(DeleterUserRequest request) {
+ return null;
+ }
+
+ @Override
+ public GetUserResult getInstanceUser(GetUserRequest request) {
+ return null;
+ }
+}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/AbstractRocketMQRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/AbstractRocketMQRemotingService.java
index 124ea57..f67b4a8 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/AbstractRocketMQRemotingService.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/AbstractRocketMQRemotingService.java
@@ -15,98 +15,17 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.remoting.rocketmq;
-import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult;
-import org.apache.eventmesh.dashboard.core.function.SDK.SDKManager;
-import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig;
import org.apache.eventmesh.dashboard.core.remoting.AbstractRemotingService;
import org.apache.rocketmq.tools.admin.DefaultMQAdminExt;
-import org.apache.rocketmq.tools.command.CommandUtil;
-
-import java.util.AbstractMap;
-import java.util.Objects;
-import java.util.Set;
/**
* rocketmq 其他不同的是。 以nameservier 为主。那么可以多集群。一个eventmesh 可以操作多个集群
*/
-public abstract class AbstractRocketMQRemotingService extends AbstractRemotingService {
-
-
- protected DefaultMQAdminExt defaultMQAdminExt;
-
- protected CreateRocketmqConfig createRocketmqConfig;
-
-
- @Override
- public void createConfig() {
- createRocketmqConfig = new CreateRocketmqConfig();
- createRocketmqConfig.setNameServerUrl(this.getMetaString());
- }
-
- @Override
- protected void doInit() {
- AbstractMap.SimpleEntry<String, DefaultMQAdminExt> clientSimple =
- SDKManager.getInstance().createClient(SDKTypeEnum.STORAGE_ROCKETMQ_ADMIN, createRocketmqConfig);
- this.defaultMQAdminExt = clientSimple.getValue();
- }
-
- protected <T> T cluster(GlobalResult t, Function function) {
- try {
-
- /*for(ColonyDO clusterDO : this.cache.getClusterDOList()){
- for(RuntimeMetadata runtimeMetadata : clusterDO.getRuntimeEntityList()){
-
- }
- }*/
-
- Set<String> masterSet =
- CommandUtil.fetchMasterAddrByClusterName(defaultMQAdminExt, createRocketmqConfig.getClusterName());
- for (String masterName : masterSet) {
- Object newResult = function.apply(masterName, t);
- if (Objects.nonNull(newResult)) {
- return (T) newResult;
- }
- }
- t.setCode(200);
- } catch (Exception exception) {
- t.setCode(400);
- t.setErrorMessages(exception.getMessage());
- t.setThrowable(exception);
- } finally {
- return (T) t;
- }
- }
-
- ;
-
- protected <T> T clusterName(GlobalResult t, Function function) {
- try {
-
- Object newResult = function.apply(createRocketmqConfig.getClusterName(), t);
- if (Objects.nonNull(newResult)) {
- return (T) newResult;
- }
- t.setCode(200);
- } catch (Exception exception) {
- t.setCode(400);
- t.setErrorMessages(exception.getMessage());
- t.setThrowable(exception);
- } finally {
- return (T) t;
- }
- }
-
- /**
- * @param <T>
- */
- protected interface Function<T> {
-
- T apply(String masterName, T t) throws Exception;
- }
+public abstract class AbstractRocketMQRemotingService extends AbstractRemotingService<DefaultMQAdminExt> {
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQAclRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQAclRemotingService.java
index 00b5271..af61e29 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQAclRemotingService.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQAclRemotingService.java
@@ -15,13 +15,14 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.remoting.rocketmq;
import org.apache.eventmesh.dashboard.common.model.remoting.acl.CreateAclRequest;
import org.apache.eventmesh.dashboard.common.model.remoting.acl.CreateAclResult;
import org.apache.eventmesh.dashboard.common.model.remoting.acl.DeleteAclRequest;
import org.apache.eventmesh.dashboard.common.model.remoting.acl.DeleteAclResult;
-import org.apache.eventmesh.dashboard.common.model.remoting.acl.GetAclsRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.acl.GetAcls2Request;
import org.apache.eventmesh.dashboard.common.model.remoting.acl.GetAclsResult;
import org.apache.eventmesh.dashboard.service.remoting.AclRemotingService;
@@ -40,7 +41,7 @@
}
@Override
- public GetAclsResult getAllAcls(GetAclsRequest getAclsRequest) {
+ public GetAclsResult getAllAcls(GetAcls2Request getAclsRequest) {
return null;
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQClientRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQClientRemotingService.java
index f64f4fb..f39ed2b 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQClientRemotingService.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQClientRemotingService.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.remoting.rocketmq;
import org.apache.eventmesh.dashboard.common.model.metadata.ClientMetadata;
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQConfigRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQConfigRemotingService.java
index 60d72ce..7690d3a 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQConfigRemotingService.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQConfigRemotingService.java
@@ -15,12 +15,13 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.remoting.rocketmq;
import org.apache.eventmesh.dashboard.common.model.remoting.BaseGlobalResult;
import org.apache.eventmesh.dashboard.common.model.remoting.config.AddConfigRequest;
import org.apache.eventmesh.dashboard.common.model.remoting.config.GetConfigRequest;
-import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopics2Request;
import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResult;
import org.apache.eventmesh.dashboard.service.remoting.ConfigRemotingService;
@@ -37,7 +38,7 @@
}
@Override
- public GetTopicsResult getAllTopics(GetTopicsRequest getTopicsRequest) {
+ public GetTopicsResult getAllTopics(GetTopics2Request getTopicsRequest) {
return null;
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQGroupRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQGroupRemotingService.java
index 5009444..57ef4c2 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQGroupRemotingService.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQGroupRemotingService.java
@@ -15,8 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.remoting.rocketmq;
+import org.apache.eventmesh.dashboard.common.model.remoting.BaseGlobalResult;
+import org.apache.eventmesh.dashboard.common.model.remoting.Global2Request;
import org.apache.eventmesh.dashboard.common.model.remoting.group.GetGroupResult;
import org.apache.eventmesh.dashboard.common.model.remoting.group.GetGroupsRequest;
import org.apache.eventmesh.dashboard.service.remoting.GroupRemotingService;
@@ -27,4 +30,9 @@
public GetGroupResult getAllGroups(GetGroupsRequest getGroupsRequest) {
return null;
}
+
+ @Override
+ public BaseGlobalResult deleteGroup(Global2Request global2Request) {
+ return null;
+ }
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQOffsetRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQOffsetRemotingService.java
index f3ae292..8a67b37 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQOffsetRemotingService.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQOffsetRemotingService.java
@@ -16,6 +16,7 @@
*/
+
package org.apache.eventmesh.dashboard.core.remoting.rocketmq;
import org.apache.eventmesh.dashboard.common.model.remoting.offset.GetOffsetRequest;
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQSubscriptionRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQSubscriptionRemotingService.java
index 66729a0..e1950a7 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQSubscriptionRemotingService.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQSubscriptionRemotingService.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.remoting.rocketmq;
import org.apache.eventmesh.dashboard.common.model.remoting.subscription.GetSubscriptionRequest;
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQTopicRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQTopicRemotingService.java
index 8eaf703..154a5a9 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQTopicRemotingService.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQTopicRemotingService.java
@@ -15,21 +15,21 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.remoting.rocketmq;
import org.apache.eventmesh.dashboard.common.enums.RemotingType;
import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata;
import org.apache.eventmesh.dashboard.common.model.remoting.RemotingAction;
-import org.apache.eventmesh.dashboard.common.model.remoting.topic.CreateTopicRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.topic.CreateTopic2Request;
import org.apache.eventmesh.dashboard.common.model.remoting.topic.CreateTopicResult;
import org.apache.eventmesh.dashboard.common.model.remoting.topic.DeleteTopicRequest;
import org.apache.eventmesh.dashboard.common.model.remoting.topic.DeleteTopicResult;
-import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopics2Request;
import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResponse;
import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResult;
import org.apache.eventmesh.dashboard.service.remoting.TopicRemotingService;
-import org.apache.rocketmq.common.TopicConfig;
import org.apache.rocketmq.remoting.protocol.body.TopicConfigSerializeWrapper;
import java.util.ArrayList;
@@ -43,39 +43,33 @@
@Resource
@Override
@RemotingAction(support = false, substitution = RemotingType.STORAGE)
- public CreateTopicResult createTopic(CreateTopicRequest createTopicRequest) {
+ public CreateTopicResult createTopic(CreateTopic2Request createTopicRequest) {
CreateTopicResult createTopicResult = new CreateTopicResult();
- TopicConfig topicConfig = this.toDataOjbect(createTopicRequest.getTopicMetadata().getTopicConfig(), TopicConfig.class);
- return this.cluster(createTopicResult, (master, result) -> {
- this.defaultMQAdminExt.createAndUpdateTopicConfig(master, topicConfig);
- return null;
- });
+ //this.defaultMQAdminExt.createAndUpdateTopicConfig(master, topicConfig);
+ return null;
}
@Override
public DeleteTopicResult deleteTopic(DeleteTopicRequest deleteTopicRequest) {
DeleteTopicResult deleteTopicResult = new DeleteTopicResult();
- return this.clusterName(deleteTopicResult, (master, result) -> {
- this.defaultMQAdminExt.deleteTopic(deleteTopicRequest.getTopicMetadata().getTopicName(), master);
- return null;
- });
+ //this.defaultMQAdminExt.deleteTopic(deleteTopicRequest.getTopicMetadata().getTopicName(), null);
+ return null;
}
@Override
- public GetTopicsResult getAllTopics(GetTopicsRequest getTopicsRequest) {
+ public GetTopicsResult getAllTopics(GetTopics2Request getTopicsRequest)
+ throws Exception {
GetTopicsResult getTopicsResult = new GetTopicsResult();
GetTopicsResponse getTopicsResponse = new GetTopicsResponse();
List<TopicMetadata> list = new ArrayList<>();
getTopicsResult.setData(getTopicsResponse);
- return this.cluster(getTopicsResult, (master, result) -> {
- TopicConfigSerializeWrapper topicConfigSerializeWrapper = this.defaultMQAdminExt.getAllTopicConfig(master, 3000);
- if (!topicConfigSerializeWrapper.getTopicConfigTable().isEmpty()) {
- topicConfigSerializeWrapper.getTopicConfigTable().forEach((k, v) -> {
- TopicMetadata topicMetadata = new TopicMetadata();
- //topicMetadata.setClusterId();
- });
- }
- return null;
- });
+ TopicConfigSerializeWrapper topicConfigSerializeWrapper = this.getClient().getAllTopicConfig(null, 3000);
+ if (!topicConfigSerializeWrapper.getTopicConfigTable().isEmpty()) {
+ topicConfigSerializeWrapper.getTopicConfigTable().forEach((k, v) -> {
+ TopicMetadata topicMetadata = new TopicMetadata();
+ //topicMetadata.setClusterId();
+ });
+ }
+ return null;
}
}
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQUserRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQUserRemotingService.java
index 4568eca..169793c 100644
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQUserRemotingService.java
+++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQUserRemotingService.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.remoting.rocketmq;
import org.apache.eventmesh.dashboard.common.model.remoting.user.CreateUserRequest;
diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/store/RocketmqTopicCore.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/store/RocketmqTopicCore.java
deleted file mode 100644
index e1f9bac..0000000
--- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/store/RocketmqTopicCore.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.store;
-
-import org.apache.eventmesh.dashboard.core.function.SDK.SDKManager;
-import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig;
-import org.apache.eventmesh.dashboard.service.dto.RocketmqProperties;
-import org.apache.eventmesh.dashboard.service.dto.TopicProperties;
-import org.apache.eventmesh.dashboard.service.store.TopicCore;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.rocketmq.common.TopicConfig;
-import org.apache.rocketmq.common.TopicFilterType;
-import org.apache.rocketmq.common.constant.PermName;
-import org.apache.rocketmq.remoting.CommandCustomHeader;
-import org.apache.rocketmq.remoting.RemotingClient;
-import org.apache.rocketmq.remoting.protocol.RemotingCommand;
-import org.apache.rocketmq.remoting.protocol.RequestCode;
-import org.apache.rocketmq.remoting.protocol.body.TopicConfigSerializeWrapper;
-import org.apache.rocketmq.remoting.protocol.header.CreateTopicRequestHeader;
-import org.apache.rocketmq.remoting.protocol.header.DeleteTopicRequestHeader;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ConcurrentMap;
-
-import org.springframework.beans.BeanUtils;
-import org.springframework.stereotype.Service;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Service
-public class RocketmqTopicCore implements TopicCore {
-
- private final RocketmqProperties rocketmqProperties;
-
- public RocketmqTopicCore(RocketmqProperties rocketmqProperties) {
- this.rocketmqProperties = rocketmqProperties;
- }
-
- private RemotingClient createRemotingClient(String brokerUrl) {
- CreateSDKConfig createSDKConfig = () -> brokerUrl;
-
- SDKManager.getInstance().createClient(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, createSDKConfig);
- return (RemotingClient) SDKManager.getInstance().getClient(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, brokerUrl);
- }
-
- @Override
- public Boolean createTopic(String topicName) {
- String namesrvAddr = rocketmqProperties.getNamesrvAddr();
- long requestTimeoutMillis = rocketmqProperties.getRequestTimeoutMillis();
- if (StringUtils.isEmpty(namesrvAddr)) {
- log.info("RocketmqTopicCore-createTopic failed, missing brokerUrl");
- return Boolean.FALSE;
- }
-
- RemotingClient remotingClient = (RemotingClient) SDKManager.getInstance().getClient(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, namesrvAddr);
- if (remotingClient == null) {
- remotingClient = createRemotingClient(namesrvAddr);
- }
- try {
- CreateTopicRequestHeader requestHeader = new CreateTopicRequestHeader();
- requestHeader.setTopic(topicName);
- requestHeader.setTopicFilterType(TopicFilterType.SINGLE_TAG.name());
- requestHeader.setPerm(PermName.PERM_READ | PermName.PERM_WRITE);
-
- RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.UPDATE_AND_CREATE_TOPIC, requestHeader);
- RemotingCommand response = remotingClient.invokeSync(namesrvAddr, request, requestTimeoutMillis);
- log.info("Rocketmq create topic result:" + response.toString());
- return response.getCode() == 0;
- } catch (Exception e) {
- log.error("RocketmqTopicCore-createTopic failed.", e);
- }
- return Boolean.FALSE;
- }
-
- @Override
- public List<TopicProperties> getTopics() {
- String namesrvAddr = rocketmqProperties.getNamesrvAddr();
- long requestTimeoutMillis = rocketmqProperties.getRequestTimeoutMillis();
- if (StringUtils.isEmpty(namesrvAddr)) {
- log.info("RocketmqTopicCore-getTopics failed, missing brokerUrl");
- return new ArrayList<>();
- }
-
- RemotingClient remotingClient = (RemotingClient) SDKManager.getInstance().getClient(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, namesrvAddr);
- if (remotingClient == null) {
- remotingClient = createRemotingClient(namesrvAddr);
- }
- List<TopicConfig> topicConfigList = new ArrayList<>();
- try {
- RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ALL_TOPIC_CONFIG, (CommandCustomHeader) null);
- RemotingCommand response = remotingClient.invokeSync(namesrvAddr, request, requestTimeoutMillis);
- TopicConfigSerializeWrapper allTopicConfig = TopicConfigSerializeWrapper.decode(response.getBody(), TopicConfigSerializeWrapper.class);
- ConcurrentMap<String, TopicConfig> topicConfigTable = allTopicConfig.getTopicConfigTable();
- topicConfigList = new ArrayList<>(topicConfigTable.values());
- } catch (Exception e) {
- log.error("RocketmqTopicCore-createTopic failed.", e);
- }
-
- return topicConfig2TopicProperties(topicConfigList);
- }
-
- @Override
- public Boolean deleteTopic(String topicName) {
- String namesrvAddr = rocketmqProperties.getNamesrvAddr();
- long requestTimeoutMillis = rocketmqProperties.getRequestTimeoutMillis();
- if (StringUtils.isEmpty(namesrvAddr)) {
- log.info("RocketmqTopicCore-deleteTopic failed, missing brokerUrl");
- return Boolean.FALSE;
- }
-
- RemotingClient remotingClient = (RemotingClient) SDKManager.getInstance().getClient(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, namesrvAddr);
- if (remotingClient == null) {
- remotingClient = createRemotingClient(namesrvAddr);
- }
- try {
- DeleteTopicRequestHeader deleteTopicRequestHeader = new DeleteTopicRequestHeader();
- deleteTopicRequestHeader.setTopic(topicName);
- RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.DELETE_TOPIC_IN_BROKER, null);
- RemotingCommand response = remotingClient.invokeSync(namesrvAddr, request, requestTimeoutMillis);
-
- log.info("Rocketmq delete topic result:" + response.toString());
- return response.getCode() == 0;
- } catch (Exception e) {
- log.error("RocketmqTopicCore-createTopic failed.", e);
- }
- return Boolean.FALSE;
- }
-
- public List<TopicProperties> topicConfig2TopicProperties(List<TopicConfig> topicConfigList) {
- ArrayList<TopicProperties> topicPropertiesList = new ArrayList<>();
- for (TopicConfig topicConfig : topicConfigList) {
- TopicProperties topicProperties = new TopicProperties();
- BeanUtils.copyProperties(topicConfig, topicProperties);
- topicPropertiesList.add(topicProperties);
- }
- return topicPropertiesList;
- }
-}
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManageTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManageTest.java
new file mode 100644
index 0000000..da9e1f3
--- /dev/null
+++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManageTest.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.function.SDK;
+
+import org.apache.eventmesh.dashboard.common.enums.ClusterType;
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
+import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateJvmCapConfig;
+import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateJvmConfig;
+
+import org.junit.Test;
+
+public class SDKManageTest {
+
+ SDKManage sdkManage = SDKManage.getInstance();
+
+ public static BaseSyncBase createJvm() {
+ SDKTypeEnum sdkTypeEnum = SDKTypeEnum.ADMIN;
+ BaseSyncBase baseSyncBase = new RuntimeMetadata();
+ baseSyncBase.setId(1L);
+ baseSyncBase.setClusterType(ClusterType.STORAGE_JVM_BROKER);
+ CreateJvmConfig config = new CreateJvmConfig();
+ config.setKey(baseSyncBase.getId().toString());
+ SDKManage.getInstance().createClient(sdkTypeEnum, baseSyncBase, config, baseSyncBase.getClusterType());
+ return baseSyncBase;
+ }
+
+ public static BaseSyncBase createJvmCap() {
+ SDKTypeEnum sdkTypeEnum = SDKTypeEnum.ADMIN;
+ BaseSyncBase baseSyncBase = new RuntimeMetadata();
+ baseSyncBase.setId(1L);
+ baseSyncBase.setClusterType(ClusterType.STORAGE_JVM_CAP_BROKER);
+ CreateJvmCapConfig config = new CreateJvmCapConfig();
+ config.setKey(baseSyncBase.getId().toString());
+ SDKManage.getInstance().createClient(sdkTypeEnum, baseSyncBase, config, baseSyncBase.getClusterType());
+ return baseSyncBase;
+ }
+
+ @Test
+ public void test_createJVMSDK() {
+ createJvm();
+ }
+
+ @Test
+ public void test_createJVMCapSDK() {
+ createJvmCap();
+ }
+
+}
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManagerTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManagerTest.java
deleted file mode 100644
index 5c3a101..0000000
--- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManagerTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.function.SDK;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRedisConfig;
-
-import java.lang.reflect.Field;
-import java.util.Map;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-
-import lombok.extern.slf4j.Slf4j;
-
-
-@Slf4j
-@Timeout(value = 10)
-class SDKManagerTest {
-
- private String redisKey;
-
- @BeforeEach
- void setUp() {
- try {
- CreateRedisConfig createRedisConfig = CreateRedisConfig.builder()
- .redisUrl("localhost:6379")
- .password("")
- .timeOut(30)
- .build();
- redisKey = SDKManager.getInstance().createClient(SDKTypeEnum.STORAGE_REDIS, createRedisConfig).getKey();
- } catch (Exception e) {
- log.warn("SDK manager test init failed, possible reason: redis-server is offline. {}", this.getClass().getSimpleName(), e);
- }
- }
-
- @Test
- public void testGetClient() {
- try {
- Object redisClient = SDKManager.getInstance().getClient(SDKTypeEnum.STORAGE_REDIS, redisKey);
- assertNotNull(redisClient);
- } catch (Exception e) {
- log.warn("SDK manager test failed, possible reason: redis-server is offline. {}", this.getClass().getSimpleName(), e);
- }
- }
-
- @Test
- public void testGetSameClient() {
- try {
- SDKManager sdkManager = SDKManager.getInstance();
- Object redisClient = sdkManager.getClient(SDKTypeEnum.STORAGE_REDIS, redisKey);
- assertNotNull(redisClient);
- Class<?> sdkManagerClass = sdkManager.getClass();
- Field clientMapField = sdkManagerClass.getDeclaredField("clientMap");
- clientMapField.setAccessible(true);
- Map<SDKTypeEnum, Map<String, Object>> clientMap = (Map<SDKTypeEnum, Map<String, Object>>) clientMapField.get(sdkManager);
- assertEquals(1, clientMap.get(SDKTypeEnum.STORAGE_REDIS).size());
- } catch (Exception e) {
- log.warn("SDK manager test failed, possible reason: redis-server is offline. {}", this.getClass().getSimpleName(), e);
- }
- }
-}
\ No newline at end of file
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/Test1.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/Test1.java
new file mode 100644
index 0000000..cd6addb
--- /dev/null
+++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/Test1.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.function.SDK;
+
+import org.apache.eventmesh.dashboard.common.util.ClasspathScanner;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Test;
+
+public class Test1 {
+
+
+
+
+ @Test
+ public void ClasspathScannerTest() throws Exception {
+ Set<Class<?>> interfaceSet = new HashSet<>();
+ interfaceSet.add(SDKOperation.class);
+ ClasspathScanner classpathScanner = ClasspathScanner.builder().base(SDKManage.class).subPath("/operation").interfaceSet(interfaceSet).build();
+ List<Class<?>> classList = classpathScanner.getClazz();
+ classList.size();
+ }
+
+ @Test
+ public void sdkManageTest() throws Exception {
+ SDKManage.getInstance();
+ }
+}
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKCreateOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKCreateOperationTest.java
deleted file mode 100644
index badbd6b..0000000
--- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKCreateOperationTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.function.SDK.operation;
-
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateEtcdConfig;
-
-import java.util.AbstractMap.SimpleEntry;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-
-import io.etcd.jetcd.KV;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Timeout(value = 5)
-public class EtcdSDKCreateOperationTest {
-
- private static final String url = "http://localhost:2379";
- private final EtcdSDKOperation etcdSDKOperation = new EtcdSDKOperation();
-
- @Test
- void testCreateClient() {
- final CreateEtcdConfig etcdConfig = CreateEtcdConfig.builder()
- .etcdServerAddress(url)
- .connectTime(5)
- .build();
- SimpleEntry<String, KV> simpleEntry = null;
- try {
- simpleEntry = etcdSDKOperation.createClient(etcdConfig);
- Assertions.assertEquals(url, simpleEntry.getKey());
- simpleEntry.getValue().close();
- } catch (Exception e) {
- log.error("create etcd client failed", e);
- if (simpleEntry != null) {
- simpleEntry.getValue().close();
- }
- }
- }
-}
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosNamingSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosNamingSDKOperationTest.java
deleted file mode 100644
index 54ae2a9..0000000
--- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosNamingSDKOperationTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.function.SDK.operation;
-
-import org.apache.eventmesh.dashboard.core.function.SDK.SDKManager;
-import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateNacosConfig;
-
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-
-import com.alibaba.nacos.api.exception.NacosException;
-import com.alibaba.nacos.api.naming.NamingService;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Timeout(value = 5)
-class NacosNamingSDKOperationTest {
-
- private NacosNamingSDKOperation nacosNamingSDKOperation = new NacosNamingSDKOperation();
-
- @Test
- public void testCreateNamingService() throws NacosException, InterruptedException {
- try {
- CreateNacosConfig createClientConfig = new CreateNacosConfig();
- createClientConfig.setServerAddress("127.0.0.1:8848");
- createClientConfig.setUsername("nacos");
- createClientConfig.setPassword("nacos");
- NamingService namingService = (NamingService) SDKManager.getInstance().createClient(SDKTypeEnum.META_NACOS_NAMING, createClientConfig)
- .getValue();
- namingService.registerInstance("eventmesh-dashboard-sdk-nacos-test", "192.168.11.11", 8888,
- "eventmesh-dashboard-sdk-nacos-test-cluster-name");
- namingService.deregisterInstance("eventmesh-dashboard-sdk-nacos-test", "192.168.11.11", 8888,
- "eventmesh-dashboard-sdk-nacos-test-cluster-name");
- } catch (Exception e) {
- log.error("create nacos naming service failed", e);
- }
- }
-}
\ No newline at end of file
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RedisSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RedisSDKOperationTest.java
deleted file mode 100644
index 4ef9a7e..0000000
--- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RedisSDKOperationTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.function.SDK.operation;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRedisConfig;
-
-import java.util.AbstractMap.SimpleEntry;
-
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-
-import io.lettuce.core.api.StatefulRedisConnection;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Timeout(value = 5)
-class RedisSDKOperationTest {
-
- private final RedisSDKOperation redisClientCreateOperation = new RedisSDKOperation();
-
- @Test
- void testCreateClient() {
- CreateRedisConfig createClientConfig = CreateRedisConfig.builder()
- .redisUrl("localhost:6379")
- .password("")
- .timeOut(5)
- .build();
- SimpleEntry<String, StatefulRedisConnection<String, String>> simpleEntry = null;
- try {
- simpleEntry = redisClientCreateOperation.createClient(createClientConfig);
- assertEquals("localhost:6379", simpleEntry.getKey());
- String response = simpleEntry.getValue().sync().ping();
- log.info("response:{}", response);
- simpleEntry.getValue().close();
- } catch (Exception e) {
- log.error("create redis client failed", e);
- if (simpleEntry != null) {
- simpleEntry.getValue().close();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcConsumerSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcConsumerSDKOperationTest.java
deleted file mode 100644
index c348c53..0000000
--- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcConsumerSDKOperationTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.function.SDK.operation;
-
-import org.apache.eventmesh.client.grpc.consumer.EventMeshGrpcConsumer;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeGrpcConsumerSDKOperation;
-
-import java.util.AbstractMap.SimpleEntry;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Timeout(value = 5)
-public class RuntimeGrpcConsumerSDKOperationTest {
-
- private final RuntimeGrpcConsumerSDKOperation grpcConsumerSDKOperation = new RuntimeGrpcConsumerSDKOperation();
-
- @Test
- void testCreateClient() {
- SimpleEntry<String, EventMeshGrpcConsumer> grpcConsumerSimpleEntry = null;
- try {
- final CreateRuntimeConfig runtimeConfig = CreateRuntimeConfig.builder()
- .runtimeServerAddress("127.0.0.1:10205")
- .consumerGroup("EventMeshTest-consumerGroup")
- .env("test")
- .idc("idc")
- .sys("1234")
- .build();
- grpcConsumerSimpleEntry = grpcConsumerSDKOperation.createClient(runtimeConfig);
- Assertions.assertEquals("127.0.0.1:10205", grpcConsumerSimpleEntry.getKey());
- grpcConsumerSimpleEntry.getValue().close();
- } catch (Exception e) {
- log.error("create runtime GRPC consumer client failed", e);
- if (grpcConsumerSimpleEntry != null) {
- grpcConsumerSimpleEntry.getValue().close();
- }
- }
- }
-}
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcProducerSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcProducerSDKOperationTest.java
deleted file mode 100644
index 86e18a2..0000000
--- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcProducerSDKOperationTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.function.SDK.operation;
-
-import org.apache.eventmesh.client.grpc.producer.EventMeshGrpcProducer;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeGrpcProducerSDKOperation;
-
-import java.util.AbstractMap.SimpleEntry;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Timeout(value = 5)
-public class RuntimeGrpcProducerSDKOperationTest {
-
- private final RuntimeGrpcProducerSDKOperation grpcProducerSDKOperation = new RuntimeGrpcProducerSDKOperation();
-
- @Test
- void testCreateClient() {
- SimpleEntry<String, EventMeshGrpcProducer> grpcProducerSimpleEntry = null;
- try {
- final CreateRuntimeConfig runtimeConfig = CreateRuntimeConfig.builder()
- .runtimeServerAddress("127.0.0.1:10205")
- .producerGroup("EventMeshTest-producerGroup")
- .env("test")
- .idc("idc")
- .sys("1234")
- .build();
- grpcProducerSimpleEntry = grpcProducerSDKOperation.createClient(runtimeConfig);
- Assertions.assertEquals("127.0.0.1:10205", grpcProducerSimpleEntry.getKey());
- grpcProducerSimpleEntry.getValue().close();
- } catch (Exception e) {
- log.error("create runtime GRPC producer client failed", e);
- if (grpcProducerSimpleEntry != null) {
- grpcProducerSimpleEntry.getValue().close();
- }
- }
- }
-}
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpConsumerSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpConsumerSDKOperationTest.java
deleted file mode 100644
index ec62b11..0000000
--- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpConsumerSDKOperationTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.function.SDK.operation;
-
-import org.apache.eventmesh.client.http.consumer.EventMeshHttpConsumer;
-import org.apache.eventmesh.common.utils.IPUtils;
-import org.apache.eventmesh.common.utils.ThreadUtils;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeHttpConsumerSDKOperation;
-
-import java.util.AbstractMap.SimpleEntry;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Timeout(value = 5)
-public class RuntimeHttpConsumerSDKOperationTest {
-
- private final RuntimeHttpConsumerSDKOperation httpConsumerSDKOperation = new RuntimeHttpConsumerSDKOperation();
-
- @Test
- void testCreateClient() {
- SimpleEntry<String, EventMeshHttpConsumer> httpConsumerSimpleEntry = null;
- try {
- final CreateRuntimeConfig runtimeConfig = CreateRuntimeConfig.builder()
- .runtimeServerAddress("127.0.0.1:10105")
- .consumerGroup("EventMeshTest-consumerGroup")
- .env("test")
- .idc("idc")
- .ip(IPUtils.getLocalAddress())
- .sys("1234")
- .pid(String.valueOf(ThreadUtils.getPID()))
- .username("eventmesh")
- .password("123456")
- .build();
- httpConsumerSimpleEntry = httpConsumerSDKOperation.createClient(runtimeConfig);
- Assertions.assertEquals("127.0.0.1:10105", httpConsumerSimpleEntry.getKey());
- httpConsumerSimpleEntry.getValue().close();
- } catch (Exception e) {
- log.error("create runtime GRPC consumer client failed", e);
- if (httpConsumerSimpleEntry != null) {
- httpConsumerSimpleEntry.getValue().close();
- }
- }
- }
-}
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpProducerSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpProducerSDKOperationTest.java
deleted file mode 100644
index 8bdf471..0000000
--- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpProducerSDKOperationTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.function.SDK.operation;
-
-import org.apache.eventmesh.client.http.producer.EventMeshHttpProducer;
-import org.apache.eventmesh.common.utils.IPUtils;
-import org.apache.eventmesh.common.utils.ThreadUtils;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeHttpProducerSDKOperation;
-
-import java.util.AbstractMap.SimpleEntry;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Timeout(value = 5)
-public class RuntimeHttpProducerSDKOperationTest {
-
- private final RuntimeHttpProducerSDKOperation httpProducerSDKOperation = new RuntimeHttpProducerSDKOperation();
-
- @Test
- void testCreateClient() {
- SimpleEntry<String, EventMeshHttpProducer> httpProducerSimpleEntry = null;
- try {
- final CreateRuntimeConfig runtimeConfig = CreateRuntimeConfig.builder()
- .runtimeServerAddress("127.0.0.1:10105")
- .producerGroup("EventMeshTest-producerGroup")
- .env("test")
- .idc("idc")
- .ip(IPUtils.getLocalAddress())
- .sys("1234")
- .pid(String.valueOf(ThreadUtils.getPID()))
- .username("eventmesh")
- .password("123456")
- .build();
- httpProducerSimpleEntry = httpProducerSDKOperation.createClient(runtimeConfig);
- Assertions.assertEquals("127.0.0.1:10105", httpProducerSimpleEntry.getKey());
- httpProducerSimpleEntry.getValue().close();
- } catch (Exception e) {
- log.error("create runtime EventMesh HTTP producer client failed", e);
- if (httpProducerSimpleEntry != null) {
- httpProducerSimpleEntry.getValue().close();
- }
- }
- }
-}
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeSDKOperationTest.java
deleted file mode 100644
index 5966bb3..0000000
--- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeSDKOperationTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.function.SDK.operation;
-
-import org.apache.eventmesh.client.tcp.common.EventMeshCommon;
-import org.apache.eventmesh.common.Constants;
-import org.apache.eventmesh.common.protocol.tcp.UserAgent;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeSDKOperation;
-import org.apache.eventmesh.dashboard.core.function.SDK.wrapper.RuntimeSDKWrapper;
-
-import java.util.AbstractMap.SimpleEntry;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Timeout(value = 5)
-class RuntimeSDKOperationTest {
-
- private final RuntimeSDKOperation runtimeSDKOperation = new RuntimeSDKOperation();
-
- @Test
- void testCreateClient() {
- SimpleEntry<String, RuntimeSDKWrapper> sdkWrapperSimpleEntry = null;
- try {
- final UserAgent userAgent = UserAgent.builder()
- .env("test")
- .host("localhost")
- .password("123456")
- .username("eventmesh")
- .group("EventmeshTestGroup")
- .path("/")
- .port(8366)
- .subsystem("502")
- .pid(32894)
- .version("2.1")
- .idc("A")
- .purpose(EventMeshCommon.USER_AGENT_PURPOSE_PUB)
- .build();
- final CreateRuntimeConfig runtimeConfig = CreateRuntimeConfig.builder()
- .runtimeServerAddress("127.0.0.1:10000")
- .protocol("TCP")
- .protocolName(Constants.EM_MESSAGE_PROTOCOL_NAME)
- .userAgent(userAgent)
- .build();
- sdkWrapperSimpleEntry = runtimeSDKOperation.createClient(runtimeConfig);
- Assertions.assertEquals("127.0.0.1:10000", sdkWrapperSimpleEntry.getKey());
- Assertions.assertNotNull(sdkWrapperSimpleEntry.getValue().getTcpEventMeshClient());
- sdkWrapperSimpleEntry.getValue().close();
- } catch (Exception e) {
- log.error("create runtime client failed", e);
- if (sdkWrapperSimpleEntry != null) {
- sdkWrapperSimpleEntry.getValue().close();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpCloudEventSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpCloudEventSDKOperationTest.java
deleted file mode 100644
index f3fa14d..0000000
--- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpCloudEventSDKOperationTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.function.SDK.operation;
-
-import org.apache.eventmesh.client.tcp.common.EventMeshCommon;
-import org.apache.eventmesh.client.tcp.impl.cloudevent.CloudEventTCPClient;
-import org.apache.eventmesh.common.protocol.tcp.UserAgent;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeTcpCloudEventSDKOperation;
-
-import java.util.AbstractMap.SimpleEntry;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Timeout(value = 5)
-public class RuntimeTcpCloudEventSDKOperationTest {
-
- private final RuntimeTcpCloudEventSDKOperation runtimeTCPPushSDKOperation = new RuntimeTcpCloudEventSDKOperation();
-
- @Test
- void testCreateClient() {
- SimpleEntry<String, CloudEventTCPClient> simpleEntry = null;
- try {
- final UserAgent userAgent = UserAgent.builder()
- .env("test")
- .host("localhost")
- .password("123456")
- .username("eventmesh")
- .group("EventmeshTestGroup")
- .path("/")
- .port(8366)
- .subsystem("502")
- .pid(32894)
- .version("2.1")
- .idc("A")
- .purpose(EventMeshCommon.USER_AGENT_PURPOSE_PUB)
- .build();
- log.info("{}", userAgent);
- final CreateRuntimeConfig runtimeConfig = CreateRuntimeConfig.builder()
- .runtimeServerAddress("127.0.0.1:10000")
- .userAgent(userAgent)
- .build();
- log.info("{}", runtimeConfig);
- simpleEntry = runtimeTCPPushSDKOperation.createClient(runtimeConfig);
- Assertions.assertEquals("127.0.0.1:10000", simpleEntry.getKey());
- simpleEntry.getValue().close();
- } catch (Exception e) {
- log.error("create runtime tcp CloudEvent client failed", e);
- if (simpleEntry != null) {
- simpleEntry.getValue().close();
- }
- }
- }
-}
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpEventMeshSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpEventMeshSDKOperationTest.java
deleted file mode 100644
index 1dc7495..0000000
--- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpEventMeshSDKOperationTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.function.SDK.operation;
-
-import org.apache.eventmesh.client.tcp.common.EventMeshCommon;
-import org.apache.eventmesh.client.tcp.impl.eventmeshmessage.EventMeshMessageTCPClient;
-import org.apache.eventmesh.common.protocol.tcp.UserAgent;
-import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig;
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeTcpEventMeshSDKOperation;
-
-import java.util.AbstractMap.SimpleEntry;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Timeout(value = 5)
-public class RuntimeTcpEventMeshSDKOperationTest {
-
- private final RuntimeTcpEventMeshSDKOperation eventMeshSDKOperation = new RuntimeTcpEventMeshSDKOperation();
-
- @Test
- void testCreateClient() {
- SimpleEntry<String, EventMeshMessageTCPClient> simpleEntry = null;
- try {
- final UserAgent userAgent = UserAgent.builder()
- .env("test")
- .host("localhost")
- .password("123456")
- .username("eventmesh")
- .group("EventmeshTestGroup")
- .path("/")
- .port(8365)
- .subsystem("501")
- .pid(32893)
- .version("2.1")
- .idc("A")
- .purpose(EventMeshCommon.USER_AGENT_PURPOSE_PUB)
- .build();
- log.info("userAgent {}", userAgent);
- final CreateRuntimeConfig runtimeConfig = CreateRuntimeConfig.builder()
- .runtimeServerAddress("127.0.0.1:10000")
- .userAgent(userAgent)
- .build();
- log.info("{}", runtimeConfig);
- simpleEntry = eventMeshSDKOperation.createClient(runtimeConfig);
- Assertions.assertEquals("127.0.0.1:10000", simpleEntry.getKey());
- simpleEntry.getValue().close();
- } catch (Exception e) {
- log.error("create runtime tcp EventMeshMessage client failed", e);
- if (simpleEntry != null) {
- simpleEntry.getValue().close();
- }
- }
- }
-}
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpOpenMessageSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpOpenMessageSDKOperationTest.java
deleted file mode 100644
index 6608317..0000000
--- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpOpenMessageSDKOperationTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.function.SDK.operation;
-
-
-import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeTcpOpenMessageSDKOperation;
-
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-
-@Timeout(value = 5)
-public class RuntimeTcpOpenMessageSDKOperationTest {
-
- private final RuntimeTcpOpenMessageSDKOperation tcpOpenMessageSDKOperation = new RuntimeTcpOpenMessageSDKOperation();
-
- @Test
- void testCreateClient() {
- // todo no impl
- }
-
-}
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/meta/runtime/NacosRuntimeCoreTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/meta/runtime/NacosRuntimeCoreTest.java
deleted file mode 100644
index 9b7bf0e..0000000
--- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/meta/runtime/NacosRuntimeCoreTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.meta.runtime;
-
-import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeRequest;
-
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Timeout(value = 5)
-class NacosRuntimeCoreTest {
-
- private NacosRuntimeCore nacosRuntimeCore = new NacosRuntimeCore();
-
- @Test
- public void testGetRuntime() throws InterruptedException {
- try {
- GetRuntimeRequest getRuntimeRequest = new GetRuntimeRequest();
- getRuntimeRequest.setRegistryAddress("127.0.0.1:8848");
- nacosRuntimeCore.getRuntime(getRuntimeRequest).getFuture().thenAccept(
- getRuntimeResponse -> {
- log.info("testGetRuntime success, the first cluster name is {}",
- getRuntimeResponse.getRuntimeMetadataList().get(0).getClusterName());
- }
- );
- } catch (Exception e) {
- log.error("testGetRuntime failed", e);
- }
- Thread.sleep(1000);
- }
-}
\ No newline at end of file
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManagerTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManagerTest.java
index 3b7f009..64680ca 100644
--- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManagerTest.java
+++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManagerTest.java
@@ -15,122 +15,104 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.core.metadata;
import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
-import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata;
-import org.apache.eventmesh.dashboard.core.remoting.RemotingManager;
+import org.apache.eventmesh.dashboard.common.enums.MetadataType;
+import org.apache.eventmesh.dashboard.common.model.ConvertMetaData;
+import org.apache.eventmesh.dashboard.common.model.DatabaseAndMetadataMapper;
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKManageTest;
+import org.apache.eventmesh.dashboard.core.metadata.result.MetadataSyncResultHandler;
+import org.apache.eventmesh.dashboard.core.remoting.Remoting2Manage;
+import org.apache.eventmesh.dashboard.service.remoting.AclRemotingService;
+import org.apache.eventmesh.dashboard.service.remoting.TopicRemotingService;
import org.apache.commons.lang3.reflect.FieldUtils;
-import java.lang.reflect.Field;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Objects;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
+@SuppressWarnings("unchecked")
@RunWith(MockitoJUnitRunner.class)
public class MetadataSyncManagerTest {
- private MetadataSyncManager metadataSyncManager = new MetadataSyncManager();
+ private Map<MetadataType, SyncMetadataCreateFactory> syncMetadataCreateFactoryMap;
- private Map<Class<?>, MetadataSyncManager.MetadataSyncWrapper> metadataSyncWrapperMap;
+
+ private Map<String, List<MetadataSyncWrapper>> metadataSyncConfigMap;
+
+ private MetadataSyncManage metadataSyncManage = new MetadataSyncManage();
+
+ private Remoting2Manage remotingManage = Remoting2Manage.getInstance();
@Mock
- private RemotingManager remotingManager;
+ private MetadataSyncResultHandler defaultMetadataSyncResultHandler;
- @Mock
- private MetadataHandler dataBasesHandler;
- @Mock
- private MetadataHandler clusterHandler;
-
- private List<RuntimeMetadata> databasesList = new ArrayList<>();
- private List<RuntimeMetadata> clusterList = new ArrayList<>();
+ private BaseSyncBase baseSyncBase = SDKManageTest.createJvm();
@Before
- public void init() throws IllegalAccessException {
- MetadataSyncManager.MetadataSyncConfig metadataSyncConfig = new MetadataSyncManager.MetadataSyncConfig();
- metadataSyncConfig.setDataBasesHandler(dataBasesHandler);
- metadataSyncConfig.setClusterService(clusterHandler);
- metadataSyncConfig.setMetadataClass(RuntimeMetadata.class);
- metadataSyncManager.setRemotingManager(this.remotingManager);
- metadataSyncManager.register(metadataSyncConfig);
+ public void init() throws Exception {
+ this.syncMetadataCreateFactoryMap =
+ (Map<MetadataType, SyncMetadataCreateFactory>) FieldUtils.readDeclaredField(this.metadataSyncManage, "syncMetadataCreateFactoryMap",
+ true);
- Field metadataSyncWrapperMapField = FieldUtils.getField(MetadataSyncManager.class, "metadataSyncWrapperMap", true);
- metadataSyncWrapperMap = (Map<Class<?>, MetadataSyncManager.MetadataSyncWrapper>) metadataSyncWrapperMapField.get(metadataSyncManager);
+ this.metadataSyncConfigMap =
+ (Map<String, List<MetadataSyncWrapper>>) FieldUtils.readDeclaredField(this.metadataSyncManage, "metadataSyncConfigMap",
+ true);
+ metadataSyncManage.setMetadataSyncResultHandler(this.defaultMetadataSyncResultHandler);
+ List<DataMetadataHandler<Object>> dataMetadataHandlerList = new ArrayList<>();
+ DataMetadataHandler dataMetadataHandler = remotingManage.createDataMetadataHandler(AclRemotingService.class, baseSyncBase);
+
+ dataMetadataHandlerList.add(dataMetadataHandler);
+ metadataSyncManage.setDataMetadataHandlerList(dataMetadataHandlerList);
+
+ Map<Class<?>, DatabaseAndMetadataMapper> databaseAndMetadataMapperMap = new HashMap<>();
+
+ DatabaseAndMetadataMapper databaseAndMetadataMapper =
+ DatabaseAndMetadataMapper.builder().metaType(MetadataType.TOPIC).databaseHandlerClass(dataMetadataHandler.getClass())
+ .metadataHandlerClass(TopicRemotingService.class).convertMetaData(new MockConvertMetaData()).build();
+ databaseAndMetadataMapperMap.put(databaseAndMetadataMapper.getDatabaseHandlerClass(), databaseAndMetadataMapper);
+
+ metadataSyncManage.init(100, 50000, databaseAndMetadataMapperMap);
}
@Test
- public void test_sync_mock() {
- //
- // ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP 3
- // databases cluster
- // A 5 3 2
- // B 3 5 -2
- // C 5(2) 5(2) 2
- // ClusterTrusteeshipType.TRUSTEESHIP 3
- // databases cluster
- // E 5 5 0
- // F 3 5 -2
- // G 5 3 2
-
- this.mock_data(1, 5, 3);
- this.mock_data(2, 3, 5);
- this.mock_data(3, 5, 5);
- this.mock_data(5, 5, 3);
- this.mock_data(6, 3, 5);
- this.mock_data(7, 5, 5);
- MetadataSyncManager.MetadataSyncWrapper metadataSyncWrapper = this.metadataSyncWrapperMap.get(RuntimeMetadata.class);
- Mockito.when(this.dataBasesHandler.getData()).thenReturn(this.databasesList);
- Mockito.when(this.clusterHandler.getData()).thenReturn(this.clusterList);
- Mockito.when(this.remotingManager.isClusterTrusteeshipType(Mockito.anyLong(), Mockito.any())).thenAnswer((invocation) -> {
- Long clusterId = (Long) invocation.getArgument(0);
- ClusterTrusteeshipType clusterTrusteeshipType = (ClusterTrusteeshipType) invocation.getArgument(1);
- if (Objects.equals(clusterTrusteeshipType, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP) && clusterId < 4) {
- return true;
- }
- if (Objects.equals(clusterTrusteeshipType, ClusterTrusteeshipType.TRUSTEESHIP) && clusterId > 4) {
- return true;
- }
- return false;
- });
-
- metadataSyncWrapper.run();
+ public void test() throws InterruptedException {
+ baseSyncBase.setTrusteeshipType(ClusterTrusteeshipType.SELF);
+ baseSyncBase.setFirstToWhom(baseSyncBase.getFirstToWhom());
+ metadataSyncManage.register(baseSyncBase);
+ Thread.sleep(1000000L);
+ System.out.println("test");
}
- private void mock_data(long clusterId, int databasesCount, int clusterCount) {
- int index = databasesCount > clusterCount ? databasesCount : clusterCount;
- for (int i = 0; i < index; i++) {
- RuntimeMetadata runtimeMetadata = new RuntimeMetadata();
- runtimeMetadata.setClusterId(clusterId);
- runtimeMetadata.setPort(i);
- runtimeMetadata.setHost(clusterId + "." + i + "");
- if (i < databasesCount) {
- this.databasesList.add(runtimeMetadata);
- }
- if (i < clusterCount) {
- if (databasesCount == clusterCount) {
- if (i == 0 || i == 1) {
- runtimeMetadata = new RuntimeMetadata();
- runtimeMetadata.setClusterId(clusterId);
- runtimeMetadata.setPort(i);
- runtimeMetadata.setHost(clusterId + ".." + i + " " + i);
- }
- }
- this.clusterList.add(runtimeMetadata);
- }
+
+
+ static class MockConvertMetaData implements ConvertMetaData<Object, Object> {
+
+ @Override
+ public Object toEntity(Object meta) {
+ return meta;
+ }
+
+ @Override
+ public Object toMetaData(Object entity) {
+ return entity;
}
}
+
}
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncWrapperTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncWrapperTest.java
new file mode 100644
index 0000000..7a611b3
--- /dev/null
+++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncWrapperTest.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.metadata;
+
+
+import org.apache.eventmesh.dashboard.common.enums.MetadataType;
+import org.apache.eventmesh.dashboard.common.model.base.BaseClusterIdBase;
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKManageTest;
+import org.apache.eventmesh.dashboard.core.metadata.MetadataSyncManage.MetadataSyncConfig;
+import org.apache.eventmesh.dashboard.core.metadata.result.MetadataSyncResult;
+import org.apache.eventmesh.dashboard.core.metadata.result.MetadataSyncResultHandler;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class MetadataSyncWrapperTest {
+
+ @Mock
+ private MetadataSyncResultHandler metadataSyncResultHandler;
+
+ @Mock
+ private DataMetadataHandler<BaseClusterIdBase> dataBasesHandler;
+
+ @Mock
+ private DataMetadataHandler<BaseClusterIdBase> clusterService;
+
+
+ private BaseSyncBase baseSyncBase = SDKManageTest.createJvm();
+
+
+ private MetadataSyncWrapper metadataSyncWrapper = new MetadataSyncWrapper();
+
+
+ @Before
+ public void init() throws InstantiationException, IllegalAccessException {
+
+ MetadataSyncConfig metadataSyncConfig = new MetadataSyncConfig();
+ metadataSyncConfig.setBaseSyncBase(baseSyncBase);
+ metadataSyncConfig.setMetadataType(MetadataType.TOPIC);
+ metadataSyncConfig.setMetadataSyncResult(new MetadataSyncResult());
+ metadataSyncConfig.setDataBasesHandler(dataBasesHandler);
+ metadataSyncConfig.setClusterService(clusterService);
+
+ metadataSyncWrapper.setMetadataSyncConfig(metadataSyncConfig);
+ metadataSyncWrapper.setMetadataSyncResultHandler(metadataSyncResultHandler);
+
+ metadataSyncWrapper.createDifference();
+ }
+
+ @Test
+ public void test_readOnly() {
+
+ }
+
+ @Test
+ public void test_firstToWhom() {
+
+ }
+
+ @Test
+ public void test_check() {
+
+ }
+
+ @Test
+ public void test_isSyncClusterData() {
+
+ }
+
+ @Test
+ public void test_isSyncDatabasesData() {
+
+ }
+}
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/remoting/Remoting2ManageTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/remoting/Remoting2ManageTest.java
new file mode 100644
index 0000000..5677065
--- /dev/null
+++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/remoting/Remoting2ManageTest.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.eventmesh.dashboard.core.remoting;
+
+import org.apache.eventmesh.dashboard.common.model.base.BaseClusterIdBase;
+import org.apache.eventmesh.dashboard.common.model.base.BaseSyncBase;
+import org.apache.eventmesh.dashboard.core.function.SDK.SDKManageTest;
+import org.apache.eventmesh.dashboard.core.metadata.DataMetadataHandler;
+import org.apache.eventmesh.dashboard.service.remoting.AclRemotingService;
+
+import org.junit.Test;
+
+public class Remoting2ManageTest {
+
+ Remoting2Manage remoting2Manage = Remoting2Manage.getInstance();
+
+ @Test
+ public void test() {
+ System.out.println(remoting2Manage);
+ }
+
+
+ @Test
+ public void test_createDataMetadataHandler() {
+ BaseSyncBase baseSyncBase = SDKManageTest.createJvm();
+ DataMetadataHandler<BaseClusterIdBase> dataMetadataHandler =
+ remoting2Manage.createDataMetadataHandler(AclRemotingService.class, baseSyncBase);
+ dataMetadataHandler.getData();
+ }
+
+
+}
diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManagerTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManagerTest.java
deleted file mode 100644
index cc16824..0000000
--- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManagerTest.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.core.remoting;
-
-import org.apache.eventmesh.dashboard.common.enums.ClusterType;
-import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata;
-import org.apache.eventmesh.dashboard.common.model.metadata.ClusterRelationshipMetadata;
-import org.apache.eventmesh.dashboard.common.model.remoting.topic.CreateTopicRequest;
-import org.apache.eventmesh.dashboard.service.remoting.RemotingIntegrationService;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.junit.Test;
-
-public class RemotingManagerTest {
-
- private RemotingManager remotingManager = new RemotingManager();
-
-
- @Test
- public void init_test() {
- RemotingIntegrationService proxyObject = (RemotingIntegrationService) remotingManager.getProxyObject();
-
- CreateTopicRequest createTopicRequest = new CreateTopicRequest();
- createTopicRequest.setClusterId(1L);
-
- proxyObject.createTopic(createTopicRequest);
-
- }
-
- @Test
- public void mock_overall_logic() {
- List<ClusterRelationshipMetadata> clusterRelationshipMetadataList = new ArrayList<>();
- AtomicLong clusterId = new AtomicLong(1);
- List<ClusterMetadata> clusterMetadataList = new ArrayList<>();
-
- // 两个 eventmesh 集群
- ClusterMetadata eventMeshCluster1 = new ClusterMetadata();
- eventMeshCluster1.setClusterType(ClusterType.EVENTMESH_CLUSTER);
- eventMeshCluster1.setId(clusterId.incrementAndGet());
- clusterMetadataList.add(eventMeshCluster1);
-
- ClusterMetadata eventMeshCluster2 = new ClusterMetadata();
- eventMeshCluster2.setClusterType(ClusterType.EVENTMESH_CLUSTER);
- eventMeshCluster2.setId(clusterId.incrementAndGet());
- clusterMetadataList.add(eventMeshCluster2);
-
- // 两个注册中心
- ClusterMetadata eventMeshMetaNacos1 = new ClusterMetadata();
- eventMeshMetaNacos1.setClusterType(ClusterType.EVENTMESH_META_NACOS);
- eventMeshMetaNacos1.setId(clusterId.incrementAndGet());
- clusterMetadataList.add(eventMeshMetaNacos1);
- this.relationship(clusterRelationshipMetadataList, eventMeshCluster1, eventMeshMetaNacos1);
- this.relationship(clusterRelationshipMetadataList, eventMeshCluster2, eventMeshMetaNacos1);
-
- ClusterMetadata eventMeshMetaNacos2 = new ClusterMetadata();
- eventMeshMetaNacos2.setClusterType(ClusterType.EVENTMESH_META_NACOS);
- eventMeshMetaNacos2.setId(clusterId.incrementAndGet());
- clusterMetadataList.add(eventMeshMetaNacos2);
- this.relationship(clusterRelationshipMetadataList, eventMeshCluster1, eventMeshMetaNacos2);
- this.relationship(clusterRelationshipMetadataList, eventMeshCluster2, eventMeshMetaNacos2);
-
- // 2个 eventmesh runtime
- ClusterMetadata eventMeshRuntime1 = new ClusterMetadata();
- eventMeshRuntime1.setClusterType(ClusterType.EVENTMESH_RUNTIME);
- eventMeshRuntime1.setId(clusterId.incrementAndGet());
- clusterMetadataList.add(eventMeshRuntime1);
- this.relationship(clusterRelationshipMetadataList, eventMeshCluster1, eventMeshRuntime1);
-
- ClusterMetadata eventMeshRuntime2 = new ClusterMetadata();
- eventMeshRuntime2.setClusterType(ClusterType.EVENTMESH_RUNTIME);
- eventMeshRuntime2.setId(clusterId.incrementAndGet());
- clusterMetadataList.add(eventMeshRuntime2);
- this.relationship(clusterRelationshipMetadataList, eventMeshCluster2, eventMeshRuntime2);
-
- // 两个个 rocketmq 集群
- ClusterMetadata rocketMCluster = new ClusterMetadata();
- rocketMCluster.setClusterType(ClusterType.STORAGE_ROCKETMQ_CLUSTER);
- rocketMCluster.setId(clusterId.incrementAndGet());
- clusterMetadataList.add(rocketMCluster);
- this.relationship(clusterRelationshipMetadataList, eventMeshCluster1, rocketMCluster);
-
- ClusterMetadata rocketMCluster1 = new ClusterMetadata();
- rocketMCluster1.setClusterType(ClusterType.STORAGE_ROCKETMQ_CLUSTER);
- rocketMCluster1.setId(clusterId.incrementAndGet());
- clusterMetadataList.add(rocketMCluster1);
- this.relationship(clusterRelationshipMetadataList, eventMeshCluster2, rocketMCluster1);
-
- // 2个 rocketmq broker 集群
- ClusterMetadata rocketBroker = new ClusterMetadata();
- rocketBroker.setClusterType(ClusterType.STORAGE_ROCKETMQ_BROKER);
- rocketBroker.setId(clusterId.incrementAndGet());
- clusterMetadataList.add(rocketBroker);
- this.relationship(clusterRelationshipMetadataList, rocketMCluster, rocketBroker);
-
- ClusterMetadata rocketBroker1 = new ClusterMetadata();
- rocketBroker1.setClusterType(ClusterType.STORAGE_ROCKETMQ_BROKER);
- rocketBroker1.setId(clusterId.incrementAndGet());
- clusterMetadataList.add(rocketBroker1);
- this.relationship(clusterRelationshipMetadataList, rocketMCluster1, rocketBroker1);
-
- // 两个 nameservier
- ClusterMetadata rocketMQNameserver = new ClusterMetadata();
- rocketMQNameserver.setClusterType(ClusterType.STORAGE_ROCKETMQ_NAMESERVER);
- rocketMQNameserver.setId(clusterId.incrementAndGet());
- clusterMetadataList.add(rocketMQNameserver);
- this.relationship(clusterRelationshipMetadataList, rocketBroker, rocketMQNameserver);
- this.relationship(clusterRelationshipMetadataList, rocketBroker1, rocketMQNameserver);
-
- ClusterMetadata rocketMQNameserver1 = new ClusterMetadata();
- rocketMQNameserver1.setClusterType(ClusterType.STORAGE_ROCKETMQ_NAMESERVER);
- rocketMQNameserver1.setId(clusterId.incrementAndGet());
- clusterMetadataList.add(rocketMQNameserver1);
- this.relationship(clusterRelationshipMetadataList, rocketBroker, rocketMQNameserver1);
- this.relationship(clusterRelationshipMetadataList, rocketBroker1, rocketMQNameserver1);
-
- try {
- remotingManager.cacheCluster(clusterMetadataList);
- remotingManager.cacheClusterRelationship(clusterRelationshipMetadataList);
- remotingManager.loadingCompleted();
-
- RemotingIntegrationService proxyObject = (RemotingIntegrationService) remotingManager.getProxyObject();
- CreateTopicRequest createTopicRequest = new CreateTopicRequest();
- createTopicRequest.setClusterId(9L);
- proxyObject.createTopic(createTopicRequest);
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
-
- }
-
-
- private void relationship(List<ClusterRelationshipMetadata> clusterRelationshipMetadataList, ClusterMetadata clusterMetadata,
- ClusterMetadata relationship) {
- clusterMetadata.setStatus(0);
- relationship.setStatus(0);
-
- ClusterRelationshipMetadata clusterRelationshipMetadata = new ClusterRelationshipMetadata();
- clusterRelationshipMetadata.setClusterType(clusterMetadata.getClusterType());
- clusterRelationshipMetadata.setClusterId(clusterMetadata.getId());
- clusterRelationshipMetadata.setRelationshipId(relationship.getId());
- clusterRelationshipMetadata.setRelationshipType(relationship.getClusterType());
- clusterRelationshipMetadataList.add(clusterRelationshipMetadata);
- }
-
-
-}
diff --git a/eventmesh-dashboard-observe/pom.xml b/eventmesh-dashboard-observe/pom.xml
index 07c2ac9..b74059f 100644
--- a/eventmesh-dashboard-observe/pom.xml
+++ b/eventmesh-dashboard-observe/pom.xml
@@ -16,6 +16,7 @@
~ limitations under the License.
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
diff --git a/eventmesh-dashboard-service/pom.xml b/eventmesh-dashboard-service/pom.xml
index c5c2be2..a57008b 100644
--- a/eventmesh-dashboard-service/pom.xml
+++ b/eventmesh-dashboard-service/pom.xml
@@ -31,7 +31,7 @@
<name>eventmesh-dashboard-service</name>
<properties>
- <java.version>1.8</java.version>
+ <java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/dto/RocketmqProperties.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/dto/RocketmqProperties.java
index b17e9af..258820b 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/dto/RocketmqProperties.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/dto/RocketmqProperties.java
@@ -15,11 +15,13 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.service.dto;
import lombok.Data;
@Data
+@Deprecated
public class RocketmqProperties {
private String namesrvAddr;
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/dto/TopicProperties.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/dto/TopicProperties.java
index 4eedc69..c9ab746 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/dto/TopicProperties.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/dto/TopicProperties.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.service.dto;
import lombok.Data;
@@ -24,6 +25,7 @@
*/
@Data
+@Deprecated
public class TopicProperties {
private String topicName;
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/ConnectionCore.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/ConnectionCore.java
index 818c6b3..5a79e88 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/ConnectionCore.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/ConnectionCore.java
@@ -15,13 +15,14 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.service.meta;
/**
* "Connection" refers to the subscription relationship between connectors. It focuses on the configuration deployed on the source and sink connectors
* themselves, reported by the connector.
*/
-
+@Deprecated
public interface ConnectionCore {
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/SubscriptionCore.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/SubscriptionCore.java
deleted file mode 100644
index e27974f..0000000
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/SubscriptionCore.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.eventmesh.dashboard.service.meta;
-
-import org.apache.eventmesh.dashboard.common.dto.Result;
-import org.apache.eventmesh.dashboard.common.model.SubscriptionInfo;
-
-import java.util.List;
-
-/**
- * "Subscription" refers to the traditional MQ producer-consumer topic subscription relationship, emphasizing the subscription relationship between
- * EventMesh clients (including SDK and connectors) and topics, reported by the EventMesh runtime.
- */
-
-public interface SubscriptionCore {
-
- String retrieveConfig(String dataId, String group);
-
- Result<List<SubscriptionInfo>> retrieveConfigs(Integer page, Integer size, String dataId, String group);
-}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/operation/connector/ConnectorOptService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/operation/connector/ConnectorOptService.java
index b2c451f..d97a64b 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/operation/connector/ConnectorOptService.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/operation/connector/ConnectorOptService.java
@@ -15,11 +15,13 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.service.operation.connector;
/**
* k8s operation service
*/
+@Deprecated
public interface ConnectorOptService {
void createConnector();
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/operation/connector/RuntimeOptService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/operation/connector/RuntimeOptService.java
index 6b8d5ec..3939e7c 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/operation/connector/RuntimeOptService.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/operation/connector/RuntimeOptService.java
@@ -15,11 +15,13 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.service.operation.connector;
/**
* k8s operation service
*/
+@Deprecated
public interface RuntimeOptService {
void createRuntime();
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/AclRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/AclRemotingService.java
index 3f99986..0dcf942 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/AclRemotingService.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/AclRemotingService.java
@@ -15,13 +15,16 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.service.remoting;
+import org.apache.eventmesh.dashboard.common.annotation.RemotingServiceMethodMapper;
+import org.apache.eventmesh.dashboard.common.model.remoting.RemotingActionType;
import org.apache.eventmesh.dashboard.common.model.remoting.acl.CreateAclRequest;
import org.apache.eventmesh.dashboard.common.model.remoting.acl.CreateAclResult;
import org.apache.eventmesh.dashboard.common.model.remoting.acl.DeleteAclRequest;
import org.apache.eventmesh.dashboard.common.model.remoting.acl.DeleteAclResult;
-import org.apache.eventmesh.dashboard.common.model.remoting.acl.GetAclsRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.acl.GetAcls2Request;
import org.apache.eventmesh.dashboard.common.model.remoting.acl.GetAclsResult;
/**
@@ -29,9 +32,12 @@
*/
public interface AclRemotingService {
+ @RemotingServiceMethodMapper({RemotingActionType.ADD, RemotingActionType.UPDATE})
CreateAclResult createAcl(CreateAclRequest createAclRequest);
+ @RemotingServiceMethodMapper(RemotingActionType.DELETE)
DeleteAclResult deleteAcl(DeleteAclRequest deleteAclRequest);
- GetAclsResult getAllAcls(GetAclsRequest getAclsRequest);
+ @RemotingServiceMethodMapper(RemotingActionType.QUEUE_ALL)
+ GetAclsResult getAllAcls(GetAcls2Request getAclsRequest);
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ClientRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ClientRemotingService.java
index 44d7a3d..3fb59ae 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ClientRemotingService.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ClientRemotingService.java
@@ -15,10 +15,13 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.service.remoting;
+import org.apache.eventmesh.dashboard.common.annotation.RemotingServiceMethodMapper;
import org.apache.eventmesh.dashboard.common.model.metadata.ClientMetadata;
+import org.apache.eventmesh.dashboard.common.model.remoting.RemotingActionType;
import java.util.List;
@@ -27,6 +30,6 @@
*/
public interface ClientRemotingService {
- // get consumer only for now
+ @RemotingServiceMethodMapper(RemotingActionType.QUEUE_ALL)
List<ClientMetadata> getClientList();
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConfigRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConfigRemotingService.java
index e38954f..e7e1046 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConfigRemotingService.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConfigRemotingService.java
@@ -15,14 +15,17 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.service.remoting;
+import org.apache.eventmesh.dashboard.common.annotation.RemotingServiceMethodMapper;
import org.apache.eventmesh.dashboard.common.model.remoting.BaseGlobalResult;
+import org.apache.eventmesh.dashboard.common.model.remoting.RemotingActionType;
import org.apache.eventmesh.dashboard.common.model.remoting.config.AddConfigRequest;
import org.apache.eventmesh.dashboard.common.model.remoting.config.DeleteConfigRequest;
import org.apache.eventmesh.dashboard.common.model.remoting.config.GetConfigRequest;
import org.apache.eventmesh.dashboard.common.model.remoting.config.UpdateConfigRequest;
-import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopics2Request;
import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResult;
/**
@@ -31,17 +34,20 @@
public interface ConfigRemotingService {
+ @RemotingServiceMethodMapper({RemotingActionType.ADD, RemotingActionType.UPDATE})
BaseGlobalResult addConfig(AddConfigRequest addConfigRequest);
default BaseGlobalResult updateConfig(UpdateConfigRequest updateConfigRequest) {
return addConfig(updateConfigRequest);
}
+ @RemotingServiceMethodMapper(RemotingActionType.DELETE)
default BaseGlobalResult deleteConfig(DeleteConfigRequest deleteConfigRequest) {
return addConfig(deleteConfigRequest);
}
GetTopicsResult getConfig(GetConfigRequest getConfigRequest);
- GetTopicsResult getAllTopics(GetTopicsRequest getTopicsRequest);
+ @RemotingServiceMethodMapper(RemotingActionType.QUEUE_ALL)
+ GetTopicsResult getAllTopics(GetTopics2Request getTopicsRequest);
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConnectorRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConnectorRemotingService.java
index 1164b38..f41fdd7 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConnectorRemotingService.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConnectorRemotingService.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.service.remoting;
import org.apache.eventmesh.dashboard.common.model.remoting.connector.CreateConnectorRequest;
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RuntimeRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConsumeOffsetRemotingService.java
similarity index 73%
rename from eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RuntimeRemotingService.java
rename to eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConsumeOffsetRemotingService.java
index b673c27..06ac866 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RuntimeRemotingService.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConsumeOffsetRemotingService.java
@@ -17,13 +17,16 @@
package org.apache.eventmesh.dashboard.service.remoting;
-import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeRequest;
-import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeResult;
+import org.apache.eventmesh.dashboard.common.model.metadata.ConsumeOffsetMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata;
+
+import java.util.List;
/**
*
*/
-public interface RuntimeRemotingService {
+public interface ConsumeOffsetRemotingService {
- GetRuntimeResult getRuntimeMetadata(GetRuntimeRequest request);
+
+ List<ConsumeOffsetMetadata> getConsumeOffsetMetadata(TopicMetadata topicMetadata);
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/GroupRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/GroupRemotingService.java
index 2540746..b4df912 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/GroupRemotingService.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/GroupRemotingService.java
@@ -15,8 +15,13 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.service.remoting;
+import org.apache.eventmesh.dashboard.common.annotation.RemotingServiceMethodMapper;
+import org.apache.eventmesh.dashboard.common.model.remoting.BaseGlobalResult;
+import org.apache.eventmesh.dashboard.common.model.remoting.Global2Request;
+import org.apache.eventmesh.dashboard.common.model.remoting.RemotingActionType;
import org.apache.eventmesh.dashboard.common.model.remoting.group.GetGroupResult;
import org.apache.eventmesh.dashboard.common.model.remoting.group.GetGroupsRequest;
@@ -25,5 +30,9 @@
*/
public interface GroupRemotingService {
+ @RemotingServiceMethodMapper(RemotingActionType.QUEUE_ALL)
GetGroupResult getAllGroups(GetGroupsRequest getGroupsRequest);
+
+ @RemotingServiceMethodMapper(RemotingActionType.DELETE)
+ BaseGlobalResult deleteGroup(Global2Request global2Request);
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/MetaRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/MetaRemotingService.java
index de9876d..e00cefe 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/MetaRemotingService.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/MetaRemotingService.java
@@ -15,9 +15,12 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.service.remoting;
-import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeRequest;
+import org.apache.eventmesh.dashboard.common.annotation.RemotingServiceMethodMapper;
+import org.apache.eventmesh.dashboard.common.model.remoting.RemotingActionType;
+import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntime2Request;
import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeResult;
/**
@@ -25,5 +28,6 @@
*/
public interface MetaRemotingService {
- GetRuntimeResult getRuntime(GetRuntimeRequest getRuntimeRequest);
+ @RemotingServiceMethodMapper(RemotingActionType.QUEUE_ALL)
+ GetRuntimeResult getRuntime(GetRuntime2Request getRuntimeRequest);
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/OffsetRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/OffsetRemotingService.java
index 4e2d365..2fc5145 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/OffsetRemotingService.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/OffsetRemotingService.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.service.remoting;
import org.apache.eventmesh.dashboard.common.model.remoting.offset.GetOffsetRequest;
@@ -27,6 +28,7 @@
*/
public interface OffsetRemotingService {
+
GetOffsetResult getOffset(GetOffsetRequest getOffsetRequest);
ResetOffsetResult resetOffset(ResetOffsetRequest resetOffsetRequest);
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingIntegrationService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingIntegrationService.java
index 0f11742..6891f9d 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingIntegrationService.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingIntegrationService.java
@@ -15,11 +15,13 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.service.remoting;
/**
*
*/
+@Deprecated
public interface RemotingIntegrationService extends AclRemotingService, ClientRemotingService, ConfigRemotingService, ConnectorRemotingService,
GroupRemotingService, MetaRemotingService, OffsetRemotingService, SubscriptionRemotingService, TopicRemotingService, UserRemotingService {
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/SubscriptionRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/SubscriptionRemotingService.java
index 887c1f8..2663139 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/SubscriptionRemotingService.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/SubscriptionRemotingService.java
@@ -15,8 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.service.remoting;
+import org.apache.eventmesh.dashboard.common.annotation.RemotingServiceMethodMapper;
+import org.apache.eventmesh.dashboard.common.model.remoting.RemotingActionType;
import org.apache.eventmesh.dashboard.common.model.remoting.subscription.GetSubscriptionRequest;
import org.apache.eventmesh.dashboard.common.model.remoting.subscription.GetSubscriptionResult;
@@ -25,6 +28,7 @@
*/
public interface SubscriptionRemotingService {
+ @RemotingServiceMethodMapper(RemotingActionType.QUEUE_ALL)
GetSubscriptionResult getSubscription(GetSubscriptionRequest request);
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RuntimeRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/TopicOffsetRemotingService.java
similarity index 73%
copy from eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RuntimeRemotingService.java
copy to eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/TopicOffsetRemotingService.java
index b673c27..efc980d 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RuntimeRemotingService.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/TopicOffsetRemotingService.java
@@ -17,13 +17,16 @@
package org.apache.eventmesh.dashboard.service.remoting;
-import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeRequest;
-import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeResult;
+import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.TopicOffsetMetadata;
+
+import java.util.List;
/**
- *
+ *
*/
-public interface RuntimeRemotingService {
+public interface TopicOffsetRemotingService {
- GetRuntimeResult getRuntimeMetadata(GetRuntimeRequest request);
+
+ List<TopicOffsetMetadata> getTopicOffsetMetadata(TopicMetadata topicMetadata);
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/TopicRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/TopicRemotingService.java
index 00b255c..dd389cf 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/TopicRemotingService.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/TopicRemotingService.java
@@ -15,13 +15,16 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.service.remoting;
-import org.apache.eventmesh.dashboard.common.model.remoting.topic.CreateTopicRequest;
+import org.apache.eventmesh.dashboard.common.annotation.RemotingServiceMethodMapper;
+import org.apache.eventmesh.dashboard.common.model.remoting.RemotingActionType;
+import org.apache.eventmesh.dashboard.common.model.remoting.topic.CreateTopic2Request;
import org.apache.eventmesh.dashboard.common.model.remoting.topic.CreateTopicResult;
import org.apache.eventmesh.dashboard.common.model.remoting.topic.DeleteTopicRequest;
import org.apache.eventmesh.dashboard.common.model.remoting.topic.DeleteTopicResult;
-import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsRequest;
+import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopics2Request;
import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResult;
/**
@@ -29,10 +32,14 @@
*/
public interface TopicRemotingService {
- CreateTopicResult createTopic(CreateTopicRequest createTopicRequest);
+ @RemotingServiceMethodMapper({RemotingActionType.ADD, RemotingActionType.UPDATE})
+ CreateTopicResult createTopic(CreateTopic2Request createTopicRequest);
+ @RemotingServiceMethodMapper(RemotingActionType.DELETE)
DeleteTopicResult deleteTopic(DeleteTopicRequest deleteTopicRequest);
- GetTopicsResult getAllTopics(GetTopicsRequest getTopicsRequest);
+ @RemotingServiceMethodMapper(RemotingActionType.QUEUE_ALL)
+ GetTopicsResult getAllTopics(GetTopics2Request getTopicsRequest)
+ throws Exception;
}
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/UserRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/UserRemotingService.java
index 5f5e18d..b591381 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/UserRemotingService.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/UserRemotingService.java
@@ -15,8 +15,11 @@
* limitations under the License.
*/
+
package org.apache.eventmesh.dashboard.service.remoting;
+import org.apache.eventmesh.dashboard.common.annotation.RemotingServiceMethodMapper;
+import org.apache.eventmesh.dashboard.common.model.remoting.RemotingActionType;
import org.apache.eventmesh.dashboard.common.model.remoting.user.CreateUserRequest;
import org.apache.eventmesh.dashboard.common.model.remoting.user.DeleterUserRequest;
import org.apache.eventmesh.dashboard.common.model.remoting.user.GetUserRequest;
@@ -27,9 +30,12 @@
*/
public interface UserRemotingService {
+ @RemotingServiceMethodMapper({RemotingActionType.ADD, RemotingActionType.UPDATE})
CreateUserRequest createInstanceUser(CreateUserRequest request);
+ @RemotingServiceMethodMapper(RemotingActionType.DELETE)
DeleterUserRequest deleteInstanceUser(DeleterUserRequest request);
+ @RemotingServiceMethodMapper(RemotingActionType.QUEUE_ALL)
GetUserResult getInstanceUser(GetUserRequest request);
}
diff --git a/pom.xml b/pom.xml
index afcb7a8..bcf45f1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -71,8 +71,9 @@
</issueManagement>
<properties>
- <maven.compiler.source>8</maven.compiler.source>
- <maven.compiler.target>8</maven.compiler.target>
+ <maven.compiler.source>17</maven.compiler.source>
+ <maven.compiler.target>17</maven.compiler.target>
+ <maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot.version>2.7.18</spring-boot.version>
<mybatis-spring-boot.version>2.3.2</mybatis-spring-boot.version>
@@ -148,8 +149,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
- <source>1.8</source>
- <target>1.8</target>
+ <source>17</source>
+ <target>17</target>
<encoding>UTF-8</encoding>
<testIncludes>
<testInclude>none</testInclude>
@@ -218,11 +219,9 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.20.1</version>
+ <version>3.5.3</version>
<configuration>
- <argLine>-Xmx512m -XX:PermSize=128m
- -XX:MaxPermSize=128m
- </argLine>
+ <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
<testFailureIgnore>true</testFailureIgnore>
<includes>
<include>**/*Test*.java</include>