Changeset 365 for gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java
- Timestamp:
- 08/08/12 14:53:41 (13 years ago)
- Location:
- gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor/GSSimStudio.java
r183 r365 105 105 @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"}) 106 106 @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"; 107 public class GSSimStudio implements ModelInitialization , FileUploadAccepter extends DatabaseHelper { 121 108 122 109 private Boolean developement = true; … … 151 138 152 139 @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 { 154 141 String expName = destFileName.split("_")[1].split(".properties")[0]; 155 142 String metaexpName = destFileName.split("_")[0]; … … 157 144 fileContent += "experiment.id="+expId.toString(); 158 145 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 } 159 188 160 189 return doSubmitApplication(grmsURL, grmsDN, jobDescription); … … 1433 1462 1434 1463 private void closeConnection(Connection connection, GSSimStudioModel model) { 1435 String error = model.getError(); 1464 String error = null; 1465 if (model != null) 1466 error = model.getError(); 1436 1467 1437 1468 if (connection != null) … … 1439 1470 connection.close(); 1440 1471 } catch (SQLException e) { 1441 error = model.getError();1442 1472 if (error == null || error.equals("")) { 1443 1473 error = "Error while trying to close the SQL connection"; … … 1448 1478 } 1449 1479 1450 model.setError(error); 1480 if (model != null) 1481 model.setError(error); 1451 1482 } 1452 1483
Note: See TracChangeset
for help on using the changeset viewer.