Skip to content

Commit b8395fe

Browse files
Merge remote-tracking branch 'origin/master'
2 parents 6b33e32 + 1d1a511 commit b8395fe

File tree

3 files changed

+58
-23
lines changed
  • dss-framework/dss-framework-orchestrator-server
  • plugins/dolphinscheduler/dolphinscheduler-prod-metrics/src/main/java/org/apache/dolphinscheduler/api/configuration

3 files changed

+58
-23
lines changed

dss-framework/dss-framework-orchestrator-server/pom.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,22 @@
149149
<version>${dss.version}</version>
150150
<scope>provided</scope>
151151
</dependency>
152+
<dependency>
153+
<groupId>org.apache.linkis</groupId>
154+
<artifactId>linkis-storage-script-dev-server</artifactId>
155+
<version>${linkis.version}</version>
156+
<exclusions>
157+
<exclusion>
158+
<artifactId>spring-context-support</artifactId>
159+
<groupId>org.springframework</groupId>
160+
</exclusion>
161+
</exclusions>
162+
</dependency>
163+
<dependency>
164+
<groupId>org.apache.linkis</groupId>
165+
<artifactId>linkis-storage</artifactId>
166+
<version>${linkis.version}</version>
167+
</dependency>
152168
</dependencies>
153169

154170
<build>

dss-framework/dss-framework-orchestrator-server/src/main/java/com/webank/wedatasphere/dss/orchestrator/server/restful/OrchestratorIERestful.java

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.webank.wedatasphere.dss.orchestrator.server.restful;
1818

