Changeset 365 for gssim_ui/branches


Ignore:
Timestamp:
08/08/12 14:53:41 (13 years ago)
Author:
mcichenski
Message:

moved application properties to database

Location:
gssim_ui/branches/vine/gssimstudio/src/web/ui/flex
Files:
2 added
3 edited

Legend:

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

    r183 r365  
    2323         
    2424<charts:ResourceChartModel id="experimentModel" />  
    25          
    26 <fx:XML id="xml"> 
    27 <qcgJob appId="gssim"> 
    28         <task persistent="true" taskId="gssim"> 
    29                 <candidateHosts> 
    30                         <hostName>zeus.cyfronet.pl</hostName> 
    31                 </candidateHosts> 
    32                 <execution type="single"> 
    33                         <executable> 
    34                                 <execFile> 
    35                                         <file> 
    36                                                 <location type="URL">file:////mnt/auto/people/plgmcichenski/gssim/start-gssim-cp.sh</location> 
    37                                         </file> 
    38                                 </execFile> 
    39                         </executable> 
    40                         <arguments> 
    41                                 <value>input/experiment.properties</value> 
    42                         </arguments>                                                                                         
    43                         <stageInOut> 
    44                                 <directory name="input" type="in"> 
    45                                         <location type="URL">gsiftp://gssim.man.poznan.pl//usr/local/admin/gssim/input</location> 
    46                                 </directory> 
    47                                  
    48                                 <directory name="output" type="out"> 
    49                                         <location type="URL">gsiftp://gssim.man.poznan.pl//usr/local/admin/gssim/output/$\{JOB_ID}-$\{TASK_ID}</location> 
    50                                 </directory> 
    51  
    52                                 <file name="gssim.log" type="out" required="false"> 
    53                                         <location type="URL">gsiftp://gssim.man.poznan.pl//usr/local/admin/gssim/output/$\{JOB_ID}-$\{TASK_ID}/gssim.log</location> 
    54                                 </file> 
    55  
    56                                 <file name="trash.log" type="out" required="false"> 
    57                                         <location type="URL">gsiftp://gssim.man.poznan.pl//usr/local/admin/gssim/output/$\{JOB_ID}-$\{TASK_ID}/trash.log</location> 
    58                                 </file> 
    59                         </stageInOut> 
    60                 </execution> 
    61         </task> 
    62 </qcgJob> 
    63 </fx:XML> 
    6425 
    6526</fx:Declarations> 
  • gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/app/gssim/gssimstudio/editor/views/ExperimentEditor.mxml

    r237 r365  
    9191                                //prepare job description and generate properties file name 
    9292                                var propertyFileName : String = experiment.metaname + "_" + experiment.name + ".properties"; 
    93                                 parentApplication.xml.children().children().children()[2].children()[0] = 
    94                                         "input/" + propertyFileName; 
    95                                 var jobDescription : String = parentApplication.xml.toXMLString(); 
    96                                 jobDesc.text = jobDescription; 
     93                                 
     94                                //parentApplication.xml.children().children().children()[2].children()[0] = 
     95                                //      "input/" + propertyFileName; 
     96                                //var jobDescription : String = parentApplication.xml.toXMLString(); 
     97                                //jobDesc.text = jobDescription; 
    9798                                 
    9899                                //prepare grms addresses 
    99                                 //var serviceDN : String = "/C=PL/O=GRID/O=PSNC/CN=grms/elder3.man.poznan.pl"; 
    100                                 //var serviceURL : String = "https://elder3.man.poznan.pl:8443/gridge/services/GrmsJobFactory"; 
    101                                  
    102                                 var serviceDN : String = "/C=PL/O=GRID/O=PSNC/CN=qcg-broker/qcg-broker.man.poznan.pl"; 
    103                                 var serviceURL : String = "https://qcg-broker.man.poznan.pl:8443/qcg/services/JobFactory"; 
     100                                //var serviceDN : String = "/C=PL/O=GRID/O=PSNC/CN=qcg-broker/qcg-broker.man.poznan.pl"; 
     101                                //var serviceURL : String = "https://qcg-broker.man.poznan.pl:8443/qcg/services/JobFactory"; 
    104102                                 
    105103                                parentApplication.service.uploadAndSubmitExperiment 
    106                                         (propertyFileName, experiment.toString(), serviceURL, serviceDN, jobDescription); 
     104                                        (propertyFileName, experiment.toString()); 
    107105                        } 
    108106                         
  • gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor/GSSimStudio.java

    r183 r365  
    105105@BlazeDsDestination(swfHeight = "800", locales = {"en_US","pl_PL"}, names = {"GSSim Studio","GSSim Studio"}, descriptions = {"Application for GSSim job description","Aplikacja do generowania zadaᅵ dla symulatora GSSim"}) 
    106106@PortletDisplayName(locales = {"en", "pl"}, values = {"GSSimStudio Application", "Aplikacja GSSimStudio"}) 
    107 public class GSSimStudio implements ModelInitialization , FileUploadAccepter { 
    108  
    109         /** 
    110          * The location of database source 
    111          */ 
    112         private String dbAddress = "localhost:3306/gssim_results"; 
    113         /** 
    114          * Username to access database 
    115          */ 
    116         private String dbUser = "gssim"; 
    117         /** 
    118          * Password to database [is it safe?] 
    119          */ 
    120         private String dbPassword = "gssimstudiodb"; 
     107public class GSSimStudio implements ModelInitialization , FileUploadAccepter extends DatabaseHelper { 
    121108         
    122109        private Boolean developement = true; 
     
    151138     
    152139    @BlazeDsMethod() 
    153         public GSSimStudioModel uploadAndSubmitExperiment(String destFileName, String fileContent, String grmsURL, String grmsDN, String jobDescription) throws IOException { 
     140        public GSSimStudioModel uploadAndSubmitExperiment(String destFileName, String fileContent) throws IOException { 
    154141                String expName = destFileName.split("_")[1].split(".properties")[0]; 
    155142                String metaexpName = destFileName.split("_")[0]; 
     
    157144                fileContent += "experiment.id="+expId.toString(); 
    158145                uploadPropertyFile(destFileName, fileContent); 
     146                 
     147                String grmsURL = null; 
     148                String grmsDN = null; 
     149                String jobDescription = null; 
     150                 
     151                try { 
     152                        connection = factory().createDBConnection(dbAddress, dbUser, 
     153                                        dbPassword); 
     154                        ApplicationPropertyDAO applicationPropertyDAO = factory.createApplicationProperty(); 
     155                        Finder finder = Finder.getApplicationPropertyFinder(apServiceURL); 
     156                        List<ApplicationProperty> list = applicationPropertyDAO.find(finder); 
     157                        if (list.isEmpty()) ; 
     158                        else 
     159                                grmsURL = list.get(0).getValue(); 
     160                         
     161                        finder = Finder.getApplicationPropertyFinder(apServiceDN); 
     162                        list = applicationPropertyDAO.find(finder); 
     163                        if (list.isEmpty()) ; 
     164                        else 
     165                                grmsDN = list.get(0).getValue(); 
     166                         
     167                        finder = Finder.getApplicationPropertyFinder(apJobDescription); 
     168                        list = applicationPropertyDAO.find(finder); 
     169                        if (list.isEmpty()) ; 
     170                        else { 
     171                                jobDescription = list.get(0).getValue(); 
     172                                //replace tokens 
     173                                jobDescription.replace(jdPropertyFile, "input/" + destFileName); 
     174                        } 
     175                } catch (SQLException e) { 
     176                        ; 
     177                } catch (InstantiationException e) { 
     178                        ;                
     179                } catch (IllegalAccessException e) { 
     180                        ;        
     181                } catch (ClassNotFoundException e) { 
     182                        ;        
     183                } catch (Exception e) { 
     184                        ;        
     185                } finally { 
     186                        closeConnection(connection, null); 
     187                }        
    159188                 
    160189                return doSubmitApplication(grmsURL, grmsDN, jobDescription); 
     
    14331462         
    14341463        private void closeConnection(Connection connection, GSSimStudioModel model) { 
    1435                 String error = model.getError(); 
     1464                String error = null; 
     1465                if (model != null) 
     1466                        error = model.getError(); 
    14361467                 
    14371468                if (connection != null) 
     
    14391470                                connection.close(); 
    14401471                        } catch (SQLException e) { 
    1441                                 error = model.getError(); 
    14421472                                if (error == null || error.equals("")) { 
    14431473                                        error = "Error while trying to close the SQL connection"; 
     
    14481478                        } 
    14491479 
    1450                 model.setError(error); 
     1480                if (model != null) 
     1481                        model.setError(error); 
    14511482        } 
    14521483 
Note: See TracChangeset for help on using the changeset viewer.