wolfboys commented on code in PR #2948:
URL: 
https://github.com/apache/incubator-streampark/pull/2948#discussion_r1295226007


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/AppBuildPipeServiceImpl.java:
##########
@@ -234,13 +235,21 @@ public void onStart(PipeSnapshot snapshot) {
               FsOperator fsOperator = app.getFsOperator();
               fsOperator.delete(appHome);
               if (app.isUploadJob()) {
+                String uploadJar = appUploads.concat("/").concat(app.getJar());
                 File localJar =
                     new File(
                         String.format(
                             "%s/%d/%s",
                             Workspace.local().APP_UPLOADS(), app.getTeamId(), 
app.getJar()));
+                if (!localJar.exists()) {
+                  Resource resource =
+                      resourceService.findByResourceName(app.getTeamId(), 
app.getJar());
+                  if (resource != null && 
StringUtils.isNotBlank(resource.getResourcePath())) {
+                    localJar = new 
File(resource.getResourcePath().split(":")[1]);
+                    uploadJar = 
appUploads.concat("/").concat(localJar.getName());

Review Comment:
   We can add the following methods in the Resource entity to conveniently 
access the name and path.
   
   
   ``` java
   
       public void setResourcePath(String resourcePath) {
           if (resourcePath == null) {
               throw new IllegalArgumentException("resource path cannot be 
null.");
           }
           String[] namePath = resourcePath.split(":");
           if (namePath.length != 2) {
               throw new IllegalArgumentException("resource path invalid, 
format: $name:$path");
           }
           this.resourcePath = resourcePath;
       }
   
       public String getFileName() {
           if (this.resourcePath == null) {
               return null;
           }
           return resourcePath.split(":")[0];
       }
   
       public String getFilePath() {
           if (this.resourcePath == null) {
               return null;
           }
           return resourcePath.split(":")[1];
       }
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to