Skip to content

Commit

Permalink
[ISSUE #51] Config Mgmt basic function and config,runtime,store,clust…
Browse files Browse the repository at this point in the history
…er SQL (#52)

* refactor: add dependency of console module and move controllers into console module.

* fix: add logback config, fix application-dev.yml and move `</dependencyManagement>` to root `pom.xml` as pointed out in PR#19.

* FirstCommit

* remerge

* first improve

* second improve

* third improve

* fourth improve

* fourth improve

* fourth improve

* Update and rename EventmeshConsoleApplication.java to EventMeshDashboardApplication.java

* rename this starter class file to EventMeshDashboardApplication

* rename this starter class file to EventMeshDashboardApplication

* change some resource file

* improve name

* improve name

* Modify the fields of the synchronized log table

* improve name

* improve name

* config basic function and config ,runtime,store,cluster sql

* try to resolve build error

* Some changes in the specification

* something rename

* one sql update

* tag something to do

---------

Co-authored-by: lambert@arch <[email protected]>
Co-authored-by: 周倬贤 <[email protected]>
  • Loading branch information
3 people committed Mar 8, 2024
1 parent 62a478d commit 4eb9f83
Show file tree
Hide file tree
Showing 40 changed files with 1,945 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -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.entity.cluster;

import java.sql.Timestamp;

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

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ClusterEntity {

private Long id;

private String name;

private String registerNameList;

private String bootstrapServers;

private String eventmeshVersion;

private String clientProperties;

private String jmxProperties;

private String regProperties;

private String description;

private Integer authType;

private Integer runState;

private Timestamp createTime;

private Timestamp updateTime;
}
Original file line number Diff line number Diff line change
@@ -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.console.entity.config;

import java.sql.Timestamp;

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

@NoArgsConstructor
@AllArgsConstructor
@Data
public class ConfigEntity {

private Long id;

private Long clusterId;

private String businessType;

private Integer instanceType;

private Long instanceId;

private String configName;

private String configValue;

private String startVersion;

private String eventmeshVersion;

private Integer status;

private String endVersion;

private Integer diffType;

private String description;

private Integer edit;

private Timestamp createTime;

private Timestamp updateTime;

private Integer isDefault;

private Integer isModify;
}
Original file line number Diff line number Diff line change
@@ -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.entity.runtime;

import java.sql.Timestamp;

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

@Data
@NoArgsConstructor
@AllArgsConstructor
public class RuntimeEntity {

private Long id;

private Long clusterId;

private String host;

private Long storageClusterId;

private Integer port;

private Integer jmxPort;

private Long startTimestamp;

private String rack;

private Integer status;

private Timestamp createTime;

private Timestamp updateTime;

private String endpointMap;
}
Original file line number Diff line number Diff line change
@@ -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.console.entity.storage;


import java.sql.Timestamp;

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

@Data
@NoArgsConstructor
@AllArgsConstructor
public class StoreEntity {

private Long id;

private Long clusterId;

private Integer storeId;

private String storeType;

private String host;

private Long runtimeId;

private String topicList;

private Short diffType;

private Integer port;

private Integer jmxPort;

private String rack;

private Short status;

private Timestamp createTime;

private Timestamp updateTime;

private String endpointMap;

private Long startTimestamp;
}
Original file line number Diff line number Diff line change
@@ -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.mapper.cluster;

import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;

import org.apache.ibatis.annotations.Delete;
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;

/**
* cluster table operation
*/
@Mapper
public interface ClusterMapper {

@Select("SELECT * FROM cluster WHERE is_delete=0")
List<ClusterEntity> selectAllCluster();

@Select("SELECT * FROM cluster WHERE id=#{id} AND is_delete=0")
ClusterEntity selectClusterById(ClusterEntity cluster);

@Insert("INSERT INTO cluster (name, register_name_list, bootstrap_servers, eventmesh_version, client_properties, "
+ "jmx_properties, reg_properties, description, auth_type, run_state) VALUES (#{name},#{registerNameList},"
+ "#{bootstrapServers},#{eventmeshVersion},#{clientProperties},#{jmxProperties},#{regProperties},#{description},#{authType},#{runState})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void addCluster(ClusterEntity cluster);

@Update("UPDATE cluster SET name =#{name},reg_properties=#{regProperties},bootstrap_servers=#{bootstrapServers},"
+ "eventmesh_version=#{eventmeshVersion},client_properties=#{clientProperties},jmx_properties=#{jmxProperties},"
+ "reg_properties=#{regProperties},description=#{description},auth_type=#{authType},run_state=#{runState} ,"
+ "register_name_list=#{registerNameList} WHERE id=#{id}")
void updateClusterById(ClusterEntity cluster);

@Delete("UPDATE cluster SET is_delete=1 WHERE id=#{id}")
void deleteClusterById(ClusterEntity clusterEntity);

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

import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;

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;

/**
* config table operation
*/
@Mapper
public interface ConfigMapper {

@Insert("INSERT INTO config (cluster_id, business_type, instance_type, instance_id, config_name,"
+ " config_value, start_version,eventmesh_version, description, edit,end_version,is_default,is_modify) VALUE "
+ "(#{clusterId},#{businessType},#{instanceType},#{instanceId},#{configName},"
+ "#{configValue},#{startVersion},#{eventmeshVersion},#{description},#{edit},#{endVersion},#{isDefault},#{isModify})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
Integer addConfig(ConfigEntity configEntity);

@Update("UPDATE config SET status=2 WHERE id=#{id}")
Integer deleteConfig(ConfigEntity configEntity);

@Update("UPDATE config SET config_value=#{configValue} WHERE status=1 AND edit=2")
void updateConfig(ConfigEntity configEntity);

@Select("SELECT * FROM config WHERE business_type=#{businessType} AND instance_type=#{instanceType} "
+ "AND instance_id=#{instanceId}")
List<ConfigEntity> selectByInstanceId(ConfigEntity configEntity);

@Select("SELECT * FROM config WHERE cluster_id=-1 AND business_type=#{businessType} AND instance_type=#{instanceType}")
List<ConfigEntity> selectDefaultConfig(ConfigEntity configEntity);


@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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
@Mapper
public interface ConnectionMapper {

@Select("SELECT COUNT(*) FROM connection WHERE cluster_id=#{clusterId}")
Integer selectConnectionNumByCluster(ConnectionEntity connectionEntity);

@Select("SELECT * FROM connection")
List<ConnectionEntity> selectAll();

Expand Down
Loading

0 comments on commit 4eb9f83

Please sign in to comment.