Changeset 369 for gssim_ui


Ignore:
Timestamp:
08/10/12 14:18:18 (13 years ago)
Author:
mcichenski
Message:

test for moving files

Location:
gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor/DatabaseHelper.java

    r365 r369  
    3131         */ 
    3232        protected String apJobDescription = "job_description"; 
     33        /** 
     34         * Application property for input location 
     35         */ 
     36        protected String apInputLocation = "input_location"; 
     37        /** 
     38         * Application property for output location 
     39         */ 
     40        protected String apOutputLocation = "output_location"; 
     41        /** 
     42         * Application property for GSSim input files location 
     43         */ 
     44        protected String apGSSimInput = "gssim_input"; 
    3345         
    3446        /** 
     
    3648         */ 
    3749        protected String jdPropertyFile = "$PROPERTY_FILE"; 
     50        /** 
     51         * Job description token for input location 
     52         */ 
     53        protected String jdInputLocation = "$INPUT_LOCATION"; 
     54        /** 
     55         * Job description token for output location 
     56         */ 
     57        protected String jdOutputLocation = $OUTPUT_LOCATION"; 
    3858} 
  • gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor/GSSimStudio.java

    r368 r369  
    147147                uploadPropertyFile(destFileName, fileContent); 
    148148                 
     149                UUID uuid = UUID.randomUUID(); 
     150                String uniqueFolderName = uuid.toString(); 
     151                 
    149152                String grmsURL = null; 
    150153                String grmsDN = null; 
    151154                String jobDescription = null; 
     155                String inputLocation = null; 
     156                String outputLocatin = null; 
     157                String gssimInput = null; 
    152158                 
    153159                Connection connection = null; 
     
    173179                        else { 
    174180                                jobDescription = list.get(0).getValue(); 
    175                                 //replace tokens 
    176                                 jobDescription = jobDescription.replace(jdPropertyFile, "input/" + destFileName); 
     181                                jobDescription = jobDescription.replace(jdPropertyFile, uniqueFolderName + "/" + destFileName); 
    177182                        } 
     183                         
     184                        finder = Finder.getApplicationPropertyFinder(apInputLocation); 
     185                        list = applicationPropertyDAO.find(finder); 
     186                        if (list.isEmpty()) ; 
     187                        else { 
     188                                inputLocation = list.get(0).getValue(); 
     189                                if (inputLocation.endsWith("/")) 
     190                                        inputLocation = inputLocation.substring(0,inputLocation.length() - 1); 
     191                                if (jobDescription != null) 
     192                                        jobDescription = jobDescription.replace(jdInputLocation, inputLocation); 
     193                        } 
     194                         
     195                        finder = Finder.getApplicationPropertyFinder(apOutputLocation); 
     196                        list = applicationPropertyDAO.find(finder); 
     197                        if (list.isEmpty()) ; 
     198                        else { 
     199                                outputLocation = list.get(0).getValue(); 
     200                                if (jobDescription != null) 
     201                                        jobDescription = jobDescription.replace(jdOutputLocation, outputLocation); 
     202                        } 
     203                         
     204                        finder = Finder.getApplicationPropertyFinder(apGSSimInput); 
     205                        list = applicationPropertyDAO.find(finder); 
     206                        if (list.isEmpty()) ; 
     207                        else 
     208                                gssimInput = list.get(0).getValue(); 
     209                         
    178210                } catch (SQLException e) { 
    179211                        ; 
     
    188220                } finally { 
    189221                        closeConnection(connection, null); 
    190                 }        
     222                } 
     223                 
     224                //move the files to unique subfolder 
     225                String cmd = new String[2]; 
     226                cmd[0] = "mkdir"; 
     227                cmd[1] = inputLocation + "/" + uniqueFolderName; 
     228                Runtime.getRuntime().exec(cmd).waitFor(); 
     229                cmd = new String[3]; 
     230                cmd[0] = "cp"; 
     231                cmd[2] = inputLocation + "/" + uniqueFolderName 
     232                cmd[1] = gssimInput + "/" + destFileName; 
     233                Runtime.getRuntime().exec(cmd).waitFor(); 
    191234                 
    192235                return doSubmitApplication(grmsURL, grmsDN, jobDescription); 
Note: See TracChangeset for help on using the changeset viewer.