3838import com .webank .wedatasphere .dss .standard .app .sso .Workspace ;
3939import com .webank .wedatasphere .dss .standard .sso .utils .SSOHelper ;
4040import org .apache .commons .io .IOUtils ;
41+ import org .apache .linkis .common .io .Fs ;
4142import org .apache .linkis .common .io .FsPath ;
42- import org .apache .linkis .filesystem .service .FsService ;
4343import org .apache .linkis .server .Message ;
4444import org .apache .linkis .server .security .SecurityFilter ;
45- import org .apache .linkis .storage .fs . FileSystem ;
45+ import org .apache .linkis .storage .FSFactory ;
4646import org .slf4j .Logger ;
4747import org .slf4j .LoggerFactory ;
4848import org .springframework .beans .factory .annotation .Autowired ;
5858import java .io .IOException ;
5959import java .io .InputStream ;
6060import java .util .Arrays ;
61+ import java .util .HashMap ;
6162import java .util .List ;
6263import java .util .Map ;
6364
@@ -69,8 +70,6 @@ public class OrchestratorIERestful {
6970 @ Qualifier ("orchestratorBmlService" )
7071 private BMLService bmlService ;
7172 @ Autowired
72- private FsService fsService ;
73- @ Autowired
7473 OrchestratorService orchestratorService ;
7574 @ Autowired
7675 private DSSOrchestratorContext orchestratorContext ;
@@ -93,22 +92,25 @@ public Message importOrcFile(HttpServletRequest req,
9392 Workspace workspace = SSOHelper .getWorkspace (req );
9493 InputStream inputStream ;
9594 String fileName ;
95+ BmlResource resultMap =null ;
9696 if (packageFile != null ) {
9797 inputStream = packageFile .getInputStream ();
9898 fileName = new String (packageFile .getOriginalFilename ().getBytes ("ISO8859-1" ), "UTF-8" );
9999 //3、打包新的zip包上传BML
100100 logger .info ("User {} begin to import orchestrator file" , userName );
101+ resultMap = bmlService .upload (userName , inputStream , fileName , projectName );
101102 } else {
102103 FsPath fsPath = new FsPath (packageUri );
103- FileSystem fileSystem = fsService .getFileSystem (userName , fsPath );
104- if ( !fileSystem .exists (fsPath ) ) {
105- throw new DSSRuntimeException ("路径上不存在文件!" );
104+ try (Fs fileSystem = FSFactory .getFsByProxyUser (fsPath , userName )) {
105+ fileSystem .init (new HashMap <String , String >());
106+ if (!fileSystem .exists (fsPath )) {
107+ throw new DSSRuntimeException ("路径上不存在文件!" );
108+ }
109+ inputStream = fileSystem .read (fsPath );
110+ fileName = packageUri .substring (packageUri .lastIndexOf ('/' ) + 1 );
111+ resultMap = bmlService .upload (userName , inputStream , fileName , projectName );
106112 }
107- inputStream = fileSystem .read (fsPath );
108- fileName = packageUri .substring (packageUri .lastIndexOf ('/' ) + 1 );
109113 }
110-
111- BmlResource resultMap = bmlService .upload (userName , inputStream , fileName , projectName );
112114 DSSOrchestratorVersion dssOrchestratorVersion ;
113115 try {
114116 RequestImportOrchestrator importRequest = new RequestImportOrchestrator (userName , projectName ,
0 commit comments