Skip to content

Commit

Permalink
fixed #297
Browse files Browse the repository at this point in the history
  • Loading branch information
bleachzk authored and peacewong committed May 20, 2020
1 parent 51c5e84 commit 9197722
Show file tree
Hide file tree
Showing 11 changed files with 1,304 additions and 0 deletions.
70 changes: 70 additions & 0 deletions datasource/datasourcemanager/common/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?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>linkis</artifactId>
<groupId>com.webank.wedatasphere.linkis</groupId>
<version>0.9.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>linkis-datasourcemanager-common</artifactId>


<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<um.version>1.0.12</um.version>
</properties>

<dependencies>
<dependency>
<groupId>com.webank.wedatasphere.linkis</groupId>
<artifactId>linkis-module</artifactId>
<version>${linkis.version}</version>
<exclusions>
<exclusion>
<artifactId>asm</artifactId>
<groupId>org.ow2.asm</groupId>
</exclusion>
</exclusions>
</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/resources</directory>
</resource>
</resources>
<finalName>${project.artifactId}-${project.version}</finalName>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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.linkis.datasourcemanager.common;

import com.webank.wedatasphere.linkis.common.conf.CommonVars;

/**
* Configuration
* @author kirkzhou
* 2020/02/14
*/
public class DsmConfiguration {

public static CommonVars<String> DSM_ADMIN_USER_LIST =
CommonVars.apply("wds.linkis.server.dsm.admin.users", "");


}
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.linkis.datasourcemanager.common;

import com.webank.wedatasphere.linkis.common.conf.CommonVars;

/**
* Store error code map
* @author kirkzhou
* 2020/02/11
*/
public class ServiceErrorCode {

public static CommonVars<Integer> TRANSFORM_FORM_ERROR =
CommonVars.apply("wds.linkis.server.dsm.error-code.transform", 99987);

public static CommonVars<Integer> BML_SERVICE_ERROR =
CommonVars.apply("wds.linkis.server.dsm.error-code.bml", 99982);

public static CommonVars<Integer> REMOTE_METADATA_SERVICE_ERROR =
CommonVars.apply("wds.linkis.server.dsm.error-code.metadata", 99983);

public static CommonVars<Integer> PARAM_VALIDATE_ERROR =
CommonVars.apply("wds.linkis.server.dsm.error-code.param-validate", 99986);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
/*
* 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.linkis.datasourcemanager.common.domain;

import com.webank.wedatasphere.linkis.datasourcemanager.common.util.json.Json;
import org.apache.commons.lang.StringUtils;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.map.annotate.JsonSerialize;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.*;

/**
* Store the data source information
* @author kirkzhou
* 2020/02/11
*/
@JsonSerialize(include= JsonSerialize.Inclusion.NON_EMPTY)
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler"}, ignoreUnknown = true)
public class DataSource {

private Long id;

/**
* Data source name
*/
@NotNull
private String dataSourceName;

/**
* Data source description
*/
@Size(min = 0, max = 200)
private String dataSourceDesc;

/**
* ID of data source type
*/
@NotNull
private Long dataSourceTypeId;

/**
* Identify from creator
*/
private String createIdentify;

/**
* System name from creator
*/
@NotNull
private String createSystem;
/**
* Connection parameters
*/
private Map<String, Object> connectParams = new HashMap<>();
/**
* Parameter JSON string
*/
@JsonIgnore
private String parameter;

/**
* ID of data source environment
*/
private Long dataSourceEnvId;

/**
* Create time
*/
private Date createTime;

/**
* Modify time
*/
private Date modifyTime;

/**
* Modify user
*/
private String modifyUser;

private String createUser;

/**
* Data source type entity
*/
private DataSourceType dataSourceType;

/**
* Data source env
*/
private DataSourceEnv dataSourceEnv;

@JsonIgnore
private List<DataSourceParamKeyDefinition> keyDefinitions = new ArrayList<>();

public DataSource(){
this.createTime = Calendar.getInstance().getTime();
}
public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public String getDataSourceName() {
return dataSourceName;
}

public void setDataSourceName(String dataSourceName) {
this.dataSourceName = dataSourceName;
}

public String getDataSourceDesc() {
return dataSourceDesc;
}

public void setDataSourceDesc(String dataSourceDesc) {
this.dataSourceDesc = dataSourceDesc;
}

public Long getDataSourceTypeId() {
return dataSourceTypeId;
}

public void setDataSourceTypeId(Long dataSourceTypeId) {
this.dataSourceTypeId = dataSourceTypeId;
}

public String getCreateIdentify() {
return createIdentify;
}

public void setCreateIdentify(String createIdentify) {
this.createIdentify = createIdentify;
}

public String getCreateSystem() {
return createSystem;
}

public void setCreateSystem(String createSystem) {
this.createSystem = createSystem;
}

public String getParameter() {
return parameter;
}

public void setParameter(String parameter) {
this.parameter = parameter;
}

public Long getDataSourceEnvId() {
return dataSourceEnvId;
}

public void setDataSourceEnvId(Long dataSourceEnvId) {
this.dataSourceEnvId = dataSourceEnvId;
}

public Date getCreateTime() {
return createTime;
}

public void setCreateTime(Date createTime) {
this.createTime = createTime;
}

public Date getModifyTime() {
return modifyTime;
}

public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}

public Map<String, Object> getConnectParams() {
if(connectParams.isEmpty() && StringUtils.isNotBlank(parameter)){
connectParams.putAll(Objects.requireNonNull(Json.fromJson(parameter, Map.class)));
}
return connectParams;
}

public void setConnectParams(Map<String, Object> connectParams) {
this.connectParams = connectParams;
}

public String getCreateUser() {
return createUser;
}

public void setCreateUser(String createUser) {
this.createUser = createUser;
}

public String getModifyUser() {
return modifyUser;
}

public void setModifyUser(String modifyUser) {
this.modifyUser = modifyUser;
}

public DataSourceType getDataSourceType() {
return dataSourceType;
}

public void setDataSourceType(DataSourceType dataSourceType) {
this.dataSourceType = dataSourceType;
}

public DataSourceEnv getDataSourceEnv() {
return dataSourceEnv;
}

public void setDataSourceEnv(DataSourceEnv dataSourceEnv) {
this.dataSourceEnv = dataSourceEnv;
}

public List<DataSourceParamKeyDefinition> getKeyDefinitions() {
return keyDefinitions;
}

public void setKeyDefinitions(List<DataSourceParamKeyDefinition> keyDefinitions) {
this.keyDefinitions = keyDefinitions;
}
}
Loading

0 comments on commit 9197722

Please sign in to comment.