1919
import com.webank.wedatasphere.dss.common.exception.DSSErrorException;
20+
import com.webank.wedatasphere.dss.common.exception.DSSRuntimeException;
2021
import com.webank.wedatasphere.dss.common.label.DSSLabel;
2122
import com.webank.wedatasphere.dss.common.label.EnvDSSLabel;
2223
import com.webank.wedatasphere.dss.common.label.LabelKeyConvertor;
@@ -31,8 +32,11 @@
3132
import com.webank.wedatasphere.dss.standard.app.sso.Workspace;
3233
import com.webank.wedatasphere.dss.standard.sso.utils.SSOHelper;
3334
import org.apache.commons.io.IOUtils;
35+
import org.apache.linkis.common.io.FsPath;
36+
import org.apache.linkis.filesystem.service.FsService;
3437
import org.apache.linkis.server.Message;
3538
import org.apache.linkis.server.security.SecurityFilter;
39+
import org.apache.linkis.storage.fs.FileSystem;
3640
import org.slf4j.Logger;
3741
import org.slf4j.LoggerFactory;
3842
import org.springframework.beans.factory.annotation.Autowired;
@@ -57,6 +61,8 @@ public class OrchestratorIERestful {
5761
@Autowired
5862
private BMLService bmlService;
5963
@Autowired
64+
private FsService fsService;
65+
@Autowired
6066
OrchestratorService orchestratorService;
6167
@Autowired
6268
private DSSOrchestratorContext orchestratorContext;
@@ -66,30 +72,43 @@ public Message importOrcFile(HttpServletRequest req,
6672
@RequestParam(required = false, name = "projectName") String projectName,
6773
@RequestParam(required = false, name = "projectID") Long projectID,
6874
@RequestParam(required = false, name = "labels") String labels,
69-
@RequestParam(required = false, name = "file") List<MultipartFile> files) throws DSSErrorException, Exception {
70-
if (null == files || files.size() == 0) {
75+
@RequestParam(required = false, name = "packageFile") MultipartFile packageFile,
76+
@RequestParam(required = false, name = "packageUri") String packageUri) throws Exception {
77+
78+
if (null == packageFile && packageUri == null) {
7179
throw new DSSErrorException(100788, "Import orchestrator failed for files is empty");
7280
}
73-
Long importOrcId = 0L;
74-
for (MultipartFile p : files) {
75-
InputStream inputStream = p.getInputStream();
76-
String fileName = new String(p.getOriginalFilename().getBytes("ISO8859-1"), "UTF-8");
77-
String userName = SecurityFilter.getLoginUsername(req);
78-
//调用工具类生产label
79-
List<DSSLabel> dssLabelList = getDSSLabelList(labels);
80-
Workspace workspace = SSOHelper.getWorkspace(req);
81+
String userName = SecurityFilter.getLoginUsername(req);
82+
//调用工具类生产label
83+
List<DSSLabel> dssLabelList = getDSSLabelList(labels);
84+
Workspace workspace = SSOHelper.getWorkspace(req);
85+
InputStream inputStream;
86+
String fileName;
87+
if (packageFile != null) {
88+
inputStream = packageFile.getInputStream();
89+
fileName = new String(packageFile.getOriginalFilename().getBytes("ISO8859-1"), "UTF-8");
8190
//3、打包新的zip包上传BML
82-
Map<String, Object> resultMap = bmlService.upload(userName, inputStream,
83-
fileName, projectName);
84-
try {
85-
RequestImportOrchestrator importRequest = new RequestImportOrchestrator(userName, projectName,
86-
projectID, resultMap.get("resourceId").toString(),
87-
resultMap.get("version").toString(), null, dssLabelList, workspace);
88-
importOrcId = orchestratorContext.getDSSOrchestratorPlugin(ImportDSSOrchestratorPlugin.class).importOrchestrator(importRequest);
89-
} catch (Exception e) {
90-
logger.error("Import orchestrator failed for ", e);
91-
throw new DSSErrorException(100789, "Import orchestrator failed for " + e.getMessage());
91+
logger.info("User {} begin to import orchestrator file", userName);
92+
} else {
93+
FsPath fsPath = new FsPath(packageUri);
94+
FileSystem fileSystem = fsService.getFileSystem(userName, fsPath);
95+
if ( !fileSystem.exists(fsPath) ) {
96+
throw new DSSRuntimeException("路径上不存在文件!");
9297
}
98+
inputStream = fileSystem.read(fsPath);
99+
fileName = packageUri.substring(packageUri.lastIndexOf('/') + 1);
100+
}
101+
102+
Map<String, Object> resultMap = bmlService.upload(userName, inputStream, fileName, projectName);
103+
Long importOrcId;
104+
try {
105+
RequestImportOrchestrator importRequest = new RequestImportOrchestrator(userName, projectName,
106+
projectID, resultMap.get("resourceId").toString(),
107+
resultMap.get("version").toString(), null, dssLabelList, workspace);
108+
importOrcId = orchestratorContext.getDSSOrchestratorPlugin(ImportDSSOrchestratorPlugin.class).importOrchestrator(importRequest);
109+
} catch (Exception e) {
110+
logger.error("Import orchestrator failed for ", e);
111+
throw new DSSErrorException(100789, "Import orchestrator failed for " + e.getMessage());
93112
}
94113
return Message.ok().data("importOrcId", importOrcId);
95114
}

plugins/dolphinscheduler/dolphinscheduler-prod-metrics/src/main/java/org/apache/dolphinscheduler/api/configuration/DssSSOConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.apache.dolphinscheduler.api.configuration;
22

3+
import com.webank.wedatasphere.dss.standard.app.sso.origin.filter.spring.SpringOriginSSOPluginFilter;
34
import com.webank.wedatasphere.dss.standard.app.sso.plugin.filter.SSOPluginFilter;
4-
import org.springframework.beans.factory.annotation.Autowired;
55
import org.springframework.boot.web.servlet.FilterRegistrationBean;
66
import org.springframework.context.annotation.Bean;
77
import org.springframework.context.annotation.Configuration;
@@ -15,10 +15,10 @@
1515
public class DssSSOConfiguration {
1616

1717
@Bean
18-
public FilterRegistrationBean<SSOPluginFilter> dssSSOInterceptor(@Autowired SSOPluginFilter ssoPluginFilter) {
18+
public FilterRegistrationBean<SSOPluginFilter> dssSSOInterceptor() {
1919
FilterRegistrationBean<SSOPluginFilter> filter = new FilterRegistrationBean<>();
2020
filter.setName("dssSSOFilter");
21-
filter.setFilter(ssoPluginFilter);
21+
filter.setFilter(new SpringOriginSSOPluginFilter());
2222
filter.setOrder(-1);
2323
return filter;
2424
}

0 commit comments

Comments
 (0)