Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some problem fixed in service modules #227

Merged
merged 6 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions assembly-package/config/exchangis-server.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#
#

#wds.linkis.test.mode=false

wds.linkis.server.mybatis.datasource.url=jdbc:mysql://localhost:3306/database?useSSL=false&characterEncoding=UTF-8&allowMultiQueries=true

wds.linkis.server.mybatis.datasource.username=username
Expand All @@ -27,32 +25,27 @@ wds.linkis.log.clear=true

wds.linkis.server.version=v1

## datasource client
# datasource client
wds.exchangis.datasource.client.serverurl=
wds.exchangis.datasource.client.authtoken.key=DATASOURCE-AUTH
wds.exchangis.datasource.client.authtoken.value=DATASOURCE-AUTH
wds.exchangis.datasource.client.dws.version=v1

# launcher client
wds.exchangis.client.linkis.server-url=
wds.exchangis.client.linkis.token.value=DATASOURCE-AUTH
wds.exchangis.datasource.extension.dir=exchangis-extds

wds.exchangis.linkis.serverurl=

##restful
wds.linkis.server.restful.scan.packages=com.webank.wedatasphere.exchangis.datasource.server.restful.api,\
com.webank.wedatasphere.exchangis.project.server.restful,\
com.webank.wedatasphere.exchangis.job.server.restful
wds.linkis.server.mybatis.mapperLocations=classpath*:com/webank/wedatasphere/dss/framework/appconn/dao/impl/*.xml,classpath*:com/webank/wedatasphere/dss/workflow/dao/impl/*.xml\
,classpath*:com/webank/wedatasphere/exchangis/job/server/mapper/impl/*.xml:\
wds.linkis.server.mybatis.mapperLocations=classpath*:com/webank/wedatasphere/exchangis/job/server/mapper/impl/*.xml:\
,classpath*:com/webank/wedatasphere/exchangis/project/server/mapper/impl/*.xml

wds.linkis.server.mybatis.BasePackage=com.webank.wedatasphere.exchangis.dao,\
com.webank.wedatasphere.exchangis.project.server.mapper,\
com.webank.wedatasphere.linkis.configuration.dao,\
com.webank.wedatasphere.dss.framework.appconn.dao,\
com.webank.wedatasphere.dss.workflow.dao,\
com.webank.wedatasphere.linkis.metadata.dao,\
com.webank.wedatasphere.exchangis.job.server.mapper,\
com.webank.wedatasphere.exchangis.job.server.dao
com.webank.wedatasphere.exchangis.job.server.mapper



Expand Down
14 changes: 7 additions & 7 deletions assembly-package/config/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
<ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%t] %logger{36} %L %M - %msg%xEx%n"/>
</Console>
<!-- <RollingFile name="RollingFile" fileName="${sys:log.path}/${sys:serviceName}.log"-->
<!-- filePattern="${sys:log.path}/$${date:yyyy-MM}/${sys:serviceName}/exchangis-log-%d{yyyy-MM-dd}-%i.log">-->
<!-- <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%-40t] %c{1.} (%L) [%M] - %msg%xEx%n"/>-->
<!-- <SizeBasedTriggeringPolicy size="100MB"/>-->
<!-- <DefaultRolloverStrategy max="20"/>-->
<!-- </RollingFile>-->
<RollingFile name="RollingFile" fileName="${sys:log.path}/${sys:serviceName}.log"
filePattern="${sys:log.path}/$${date:yyyy-MM}/${sys:serviceName}/exchangis-log-%d{yyyy-MM-dd}-%i.log">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%-40t] %c{1.} (%L) [%M] - %msg%xEx%n"/>
<SizeBasedTriggeringPolicy size="100MB"/>
<DefaultRolloverStrategy max="20"/>
</RollingFile>
</appenders>
<loggers>
<root level="INFO" additivity="false">
<!-- <appender-ref ref="RollingFile"/>-->
<appender-ref ref="RollingFile"/>
<appender-ref ref="Console"/>
</root>
<logger name="com.webank.wedatasphere.exchangis.job.server.log.DefaultRpcJobLogger$" level="INFO" additivity="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public Message createJob(
exchangisJobVo.setCreateUser(userName);
Message response = Message.ok();
try{
response.data("result", jobInfoService.createJob(exchangisJobVo));
response.data("id", jobInfoService.createJob(exchangisJobVo).getId());
} catch (Exception e){
String message = "Fail to create dss job: " + exchangisJobVo.getJobName() +" (创建DSS任务失败)";
LOG.error(message, e);
Expand Down Expand Up @@ -109,7 +109,7 @@ public Message updateJob(@PathVariable("id") Long id,
if (!hasAuthority(userName, jobInfoService.getJob(id , true))){
return Message.error("You have no permission to update (没有更新权限)");
}
response.data("result", jobInfoService.updateJob(exchangisJobVo));
response.data("id", jobInfoService.updateJob(exchangisJobVo).getId());
} catch (Exception e){
String message = "Fail to update dss job: " + exchangisJobVo.getJobName() +" (更新DSS任务失败)";
LOG.error(message, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ public ExchangisJobVo updateJobConfig(ExchangisJobVo jobVo) {
public ExchangisJobVo updateJobContent(ExchangisJobVo jobVo) throws ExchangisJobServerException, ExchangisDataSourceException {
Long jobId = jobVo.getId();
ExchangisJobEntity exchangisJob = this.jobEntityDao.getDetail(jobId);
exchangisJob.setJobContent(jobVo.getContent());
final String engine = exchangisJob.getEngineType();
// 校验是否有重复子任务名
List<ExchangisJobInfoContent> content = LabelUtils.Jackson.fromJson(exchangisJob.getJobContent(),
Expand All @@ -193,7 +194,6 @@ public ExchangisJobVo updateJobContent(ExchangisJobVo jobVo) throws ExchangisJob
exchangisJob.setModifyUser(jobVo.getModifyUser());
exchangisJob.setLastUpdateTime(jobVo.getModifyTime());
this.exchangisJobDsBindService.updateJobDsBind(jobId, dsBinds);
exchangisJob.setJobContent(jobVo.getContent());
this.jobEntityDao.upgradeContent(exchangisJob);
return jobVo;
}
Expand Down
17 changes: 10 additions & 7 deletions exchangis-plugins/exchangis-appconn/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,15 @@
<version>${dss.version}</version>
</dependency>
<dependency>
<groupId>com.webank.wedatasphere.dss</groupId>
<artifactId>dss-origin-sso-integration-standard</artifactId>
<version>${dss.version}</version>
<groupId>org.apache.linkis</groupId>
<artifactId>linkis-storage</artifactId>
<version>${linkis.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>linkis-common</artifactId>
<groupId>org.apache.linkis</groupId>
</exclusion>
<exclusion>
<artifactId>json4s-jackson_2.11</artifactId>
<groupId>org.json4s</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand All @@ -70,6 +67,12 @@
<artifactId>dss-development-process-standard-execution</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>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
<formats>
<format>zip</format>
</formats>

<includeBaseDirectory>true</includeBaseDirectory>
<baseDirectory>exchangis</baseDirectory>
<dependencySets>
<dependencySet>
<!-- Enable access to all projects in the current multimodule build! <useAllReactorProjects>true</useAllReactorProjects> -->
Expand Down Expand Up @@ -59,6 +60,15 @@
<outputDirectory>conf</outputDirectory>
<lineEnding>unix</lineEnding>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>init.sql</include>
</includes>
<fileMode>0777</fileMode>
<outputDirectory>db</outputDirectory>
<lineEnding>unix</lineEnding>
</fileSet>

</fileSets>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class Constraints {
// AppConn name
public final static String EXCHANGIS_APPCONN_NAME = CommonVars.apply("wds.dss.appconn.exchangis.name", "Exchangis").getValue();

public final static String API_REQUEST_PREFIX = CommonVars.apply("wds.dss.appconn.exchangis.api.request-prefix", "/api/rest_j/v1/exchangis/dss").getValue();

public final static String DOMAIN_NAME = CommonVars.apply("wds.dss.appconn.exchangis.domain.name", "DSS").getValue();

// Constraint in Project operation
Expand All @@ -30,7 +32,7 @@ public class Constraints {
// Constraint in Ref operation
public final static String REF_JOB_DESC = "desc";
public final static String REF_JOB_ID = "id";
public final static String REF_JUMP_URL_FORMAT = "dss/exchangis/#/childJobManagement";
public final static String REF_JUMP_URL_FORMAT = CommonVars.apply("wds.dss.appconn.exchangis.ref.jump","#/childJobManagement").getValue();


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import java.util.function.Function;
import java.util.function.Supplier;

import static com.webank.wedatasphere.exchangis.dss.appconn.constraints.Constraints.API_REQUEST_PREFIX;

/**
* Abstract implement, contains the method to create sso request
*/
Expand Down Expand Up @@ -63,6 +65,9 @@ protected void setSSORequestService(AppIntegrationService<SSORequestService> app
this.ssoRequestService = appIntegrationService.getSSORequestService();
// Also upgrade the base url
this.baseURL = appIntegrationService.getAppInstance().getBaseUrl();
// Append the api prefix
this.baseURL = this.baseURL.endsWith(IOUtils.DIR_SEPARATOR_UNIX + "")?
baseURL + API_REQUEST_PREFIX: baseURL + IOUtils.DIR_SEPARATOR_UNIX + API_REQUEST_PREFIX;
this.redirectUrl = String.valueOf(appIntegrationService.getAppInstance().getConfig().get("redirectUrl"));
}
}
Expand Down
30 changes: 15 additions & 15 deletions exchangis-plugins/exchangis-appconn/src/main/resources/init.sql

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ProjectPageQuery extends PageQuery {
*/
protected String name;

protected String domain = ExchangisProject.Domain.STANDALONE.name();
protected String domain;

protected String createUser;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

import com.webank.wedatasphere.exchangis.common.pager.PageResult;
import com.webank.wedatasphere.exchangis.common.validator.groups.UpdateGroup;
import com.webank.wedatasphere.exchangis.project.server.entity.ExchangisProject;
import com.webank.wedatasphere.exchangis.project.server.service.ProjectService;
import com.webank.wedatasphere.exchangis.project.server.utils.ExchangisProjectRestfulUtils;
import com.webank.wedatasphere.exchangis.project.server.vo.ExchangisProjectInfo;
import com.webank.wedatasphere.exchangis.project.server.vo.ProjectQueryVo;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.math3.util.Pair;
import org.apache.linkis.common.utils.JsonUtils;
import org.apache.linkis.server.Message;
Expand Down Expand Up @@ -140,6 +142,11 @@ public Message updateProject(@Validated({UpdateGroup.class, Default.class}) @Req
if (!hasAuthority(username, projectStored)){
return Message.error("You have no permission to update (没有项目的更新权限)");
}
String domain = projectStored.getDomain();
if (StringUtils.isNotBlank(domain) && !ExchangisProject.Domain.STANDALONE.name()
.equalsIgnoreCase(domain)){
return Message.error("Cannot update the outer project (无法更新来自 " + domain + " 的外部项目)");
}
LOG.info("UpdateProject vo: {}, userName: {}", JsonUtils.jackson().writeValueAsString(projectVo), username);
projectService.updateProject(projectVo, username);
return ExchangisProjectRestfulUtils.dealOk("更新工程成功",
Expand All @@ -165,6 +172,11 @@ public Message deleteProject(HttpServletRequest request, @PathVariable("id") Lon
if (!hasAuthority(username, projectInfo)){
return Message.error("You have no permission to delete (删除工程失败)");
}
String domain = projectInfo.getDomain();
if (StringUtils.isNotBlank(domain) && !ExchangisProject.Domain.STANDALONE.name()
.equalsIgnoreCase(domain)){
return Message.error("Cannot delete the outer project (无法删除来自 " + domain + " 的外部项目)");
}
projectService.deleteProject(id);
return ExchangisProjectRestfulUtils.dealOk("删除工程成功");
} catch (Exception t) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public long createProject(ExchangisProjectInfo projectVo, String userName) {
project.setExecUsers(projectVo.getExecUsers());
project.setCreateUser(userName);
project.setCreateTime(Calendar.getInstance().getTime());
return this.projectMapper.insertOne(project);
this.projectMapper.insertOne(project);
return project.getId();
}

@Override
Expand Down