This is an automated email from the ASF dual-hosted git repository.

healchow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 724eb2dcd [INLONG-4071][Manager] Add data node table and other related 
classes (#4083)
724eb2dcd is described below

commit 724eb2dcde26e7f1311cdaee14191c833d147d52
Author: healchow <[email protected]>
AuthorDate: Fri May 6 14:57:52 2022 +0800

    [INLONG-4071][Manager] Add data node table and other related classes (#4083)
---
 .../common/pojo/node/DataNodePageRequest.java      |  49 ++++++++
 .../manager/common/pojo/node/DataNodeRequest.java  |  59 +++++++++
 .../manager/common/pojo/node/DataNodeResponse.java |  73 +++++++++++
 .../inlong/manager/dao/entity/DataNodeEntity.java  |  44 +++++++
 .../manager/dao/mapper/DataNodeEntityMapper.java   |  38 ++++++
 .../src/main/resources/generatorConfig.xml         |   8 +-
 .../resources/mappers/DataNodeEntityMapper.xml     | 140 +++++++++++++++++++++
 .../manager/service/core/DataNodeService.java      |  73 +++++++++++
 .../service/core/impl/DataNodeServiceImpl.java     |  67 ++++++++++
 .../main/resources/sql/apache_inlong_manager.sql   |  24 ++++
 .../manager-web/sql/apache_inlong_manager.sql      |  25 ++++
 .../manager/web/controller/DataNodeController.java | 133 ++++++++++++++++++++
 12 files changed, 726 insertions(+), 7 deletions(-)

diff --git 
a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/node/DataNodePageRequest.java
 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/node/DataNodePageRequest.java
new file mode 100644
index 000000000..630fa9d0a
--- /dev/null
+++ 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/node/DataNodePageRequest.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.inlong.manager.common.pojo.node;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.apache.inlong.manager.common.beans.PageRequest;
+
+/**
+ * Data node paging query conditions
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@ApiModel("Data node paging query request")
+public class DataNodePageRequest extends PageRequest {
+
+    @ApiModelProperty(value = "Node type, including MYSQL, HIVE, KAFKA, ES, 
etc.")
+    private String type;
+
+    @ApiModelProperty(value = "Node name")
+    private String name;
+
+    @ApiModelProperty(value = "Keywords, name, url, etc.")
+    private String keyword;
+
+    @ApiModelProperty(value = "Status")
+    private Integer status;
+
+    @ApiModelProperty(value = "Current user", hidden = true)
+    private String currentUser;
+
+}
diff --git 
a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/node/DataNodeRequest.java
 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/node/DataNodeRequest.java
new file mode 100644
index 000000000..d86b69036
--- /dev/null
+++ 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/node/DataNodeRequest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.inlong.manager.common.pojo.node;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * Data node request
+ */
+@Data
+@ApiModel("Data node  request")
+public class DataNodeRequest {
+
+    @ApiModelProperty(value = "Primary key")
+    private Integer id;
+
+    @NotBlank
+    @ApiModelProperty(value = "Node  name")
+    private String name;
+
+    @NotBlank
+    @ApiModelProperty(value = "Node type, including MYSQL, HIVE, KAFKA, ES, 
etc.")
+    private String type;
+
+    @ApiModelProperty(value = "Node url")
+    private String url;
+
+    @ApiModelProperty(value = "Node username")
+    private String username;
+
+    @ApiModelProperty(value = "Node password")
+    private String password;
+
+    @ApiModelProperty(value = "Extended params")
+    private String extParams;
+
+    @ApiModelProperty(value = "Name of responsible person, separated by 
commas")
+    private String inCharges;
+
+}
diff --git 
a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/node/DataNodeResponse.java
 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/node/DataNodeResponse.java
new file mode 100644
index 000000000..8cb34eaeb
--- /dev/null
+++ 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/node/DataNodeResponse.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.inlong.manager.common.pojo.node;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * Data node response
+ */
+@Data
+@ApiModel("Data node response")
+public class DataNodeResponse {
+
+    @ApiModelProperty(value = "Primary key")
+    private Integer id;
+
+    @ApiModelProperty(value = "Node name")
+    private String name;
+
+    @ApiModelProperty(value = "Node type, including MYSQL, HIVE, KAFKA, ES, 
etc.")
+    private String type;
+
+    @ApiModelProperty(value = "Node url")
+    private String url;
+
+    @ApiModelProperty(value = "Node username")
+    private String username;
+
+    @ApiModelProperty(value = "Node password")
+    private String password;
+
+    @ApiModelProperty(value = "Extended params")
+    private String extParams;
+
+    @ApiModelProperty(value = "Name of in charges, separated by commas")
+    private String inCharges;
+
+    @ApiModelProperty(value = "Cluster status")
+    private Integer status;
+
+    @ApiModelProperty(value = "Name of in creator")
+    private String creator;
+
+    @ApiModelProperty(value = "Name of in modifier")
+    private String modifier;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date modifyTime;
+
+}
diff --git 
a/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/entity/DataNodeEntity.java
 
b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/entity/DataNodeEntity.java
new file mode 100644
index 000000000..15bdf0545
--- /dev/null
+++ 
b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/entity/DataNodeEntity.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.inlong.manager.dao.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class DataNodeEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+    private Integer id;
+    private String name;
+    private String type;
+    private String url;
+    private String username;
+    private String password;
+    private String inCharges;
+    private Integer status;
+    private Integer isDeleted;
+    private String creator;
+    private String modifier;
+    private Date createTime;
+    private Date modifyTime;
+    private String extParams;
+
+}
\ No newline at end of file
diff --git 
a/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/DataNodeEntityMapper.java
 
b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/DataNodeEntityMapper.java
new file mode 100644
index 000000000..1fd8809f4
--- /dev/null
+++ 
b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/DataNodeEntityMapper.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.inlong.manager.dao.mapper;
+
+import org.apache.inlong.manager.dao.entity.DataNodeEntity;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface DataNodeEntityMapper {
+
+    int insert(DataNodeEntity record);
+
+    DataNodeEntity selectById(Integer id);
+
+    DataNodeEntity selectByNameAndType(String name, String type);
+
+    int updateById(DataNodeEntity record);
+
+    int updateByIdSelective(DataNodeEntity record);
+
+    int deleteById(Integer id);
+
+}
\ No newline at end of file
diff --git a/inlong-manager/manager-dao/src/main/resources/generatorConfig.xml 
b/inlong-manager/manager-dao/src/main/resources/generatorConfig.xml
index b79357660..d875c8b7f 100644
--- a/inlong-manager/manager-dao/src/main/resources/generatorConfig.xml
+++ b/inlong-manager/manager-dao/src/main/resources/generatorConfig.xml
@@ -67,13 +67,7 @@
         </javaClientGenerator>
 
         <!-- Which entities to generate -->
-        <table tableName="inlong_cluster" 
domainObjectName="InlongClusterEntity"
-                enableInsert="true" enableSelectByPrimaryKey="true"
-                enableUpdateByPrimaryKey="true" enableDeleteByPrimaryKey="true"
-                enableCountByExample="false" enableDeleteByExample="false"
-                enableSelectByExample="false" enableUpdateByExample="false">
-        </table>
-        <table tableName="inlong_cluster_node" 
domainObjectName="InlongClusterNodeEntity"
+        <table tableName="data_node" domainObjectName="DataNodeEntity"
                 enableInsert="true" enableSelectByPrimaryKey="true"
                 enableUpdateByPrimaryKey="true" enableDeleteByPrimaryKey="true"
                 enableCountByExample="false" enableDeleteByExample="false"
diff --git 
a/inlong-manager/manager-dao/src/main/resources/mappers/DataNodeEntityMapper.xml
 
b/inlong-manager/manager-dao/src/main/resources/mappers/DataNodeEntityMapper.xml
new file mode 100644
index 000000000..1d22af864
--- /dev/null
+++ 
b/inlong-manager/manager-dao/src/main/resources/mappers/DataNodeEntityMapper.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
"http://mybatis.org/dtd/mybatis-3-mapper.dtd";>
+<mapper namespace="org.apache.inlong.manager.dao.mapper.DataNodeEntityMapper">
+    <resultMap id="BaseResultMap" 
type="org.apache.inlong.manager.dao.entity.DataNodeEntity">
+        <id column="id" jdbcType="INTEGER" property="id"/>
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="type" jdbcType="VARCHAR" property="type"/>
+        <result column="url" jdbcType="VARCHAR" property="url"/>
+        <result column="username" jdbcType="VARCHAR" property="username"/>
+        <result column="password" jdbcType="VARCHAR" property="password"/>
+        <result column="ext_params" jdbcType="LONGVARCHAR" 
property="extParams"/>
+        <result column="in_charges" jdbcType="VARCHAR" property="inCharges"/>
+        <result column="status" jdbcType="INTEGER" property="status"/>
+        <result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/>
+        <result column="creator" jdbcType="VARCHAR" property="creator"/>
+        <result column="modifier" jdbcType="VARCHAR" property="modifier"/>
+        <result column="create_time" jdbcType="TIMESTAMP" 
property="createTime"/>
+        <result column="modify_time" jdbcType="TIMESTAMP" 
property="modifyTime"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+        id, name, type, url, username, password, ext_params, in_charges, 
status, is_deleted,
+        creator, modifier, create_time, modify_time
+    </sql>
+
+    <insert id="insert" 
parameterType="org.apache.inlong.manager.dao.entity.DataNodeEntity">
+        insert into data_node (id, name, type,
+                               url, username, password,
+                               in_charges, status, is_deleted,
+                               creator, modifier, create_time,
+                               modify_time, ext_params)
+        values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, 
#{type,jdbcType=VARCHAR},
+                #{url,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, 
#{password,jdbcType=VARCHAR},
+                #{inCharges,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, 
#{isDeleted,jdbcType=INTEGER},
+                #{creator,jdbcType=VARCHAR}, #{modifier,jdbcType=VARCHAR}, 
#{createTime,jdbcType=TIMESTAMP},
+                #{modifyTime,jdbcType=TIMESTAMP}, 
#{extParams,jdbcType=LONGVARCHAR})
+    </insert>
+
+    <select id="selectById" parameterType="java.lang.Integer" 
resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from data_node
+        where id = #{id,jdbcType=INTEGER}
+    </select>
+    <select id="selectByNameAndType" 
resultType="org.apache.inlong.manager.dao.entity.DataNodeEntity">
+        select
+        <include refid="Base_Column_List"/>
+        from data_node
+        where is_deleted = 0
+        and name = #{name, jdbcType=VARCHAR}
+        and type = #{type, jdbcType=VARCHAR}
+    </select>
+
+    <update id="updateById" 
parameterType="org.apache.inlong.manager.dao.entity.DataNodeEntity">
+        update data_node
+        set name        = #{name,jdbcType=VARCHAR},
+            type        = #{type,jdbcType=VARCHAR},
+            url         = #{url,jdbcType=VARCHAR},
+            username    = #{username,jdbcType=VARCHAR},
+            password    = #{password,jdbcType=VARCHAR},
+            ext_params  = #{extParams,jdbcType=LONGVARCHAR},
+            in_charges  = #{inCharges,jdbcType=VARCHAR},
+            status      = #{status,jdbcType=INTEGER},
+            is_deleted  = #{isDeleted,jdbcType=INTEGER},
+            creator     = #{creator,jdbcType=VARCHAR},
+            modifier    = #{modifier,jdbcType=VARCHAR},
+            create_time = #{createTime,jdbcType=TIMESTAMP},
+            modify_time = #{modifyTime,jdbcType=TIMESTAMP}
+        where id = #{id,jdbcType=INTEGER}
+    </update>
+    <update id="updateByIdSelective" 
parameterType="org.apache.inlong.manager.dao.entity.DataNodeEntity">
+        update data_node
+        <set>
+            <if test="name != null">
+                name = #{name,jdbcType=VARCHAR},
+            </if>
+            <if test="type != null">
+                type = #{type,jdbcType=VARCHAR},
+            </if>
+            <if test="url != null">
+                url = #{url,jdbcType=VARCHAR},
+            </if>
+            <if test="username != null">
+                username = #{username,jdbcType=VARCHAR},
+            </if>
+            <if test="password != null">
+                password = #{password,jdbcType=VARCHAR},
+            </if>
+            <if test="inCharges != null">
+                in_charges = #{inCharges,jdbcType=VARCHAR},
+            </if>
+            <if test="status != null">
+                status = #{status,jdbcType=INTEGER},
+            </if>
+            <if test="isDeleted != null">
+                is_deleted = #{isDeleted,jdbcType=INTEGER},
+            </if>
+            <if test="creator != null">
+                creator = #{creator,jdbcType=VARCHAR},
+            </if>
+            <if test="modifier != null">
+                modifier = #{modifier,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime != null">
+                create_time = #{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="modifyTime != null">
+                modify_time = #{modifyTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="extParams != null">
+                ext_params = #{extParams,jdbcType=LONGVARCHAR},
+            </if>
+        </set>
+        where id = #{id,jdbcType=INTEGER}
+    </update>
+
+    <delete id="deleteById" parameterType="java.lang.Integer">
+        delete
+        from data_node
+        where id = #{id,jdbcType=INTEGER}
+    </delete>
+</mapper>
\ No newline at end of file
diff --git 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/DataNodeService.java
 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/DataNodeService.java
new file mode 100644
index 000000000..34ac8cf2a
--- /dev/null
+++ 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/DataNodeService.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.inlong.manager.service.core;
+
+import com.github.pagehelper.PageInfo;
+import org.apache.inlong.manager.common.pojo.node.DataNodePageRequest;
+import org.apache.inlong.manager.common.pojo.node.DataNodeRequest;
+import org.apache.inlong.manager.common.pojo.node.DataNodeResponse;
+
+/**
+ * Data node service layer interface
+ */
+public interface DataNodeService {
+
+    /**
+     * Save data node.
+     *
+     * @param request data node info
+     * @param operator name of operator
+     * @return cluster id after saving
+     */
+    Integer save(DataNodeRequest request, String operator);
+
+    /**
+     * Get data node by id.
+     *
+     * @param id node id
+     * @return node info
+     */
+    DataNodeResponse get(Integer id);
+
+    /**
+     * Paging query nodes according to conditions.
+     *
+     * @param request page request conditions
+     * @return node list
+     */
+    PageInfo<DataNodeResponse> list(DataNodePageRequest request);
+
+    /**
+     * Update data node.
+     *
+     * @param request node info to be modified
+     * @param operator current operator
+     * @return whether succeed
+     */
+    Boolean update(DataNodeRequest request, String operator);
+
+    /**
+     * Delete data node.
+     *
+     * @param id node id to be deleted
+     * @param operator current operator
+     * @return whether succeed
+     */
+    Boolean delete(Integer id, String operator);
+
+}
diff --git 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/DataNodeServiceImpl.java
 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/DataNodeServiceImpl.java
new file mode 100644
index 000000000..81cd77938
--- /dev/null
+++ 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/DataNodeServiceImpl.java
@@ -0,0 +1,67 @@
+/*
+ * 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.inlong.manager.service.core.impl;
+
+import com.github.pagehelper.PageInfo;
+import org.apache.inlong.manager.common.pojo.node.DataNodePageRequest;
+import org.apache.inlong.manager.common.pojo.node.DataNodeRequest;
+import org.apache.inlong.manager.common.pojo.node.DataNodeResponse;
+import org.apache.inlong.manager.dao.mapper.DataNodeEntityMapper;
+import org.apache.inlong.manager.service.core.DataNodeService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * Data node service layer implementation
+ */
+@Service
+public class DataNodeServiceImpl implements DataNodeService {
+
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(DataNodeServiceImpl.class);
+
+    @Autowired
+    private DataNodeEntityMapper dataNodeMapper;
+
+    @Override
+    public Integer save(DataNodeRequest request, String operator) {
+        return null;
+    }
+
+    @Override
+    public DataNodeResponse get(Integer id) {
+        return null;
+    }
+
+    @Override
+    public PageInfo<DataNodeResponse> list(DataNodePageRequest request) {
+        return null;
+    }
+
+    @Override
+    public Boolean update(DataNodeRequest request, String operator) {
+        return null;
+    }
+
+    @Override
+    public Boolean delete(Integer id, String operator) {
+        return null;
+    }
+
+}
diff --git 
a/inlong-manager/manager-test/src/main/resources/sql/apache_inlong_manager.sql 
b/inlong-manager/manager-test/src/main/resources/sql/apache_inlong_manager.sql
index abe68a2a8..315378904 100644
--- 
a/inlong-manager/manager-test/src/main/resources/sql/apache_inlong_manager.sql
+++ 
b/inlong-manager/manager-test/src/main/resources/sql/apache_inlong_manager.sql
@@ -142,6 +142,30 @@ CREATE TABLE `inlong_cluster_node`
     UNIQUE KEY `unique_cluster_node` (`parent_id`, `type`, `ip`, `port`, 
`is_deleted`)
 );
 
+-- ----------------------------
+-- Table structure for data_node
+-- ----------------------------
+DROP TABLE IF EXISTS `data_node`;
+CREATE TABLE `data_node`
+(
+    `id`          int(11)      NOT NULL AUTO_INCREMENT COMMENT 'Incremental 
primary key',
+    `name`        varchar(128) NOT NULL COMMENT 'Cluster name',
+    `type`        varchar(20)       DEFAULT '' COMMENT 'Cluster type, such as: 
MYSQL, HIVE, KAFKA, ES, etc',
+    `url`         varchar(512)      DEFAULT NULL COMMENT 'Cluster URL',
+    `username`    varchar(128)      DEFAULT NULL COMMENT 'Username for cluster 
if needed',
+    `password`    varchar(128)      DEFAULT NULL COMMENT 'Password for 
cluster',
+    `ext_params`  text              DEFAULT NULL COMMENT 'Extended params, 
will saved as JSON string',
+    `in_charges`  varchar(512) NOT NULL COMMENT 'Name of responsible person, 
separated by commas',
+    `status`      int(4)            DEFAULT '0' COMMENT 'Cluster status',
+    `is_deleted`  int(11)           DEFAULT '0' COMMENT 'Whether to delete, 0: 
not deleted, > 0: deleted',
+    `creator`     varchar(64)  NOT NULL COMMENT 'Creator name',
+    `modifier`    varchar(64)       DEFAULT NULL COMMENT 'Modifier name',
+    `create_time` timestamp    NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Create 
time',
+    `modify_time` timestamp    NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE 
CURRENT_TIMESTAMP COMMENT 'Modify time',
+    PRIMARY KEY (`id`),
+    UNIQUE KEY `unique_data_node_index` (`name`, `type`, `is_deleted`)
+);
+
 -- ----------------------------
 -- Table structure for third_party_cluster
 -- ----------------------------
diff --git a/inlong-manager/manager-web/sql/apache_inlong_manager.sql 
b/inlong-manager/manager-web/sql/apache_inlong_manager.sql
index 665e0af32..c3895f763 100644
--- a/inlong-manager/manager-web/sql/apache_inlong_manager.sql
+++ b/inlong-manager/manager-web/sql/apache_inlong_manager.sql
@@ -153,6 +153,31 @@ CREATE TABLE `inlong_cluster_node`
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4 COMMENT ='Inlong cluster node table';
 
+-- ----------------------------
+-- Table structure for data_node
+-- ----------------------------
+DROP TABLE IF EXISTS `data_node`;
+CREATE TABLE `data_node`
+(
+    `id`          int(11)      NOT NULL AUTO_INCREMENT COMMENT 'Incremental 
primary key',
+    `name`        varchar(128) NOT NULL COMMENT 'Node name',
+    `type`        varchar(20)       DEFAULT '' COMMENT 'Node type, such as: 
MYSQL, HIVE, KAFKA, ES, etc',
+    `url`         varchar(512)      DEFAULT NULL COMMENT 'Node URL',
+    `username`    varchar(128)      DEFAULT NULL COMMENT 'Username for node if 
needed',
+    `password`    varchar(128)      DEFAULT NULL COMMENT 'Password for node',
+    `ext_params`  text              DEFAULT NULL COMMENT 'Extended params, 
will saved as JSON string',
+    `in_charges`  varchar(512) NOT NULL COMMENT 'Name of responsible person, 
separated by commas',
+    `status`      int(4)            DEFAULT '0' COMMENT 'Node status',
+    `is_deleted`  int(11)           DEFAULT '0' COMMENT 'Whether to delete, 0: 
not deleted, > 0: deleted',
+    `creator`     varchar(64)  NOT NULL COMMENT 'Creator name',
+    `modifier`    varchar(64)       DEFAULT NULL COMMENT 'Modifier name',
+    `create_time` timestamp    NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Create 
time',
+    `modify_time` timestamp    NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE 
CURRENT_TIMESTAMP COMMENT 'Modify time',
+    PRIMARY KEY (`id`),
+    UNIQUE KEY `unique_data_node_index` (`name`, `type`, `is_deleted`)
+) ENGINE = InnoDB
+  DEFAULT CHARSET = utf8mb4 COMMENT ='Data node table';
+
 -- ----------------------------
 -- Table structure for third_party_cluster
 -- ----------------------------
diff --git 
a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/DataNodeController.java
 
b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/DataNodeController.java
new file mode 100644
index 000000000..248afd0e2
--- /dev/null
+++ 
b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/DataNodeController.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.inlong.manager.web.controller;
+
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.apache.inlong.manager.common.beans.Response;
+import org.apache.inlong.manager.common.enums.OperationType;
+import org.apache.inlong.manager.common.pojo.cluster.ClusterNodeRequest;
+import org.apache.inlong.manager.common.pojo.cluster.ClusterNodeResponse;
+import org.apache.inlong.manager.common.pojo.cluster.InlongClusterPageRequest;
+import org.apache.inlong.manager.common.pojo.cluster.InlongClusterRequest;
+import org.apache.inlong.manager.common.pojo.cluster.InlongClusterResponse;
+import org.apache.inlong.manager.common.pojo.user.UserRoleCode;
+import org.apache.inlong.manager.common.util.LoginUserUtils;
+import org.apache.inlong.manager.service.core.InlongClusterService;
+import org.apache.inlong.manager.service.core.operationlog.OperationLog;
+import org.apache.shiro.authz.annotation.RequiresRoles;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+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.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * Data node controller
+ */
+@RestController
+@RequestMapping("/node")
+@Api(tags = "Data-Node-API")
+public class DataNodeController {
+
+    @Autowired
+    private InlongClusterService clusterService;
+
+    @PostMapping(value = "/save")
+    @ApiOperation(value = "Save cluster")
+    @OperationLog(operation = OperationType.CREATE)
+    @RequiresRoles(value = UserRoleCode.ADMIN)
+    public Response<Integer> save(@RequestBody InlongClusterRequest request) {
+        String currentUser = LoginUserUtils.getLoginUserDetail().getUserName();
+        return Response.success(clusterService.save(request, currentUser));
+    }
+
+    @GetMapping(value = "/get/{id}")
+    @ApiOperation(value = "Get cluster by id")
+    @ApiImplicitParam(name = "id", value = "Cluster ID", dataTypeClass = 
Integer.class, required = true)
+    public Response<InlongClusterResponse> get(@PathVariable Integer id) {
+        return Response.success(clusterService.get(id));
+    }
+
+    @PostMapping(value = "/list")
+    @ApiOperation(value = "List clusters")
+    public Response<PageInfo<InlongClusterResponse>> list(@RequestBody 
InlongClusterPageRequest request) {
+        return Response.success(clusterService.list(request));
+    }
+
+    @PostMapping(value = "/update")
+    @OperationLog(operation = OperationType.UPDATE)
+    @ApiOperation(value = "Update cluster")
+    public Response<Boolean> update(@RequestBody InlongClusterRequest request) 
{
+        String username = LoginUserUtils.getLoginUserDetail().getUserName();
+        return Response.success(clusterService.update(request, username));
+    }
+
+    @DeleteMapping(value = "/delete/{id}")
+    @ApiOperation(value = "Delete cluster by id")
+    @OperationLog(operation = OperationType.DELETE)
+    @ApiImplicitParam(name = "id", value = "Cluster ID", dataTypeClass = 
Integer.class, required = true)
+    @RequiresRoles(value = UserRoleCode.ADMIN)
+    public Response<Boolean> delete(@PathVariable Integer id) {
+        return Response.success(clusterService.delete(id, 
LoginUserUtils.getLoginUserDetail().getUserName()));
+    }
+
+    @PostMapping(value = "/node/save")
+    @ApiOperation(value = "Save cluster node")
+    @OperationLog(operation = OperationType.CREATE)
+    public Response<Integer> saveNode(@RequestBody ClusterNodeRequest request) 
{
+        String currentUser = LoginUserUtils.getLoginUserDetail().getUserName();
+        return Response.success(clusterService.saveNode(request, currentUser));
+    }
+
+    @GetMapping(value = "/node/get/{id}")
+    @ApiOperation(value = "Get cluster node by id")
+    @ApiImplicitParam(name = "id", value = "Cluster node ID", dataTypeClass = 
Integer.class, required = true)
+    public Response<ClusterNodeResponse> getNode(@PathVariable Integer id) {
+        return Response.success(clusterService.getNode(id));
+    }
+
+    @PostMapping(value = "/node/list")
+    @ApiOperation(value = "List cluster nodes")
+    public Response<PageInfo<ClusterNodeResponse>> listNode(@RequestBody 
InlongClusterPageRequest request) {
+        return Response.success(clusterService.listNode(request));
+    }
+
+    @RequestMapping(value = "/node/update", method = RequestMethod.POST)
+    @OperationLog(operation = OperationType.UPDATE)
+    @ApiOperation(value = "Update cluster node")
+    public Response<Boolean> updateNode(@RequestBody ClusterNodeRequest 
request) {
+        String username = LoginUserUtils.getLoginUserDetail().getUserName();
+        return Response.success(clusterService.updateNode(request, username));
+    }
+
+    @RequestMapping(value = "/node/delete/{id}", method = RequestMethod.DELETE)
+    @ApiOperation(value = "Delete cluster node")
+    @OperationLog(operation = OperationType.DELETE)
+    @ApiImplicitParam(name = "id", value = "DataProxy cluster id", 
dataTypeClass = Integer.class, required = true)
+    public Response<Boolean> deleteNode(@PathVariable Integer id) {
+        return Response.success(clusterService.deleteNode(id, 
LoginUserUtils.getLoginUserDetail().getUserName()));
+    }
+
+}

Reply via email to