Skip to content

Commit

Permalink
fixes apache#21
Browse files Browse the repository at this point in the history
ADD:
connection related code:
Connection/Client/Connector: Mapper,Entity
Connection: ConnectionService,ConnectionDataService
others:
eventmesh-dashboard.sql
test resources

MODIFY:
pom file: remove dependency of junit, spring-boot-starter-test contains it.
pom file: let service module depend on core module.
  • Loading branch information
Lambert-Rao committed Jan 26, 2024
1 parent ad4bd7a commit fcfa32e
Show file tree
Hide file tree
Showing 24 changed files with 1,053 additions and 7 deletions.
4 changes: 0 additions & 4 deletions eventmesh-dashboard-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@

package org.apache.eventmesh.dashboard.console;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@SpringBootApplication
@EnableScheduling
@ComponentScan({"org.apache.eventmesh.dashboard.service", "org.apache.eventmesh.dashboard.console"})
public class EventmeshConsoleApplication {

Expand Down
Original file line number Diff line number Diff line change
@@ -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.console.config;

import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.stereotype.Component;

@Component
public class SchedulerConfig {

@Bean
public ThreadPoolTaskScheduler taskScheduler() {
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
taskScheduler.setPoolSize(5);
return taskScheduler;
}
}
Original file line number Diff line number Diff line change
@@ -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.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;

@Configuration
public class SpringDocConfig {

@Bean
public OpenAPI eventmeshDashboardConsoleOpenAPI() {
return new OpenAPI()
.info(new Info()
.title("Eventmesh Dashboard Console API")
.version("v1")
.license(new License()
.name("License: Apache 2.0")
.url("http://www.apache.org/licenses/LICENSE-2.0")
)
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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.constant;

public class ApiPrefix {
public static final String API_PREFIX = "/eventmesh-dashboard/";

public static final String API_V1_PREFIX = API_PREFIX + "v1/";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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.connection;

import org.springframework.web.bind.annotation.RestController;

@RestController
public class ConnectionController {

}
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.entity.base;

import java.io.Serializable;
import java.sql.Timestamp;

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

import lombok.Data;

@Data
@Schema(name = "BaseEntity", description = "Base entity")
public class BaseEntity implements Serializable {

private Long clusterPhyId;

protected Timestamp createTime;

protected Timestamp updateTime;
}
Original file line number Diff line number Diff line change
@@ -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.client;

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

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

public class ClientEntity extends BaseEntity {

private static final long serialVersionUID = 1L;

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

private String name;

private String eventmeshAddress;

private String platform;

private String language;

private Long pid;

private String host;

private Integer port;

private String protocol;

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

private String description;
}

Original file line number Diff line number Diff line change
@@ -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.entity.connection;

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

import java.util.Objects;

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

import lombok.Data;


/**
* A Connection is a link from a source to a sink.
*/
@Data
public class ConnectionEntity extends BaseEntity {

private static final long serialVersionUID = 1L;

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

@Schema(name = "sourceType", defaultValue = "connector", allowableValues = {"connector", "client"})
private String sourceType;

/**
* The type of source. Possible values are "connector" and "client".
*/
@Schema(name = "sourceId", description = "connectorId or clientId")
private Long sourceId;

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

/**
* The type of sink. Possible values are "connector" and "client".
*/
@Schema(name = "sinkType", defaultValue = "connector", allowableValues = {"connector", "client"})
private String sinkType;

@Schema(name = "sinkId", description = "connectorId or clientId")
private Long sinkId;

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

private Long runtimeId;

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

@Schema(name = "topic", description = "related topic name from storage")
private String topic;

private Long groupId;

private String groupName;

private String description;

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ConnectionEntity that = (ConnectionEntity) o;
return Objects.equals(sourceType, that.sourceType)
&& Objects.equals(sourceId, that.sourceId)
&& Objects.equals(sourceStatus, that.sourceStatus)

&& Objects.equals(sinkType, that.sinkType)
&& Objects.equals(sinkId, that.sinkId)
&& Objects.equals(sinkStatus, that.sinkStatus)

&& Objects.equals(runtimeId, that.runtimeId)
&& Objects.equals(status, that.status)

&& Objects.equals(topic, that.topic)
&& Objects.equals(groupId, that.groupId)
&& Objects.equals(groupName, that.groupName)

&& Objects.equals(description, that.description);
}
}
Loading

0 comments on commit fcfa32e

Please sign in to comment.