Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #21] Implement Connection related code #22

Merged
merged 9 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public class ConnectionResponse implements Serializable {
@Schema(name = "sourceStatus", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:not active, 1:active")
private Integer sourceStatus;

@Schema(name = "sourceConfigList", description = "source config list")
private List<ConfigEntity> sourceConfigList;
// @Schema(name = "sourceConfigList", description = "source config list")
// private List<ConfigEntity> sourceConfigList;

@Schema(name = "sinkType", defaultValue = "connector", allowableValues = {"connector", "client"})
private String sinkType;
Expand All @@ -50,8 +50,8 @@ public class ConnectionResponse implements Serializable {
@Schema(name = "sinkStatus", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:not active, 1:active")
private Integer sinkStatus;

@Schema(name = "sinkConfigList", description = "sink config list")
private List<ConfigEntity> sinkConfigList;
// @Schema(name = "sinkConfigList", description = "sink config list")
// private List<ConfigEntity> sinkConfigList;

private Long runtimeId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,78 @@
package org.apache.eventmesh.dashboard.console.entity.client;

import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity;
import org.apache.eventmesh.dashboard.console.enums.StatusEnum;

import java.sql.Timestamp;

import io.swagger.v3.oas.annotations.media.Schema;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ClientEntity extends BaseEntity {

private static final long serialVersionUID = 8204133370609215856L;

/**
* Primary key
*/
@Schema(name = "id", description = "primary key")
private Long id;

private String name;

private String platform;

/**
* programing language of client
*/
@Schema(name = "language", example = "java")
private String language;

/**
* process id
*/
@Schema(name = "pid", description = "process id")
private Long pid;

private String host;

private Integer port;

/**
* protocol used to connect to runtime.
*/
@Schema(name = "protocol", example = "http", allowableValues = {"http", "grpc", "tcp"})
private String protocol;

/**
* 0: not active, 1: active
* @see StatusEnum
*/
@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 used during the configuration retrieval process.
*/
private String configIds;

private String description;

/**
* The time when the client is terminated.
*/
private Timestamp endTime;

public void setStatusEntity(StatusEnum status) {
this.status = status.getNumber();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.eventmesh.dashboard.console.entity.connection;

import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity;
import org.apache.eventmesh.dashboard.console.enums.StatusEnum;

import java.sql.Timestamp;
import java.util.Objects;
Expand All @@ -34,6 +35,10 @@
public class ConnectionEntity extends BaseEntity {

private static final long serialVersionUID = 6565578252656944905L;

/**
* Primary key
*/
@Schema(name = "id", description = "primary key")
private Long id;

Expand All @@ -43,6 +48,10 @@ public class ConnectionEntity extends BaseEntity {
@Schema(name = "sourceType", defaultValue = "connector", allowableValues = {"connector", "client"})
private String sourceType;

/**
* The id of the source.<br>
* It can be connectorId or clientId according to the sourceType.
*/
@Schema(name = "sourceId", description = "connectorId or clientId")
private Long sourceId;

Expand All @@ -52,6 +61,10 @@ public class ConnectionEntity extends BaseEntity {
@Schema(name = "sinkType", defaultValue = "connector", allowableValues = {"connector", "client"})
private String sinkType;

/**
* The id of the sink.<br>
* It can be connectorId or clientId according to the sinkType.
*/
@Schema(name = "sinkId", description = "connectorId or clientId")
private Long sinkId;

Expand All @@ -68,6 +81,10 @@ public class ConnectionEntity extends BaseEntity {

private String description;

public void setStatusEnum(StatusEnum statusEnum) {
this.status = statusEnum.getNumber();
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,18 @@
package org.apache.eventmesh.dashboard.console.entity.connector;

import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity;
import org.apache.eventmesh.dashboard.console.enums.KubernetesPodStatusEnum;
import org.apache.eventmesh.dashboard.console.enums.StatusEnum;

import io.swagger.v3.oas.annotations.media.Schema;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ConnectorEntity extends BaseEntity {

private static final long serialVersionUID = -8226303660232951326L;
Expand All @@ -34,14 +43,32 @@ public class ConnectorEntity extends BaseEntity {

private String type;

private String status;
/**
* 0: not active, 1: active
*
* @see StatusEnum
*/
@Schema(name = "status", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:inactive, 1:active")
private Integer status;

/**
* @see KubernetesPodStatusEnum
*/
@Schema(name = "podState", defaultValue = "0", allowableValues = {"0", "1", "2", "3", "4", "5",
"6"}, description = "0:Pending, 1:Running, 2:Succeeded, 3:Failed, 4:Unknown, 5:Terminating, 6:Terminated")
private Integer podState;

/**
* 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 used during the configuration retrieval process.
* 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
* used during the configuration retrieval process.
*/
private String configIds;

public void setStatusEnum(StatusEnum statusEnum) {
this.status = statusEnum.getNumber();
}

public void setKubernetesPodStatusEnum(KubernetesPodStatusEnum kubernetesPodStatusEnum) {
this.podState = kubernetesPodStatusEnum.getNumber();
}
Pil0tXia marked this conversation as resolved.
Show resolved Hide resolved
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@
package org.apache.eventmesh.dashboard.console.entity.meta;

import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity;
import org.apache.eventmesh.dashboard.console.enums.StatusEnum;

import io.swagger.v3.oas.annotations.media.Schema;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class MetaEntity extends BaseEntity {

private static final long serialVersionUID = 7176263169716424469L;
Expand Down Expand Up @@ -52,5 +57,14 @@ public class MetaEntity extends BaseEntity {

private String params;

/**
* 0: not active, 1: active
* @see StatusEnum
*/
@Schema(name = "status", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:inactive, 1:active")
private Integer status;

public void setStatusEnum(StatusEnum statusEnum) {
this.status = statusEnum.getNumber();
}
}
Original file line number Diff line number Diff line change
@@ -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.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum KubernetesPodStatusEnum {
PENDING(0, "Pending"),
Pil0tXia marked this conversation as resolved.
Show resolved Hide resolved
RUNNING(1, "Running"),
SUCCEEDED(2, "Succeeded"),
FAILED(3, "Failed"),
UNKNOWN(4, "Unknown"),
TERMINATING(5, "Terminating"),
TERMINATED(6, "Terminated");

private final Integer number;
private final String name;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@

package org.apache.eventmesh.dashboard.console.enums;

public enum KubernetesPodStatus {
PENDING(0, "pending"),
RUNNING(1, "running"),
SUCCEEDED(2, "succeeded"),
FAILED(3, "failed"),
UNKNOWN(4, "unknown");
import lombok.AllArgsConstructor;
import lombok.Getter;

KubernetesPodStatus(Integer number, String status) {
}
@Getter
@AllArgsConstructor
public enum StatusEnum {
INACTIVE(0, "Inactive"),
ACTIVE(1, "Active");

private final Integer number;
private final String name;
Pil0tXia marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,14 @@
* limitations under the License.
*/

package org.apache.eventmesh.dashboard.console.enums.health;
package org.apache.eventmesh.dashboard.console.scheduler.health;

public enum HealthCheckDimensionEnum {
UNKNOWN(0, "unknown"),
import org.springframework.stereotype.Component;

CLUSTER(1, "cluster"),
import lombok.extern.slf4j.Slf4j;

RUNTIME(2, "runtime"),
@Slf4j
@Component
public class HealthCheckScheduler {

TOPIC(3, "topic"),

GROUP(4, "group");

HealthCheckDimensionEnum(Integer dimensionId, String dimensionName) {
}
}
Loading
Loading