Changeset 507 for tapas/service
- Timestamp:
- 05/14/12 17:44:52 (12 years ago)
- Location:
- tapas/service
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tapas/service/implementation/com/ether/TapasServiceImpl.java
r504 r507 46 46 { 47 47 @Transactional(readOnly = true) 48 public void createXMLRequest( @NotNull final Tapas fTapas, @NotNull final User user, @NotNull finalProperties prop )48 public void createXMLRequest( @NotNull final Tapas fTapas, @NotNull final Properties prop ) 49 49 throws ServiceException 50 50 { … … 54 54 final String dataPath = prop.getProperty( "data_path" ); 55 55 56 final String userPath = ""; 57 final String fichier = servicePath+"/"+user.getLastName()+"/"+"request.xml"; 56 final String fichier = servicePath+"/"+"request.xml"; 58 57 final Element tapas = new Element( "tapas" ); 59 58 final List<Element> listRequest = new ArrayList<Element>(fTapas.getRequests().size()); … … 63 62 64 63 //recuperation valeur id requete (bdd table tapas_request) 65 fTapas.setId( "E THER_TAPAS_" + String.valueOf( getNumRequest() ) );64 fTapas.setId( "Ether_TAPAS_" + String.valueOf( getNumRequest() ) ); 66 65 67 66 final Attribute id = new Attribute( "Id", fTapas.getId() ); … … 86 85 final Element format = new Element( "format" ); 87 86 //final Attribute validF = new Attribute( "valid", iRequest.getPreference().getFormat().getFirstValue() ); 88 final Attribute validF = new Attribute( "valid", "A CII,FITS,NETCDF" );87 final Attribute validF = new Attribute( "valid", "ASCII,FITS,NETCDF" ); 89 88 format.setAttribute( validF ); 90 89 format.setText( iRequest.getPreference().getFormat().getSecondValue() ); … … 107 106 preferences.addContent( h2oe ); 108 107 109 //o2110 final Element o2e = new Element( "o2_extinction" );111 validR = new Attribute( "valid", "YES,NO" );112 o2e.setAttribute( validR );113 o2e.setText( iRequest.getPreference().getO2Extinction().getSecondValue() );114 preferences.addContent( o2e );115 108 116 109 //o3 … … 121 114 preferences.addContent( o3e ); 122 115 116 //o2 117 final Element o2e = new Element( "o2_extinction" ); 118 validR = new Attribute( "valid", "YES,NO" ); 119 o2e.setAttribute( validR ); 120 o2e.setText( iRequest.getPreference().getO2Extinction().getSecondValue() ); 121 preferences.addContent( o2e ); 122 123 123 124 //co2 124 125 final Element co2e = new Element( "co2_extinction" ); … … 161 162 162 163 final Element longitude = new Element( "longitude" ); 164 validR = new Attribute( "min", "-180" ); 165 longitude.setAttribute( validR ); 166 validR = new Attribute( "max", "180" ); 167 longitude.setAttribute( validR ); 163 168 longitude.setText( obs.getLongitude().toString() ); 164 169 observatory.addContent( longitude ); 165 170 166 171 final Element latitude = new Element( "latitude" ); 172 validR = new Attribute( "min", "-90" ); 173 latitude.setAttribute( validR ); 174 validR = new Attribute( "max", "90" ); 175 latitude.setAttribute( validR ); 167 176 latitude.setText( obs.getLatitude().toString() ); 168 177 observatory.addContent( latitude ); 169 178 170 179 final Element altitude = new Element( "altitude" ); 180 validR = new Attribute( "min", "0" ); 181 altitude.setAttribute( validR ); 182 validR = new Attribute( "max", "10000" ); 183 altitude.setAttribute( validR ); 171 184 altitude.setText( obs.getAltitude().toString() ); 172 185 observatory.addContent( altitude ); … … 231 244 232 245 // 233 final Element ilsfChoice = new Element( "ilsf Choice" );246 final Element ilsfChoice = new Element( "ilsf_choice" ); 234 247 validR = new Attribute( "valid", iRequest.getObservation().getInstrument().getIlsfChoice().getFirstValue() ); 235 248 ilsfChoice.setAttribute( validR ); … … 286 299 tapas.addContent( listRequest ); 287 300 288 String commandePath = servicePath+"/"+user.getLastName()+"/"+fTapas.getId(); 289 createXMLFile( document, commandePath ); 290 291 //appel a qsub 292 //execAppelQSub( commandePath, user, prop ); 301 String commandePath = servicePath+"/"+fTapas.getId(); 302 createXMLFile( document, commandePath, prop ); 303 304 305 } 306 307 @Transactional(readOnly = true) 308 public void createUserFtpDir( @NotNull final User user, @NotNull final Properties prop ) 309 throws ServiceException 310 { 311 312 final String usersPath = prop.getProperty( "users_path" ); 313 String commande = "mkdir -p "+usersPath+"/"+user.getEmail(); 314 315 try 316 { 317 EtherHelper.execProcess( commande ); 318 } 319 catch( FormattedException e ) 320 { 321 322 } 323 324 EtherHelper.pause(4000); 325 326 commande = "chown -R "+prop.getProperty( "chown_user" )+" "+usersPath+"/"+user.getEmail(); 327 328 try 329 { 330 EtherHelper.execProcess( commande ); 331 } 332 catch( FormattedException e ) 333 { 334 335 } 336 293 337 } 294 338 … … 298 342 { 299 343 String commande=""; 300 String commandePath=prop.getProperty( "service_path" )+"/"+ user.getLastName()+"/"+repCommande+"/";344 String commandePath=prop.getProperty( "service_path" )+"/"+repCommande+"/"; 301 345 302 346 //copie run qsub dans repertoire commande 303 347 commande = "cp "+prop.getProperty( "src_path" )+"/"+prop.getProperty( "process_name" )+" "+commandePath; 304 348 349 try 350 { 351 EtherHelper.execProcess( commande ); 352 } 353 catch( FormattedException e ) 354 { 355 356 } 357 358 EtherHelper.pause(5000); 359 360 commande="chown "+prop.getProperty( "chown_user" )+" "+prop.getProperty( "src_path" )+"/"+prop.getProperty( "process_name" ); 361 try 362 { 363 EtherHelper.execProcess( commande ); 364 } 365 catch( FormattedException e ) 366 { 367 368 } 369 370 EtherHelper.pause(5000); 371 372 commande="chmod 755 "+prop.getProperty( "src_path" )+"/"+prop.getProperty( "process_name" ); 305 373 try 306 374 { … … 393 461 394 462 395 public void createXMLFile( final Document document, final String commandePath )463 public void createXMLFile( final Document document, final String commandePath, final Properties prop ) 396 464 { 397 465 try … … 400 468 try 401 469 { 402 EtherHelper.execProcess( "mkdir -p "+commandePath );470 EtherHelper.execProcess( "mkdir -p "+commandePath+" ; chown "+prop.getProperty( "chown_user" )+" "+commandePath ); 403 471 } 404 472 catch( FormattedException e ) … … 417 485 sortie.output( document, new FileOutputStream( fichier ) ); 418 486 419 //EtherHelper.pause(7000); 487 try 488 { 489 EtherHelper.execProcess( "chmod 755 "+commandePath+"/"+"request.xml" ); 490 } 491 catch( FormattedException e ) 492 { 493 494 } 495 496 EtherHelper.pause(7000); 420 497 421 498 } -
tapas/service/interface/com/ether/TapasService.java
r504 r507 20 20 { 21 21 22 public void createXMLRequest( @NotNull final Tapas tapas, @NotNull final User user, @NotNull finalProperties prop )22 public void createXMLRequest( @NotNull final Tapas tapas, @NotNull final Properties prop ) 23 23 throws ServiceException; 24 24 25 public void createXMLFile( final Document document, final String commandePath ); 25 public void createUserFtpDir( @NotNull final User user, @NotNull final Properties prop ) 26 throws ServiceException; 27 28 public void createXMLFile( final Document document, final String commandePath, final Properties prop ); 26 29 27 30 public List<Observatory> getAllObservatories() throws ServiceException;
Note: See TracChangeset
for help on using the changeset viewer.