Skip to content

Commit

Permalink
add dss-framework module
Browse files Browse the repository at this point in the history
close #363
close #364
close #365
close #366
close #367
close #368
close #369
  • Loading branch information
yangzhiyue committed Aug 18, 2021
1 parent 48047c1 commit 538606e
Show file tree
Hide file tree
Showing 260 changed files with 22,734 additions and 0 deletions.
127 changes: 127 additions & 0 deletions dss-framework/dss-appconn-framework/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2019 WeBank
~ Licensed 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.
~
-->

<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">
<parent>
<artifactId>dss</artifactId>
<groupId>com.webank.wedatasphere.dss</groupId>
<version>1.0.0</version>
<!--<relativePath>../../pom.xml</relativePath>-->
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>dss-appconn-framework</artifactId>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>


<dependency>
<groupId>com.webank.wedatasphere.linkis</groupId>
<artifactId>linkis-mybatis</artifactId>
<version>${linkis.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.webank.wedatasphere.dss</groupId>
<artifactId>dss-appconn-manager-core</artifactId>
<version>${dss.version}</version>
</dependency>
<dependency>
<groupId>com.webank.wedatasphere.dss</groupId>
<artifactId>dss-common</artifactId>
<version>${dss.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.webank.wedatasphere.linkis</groupId>
<artifactId>linkis-rpc</artifactId>
<version>${linkis.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>linkis-common</artifactId>
<groupId>com.webank.wedatasphere.linkis</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.webank.wedatasphere.linkis</groupId>
<artifactId>linkis-bml-client</artifactId>
<version>${linkis.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-beanutils</artifactId>
<groupId>commons-beanutils</groupId>
</exclusion>
<exclusion>
<artifactId>linkis-common</artifactId>
<groupId>com.webank.wedatasphere.linkis</groupId>
</exclusion>
<exclusion>
<artifactId>json4s-jackson_2.11</artifactId>
<groupId>org.json4s</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>1.3.5</version>
<scope>provided</scope>
</dependency>

</dependencies>



<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
</plugin>

<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>


</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2019 WeBank
* Licensed 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 com.webank.wedatasphere.dss.framework.appconn;

import com.webank.wedatasphere.dss.appconn.manager.impl.AbstractAppConnManager;
import com.webank.wedatasphere.dss.appconn.manager.service.AppConnInfoService;
import com.webank.wedatasphere.dss.appconn.manager.service.AppConnResourceService;
import com.webank.wedatasphere.linkis.DataWorkCloudApplication;


public class SpringAppConnManager extends AbstractAppConnManager {

@Override
protected AppConnInfoService createAppConnInfoService() {
return DataWorkCloudApplication.getApplicationContext().getBean(AppConnInfoService.class);
}

@Override
protected AppConnResourceService createAppConnResourceService() {
return DataWorkCloudApplication.getApplicationContext().getBean(AppConnResourceService.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright 2019 WeBank
* Licensed 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 com.webank.wedatasphere.dss.framework.appconn.dao;


import com.webank.wedatasphere.dss.framework.appconn.entity.AppConnBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;


@Mapper
public interface AppConnMapper {

/**
* get all appconnbeans
* */
List<AppConnBean> getAllAppConnBeans();

/**
* get all appconns' name
* */
List<String> getAllAppConnsName();

/**
* get appconnbeans by name
* */
AppConnBean getAppConnBeanByName(@Param("appConnName") String appConnName);

/**
* get appconn by id
* */
AppConnBean getAppConnBeanById(@Param("appConnId") Long appConnId);

void updateResourceByName(AppConnBean appConnBean);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2019 WeBank
* Licensed 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 com.webank.wedatasphere.dss.framework.appconn.dao;


import com.webank.wedatasphere.dss.framework.appconn.entity.AppInstanceBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;


@Mapper
public interface AppInstanceMapper {

/**
* get instance by appconnid
* */
List<AppInstanceBean> getAppInstancesByAppConnId(@Param("appConnId") Long appConnId);

/**
* get instance by appconnid and label
* */
List<AppInstanceBean> getAppInstance(@Param("appConnId") Long appConnId,
@Param("label") String label);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
~ Copyright 2019 WeBank
~ Licensed 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="com.webank.wedatasphere.dss.framework.appconn.dao.AppConnMapper">

<cache flushInterval="120000"/>

<resultMap id="AppConnBeanMap" type="com.webank.wedatasphere.dss.framework.appconn.entity.AppConnBean">
<result property="id" column="id"/>
<result property="appConnName" column="appconn_name"/>
<result property="isUserNeedInit" column="is_user_need_init"/>
<result property="level" column="level"/>
<result property="ifIframe" column="if_iframe"/>
<result property="isExternal" column="is_external"/>
<result property="reference" column="reference"/>
<result property="className" column="class_name"/>
<result property="appConnClassPath" column="appconn_class_path"/>
<result property="resource" column="resource"/>
</resultMap>

<sql id="fields">
`appconn_name`, `is_user_need_init`, `level`, `if_iframe`, `is_external`,
`reference`, `class_name`, `appconn_class_path`,`resource`
</sql>

<sql id="fields_query">
`id`, `appconn_name`, `is_user_need_init`, `level`, `if_iframe`, `is_external`,
`reference`, `class_name`, `appconn_class_path`, `resource`
</sql>

<select id="getAllAppConnBeans" resultMap="AppConnBeanMap">
<![CDATA[SELECT]]>
<include refid="fields_query"/>
FROM `dss_appconn`
</select>

<select id="getAllAppConnsName" resultType="String">
SELECT `appconn_name`
FROM `dss_appconn`
</select>

<select id="getAppConnBeanByName" resultMap="AppConnBeanMap">
<![CDATA[SELECT]]>
<include refid="fields_query"/>
FROM `dss_appconn`
WHERE `appconn_name` = #{appConnName}
</select>

<select id="getAppConnBeanById" resultMap="AppConnBeanMap">
<![CDATA[SELECT]]>
<include refid="fields_query"/>
FROM `dss_appconn`
WHERE `id` = #{appConnId}
</select>

<update id="updateResourceByName" parameterType="com.webank.wedatasphere.dss.framework.appconn.entity.AppConnBean">
update `dss_appconn`
<trim prefix="set" suffixOverrides=",">
<if test="resource != null">resource=#{resource},</if>
<if test="appConnClassPath != null">appconn_class_path=#{appConnClassPath},</if>
</trim>
where appconn_name=#{appConnName}
</update>
</mapper>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
~ Copyright 2019 WeBank
~ Licensed 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="com.webank.wedatasphere.dss.framework.appconn.dao.AppInstanceMapper">
<resultMap id="AppInstanceMap" type="com.webank.wedatasphere.dss.framework.appconn.entity.AppInstanceBean">
<result property="id" column="id"/>
<result property="appConnId" column="appconn_id"/>
<result property="label" column="label"/>
<result property="url" column="url"/>
<result property="enhanceJson" column="enhance_json"/>
<result property="homepageUrl" column="homepage_url"/>
<result property="redirectUrl" column="redirect_url"/>
</resultMap>

<sql id="fields_query">
`id`, `appconn_id`, `label`, `url`, `enhance_json`, `homepage_url`, `redirect_url`
</sql>

<select id="getAppInstancesByAppConnId" resultMap="AppInstanceMap">
<![CDATA[SELECT]]>
<include refid="fields_query"/>
FROM `dss_appconn_instance`
WHERE `appconn_id` = #{appConnId}
</select>

<select id="getAppInstance" resultMap="AppInstanceMap">
<![CDATA[SELECT]]>
<include refid="fields_query"/>
FROM `dss_appconn_instance`
WHERE `appconn_id` = #{appConnId} AND `label` = #{label}
</select>
</mapper>
Loading

0 comments on commit 538606e

Please sign in to comment.