Changeset 507 for tapas/service


Ignore:
Timestamp:
05/14/12 17:44:52 (12 years ago)
Author:
rboipsl
Message:

correction structure fichier xml
creation repertoire user

Location:
tapas/service
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tapas/service/implementation/com/ether/TapasServiceImpl.java

    r504 r507  
    4646{ 
    4747    @Transactional(readOnly = true) 
    48     public void createXMLRequest( @NotNull final Tapas fTapas, @NotNull final User user, @NotNull final Properties prop ) 
     48    public void createXMLRequest( @NotNull final Tapas fTapas, @NotNull final Properties prop ) 
    4949            throws ServiceException 
    5050    { 
     
    5454        final String dataPath = prop.getProperty( "data_path" ); 
    5555 
    56         final String userPath = ""; 
    57         final String fichier = servicePath+"/"+user.getLastName()+"/"+"request.xml"; 
     56        final String fichier = servicePath+"/"+"request.xml"; 
    5857        final Element tapas = new Element( "tapas" ); 
    5958        final List<Element> listRequest = new ArrayList<Element>(fTapas.getRequests().size()); 
     
    6362 
    6463        //recuperation valeur id requete (bdd table tapas_request) 
    65         fTapas.setId( "ETHER_TAPAS_" + String.valueOf( getNumRequest() ) ); 
     64        fTapas.setId( "Ether_TAPAS_" + String.valueOf( getNumRequest() ) ); 
    6665 
    6766        final Attribute id = new Attribute( "Id", fTapas.getId() ); 
     
    8685            final Element format = new Element( "format" ); 
    8786            //final Attribute validF = new Attribute( "valid", iRequest.getPreference().getFormat().getFirstValue() ); 
    88             final Attribute validF = new Attribute( "valid", "ACII,FITS,NETCDF" ); 
     87            final Attribute validF = new Attribute( "valid", "ASCII,FITS,NETCDF" ); 
    8988            format.setAttribute( validF ); 
    9089            format.setText( iRequest.getPreference().getFormat().getSecondValue() ); 
     
    107106            preferences.addContent( h2oe ); 
    108107 
    109             //o2 
    110             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 ); 
    115108 
    116109            //o3 
     
    121114            preferences.addContent( o3e ); 
    122115 
     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 
    123124            //co2 
    124125            final Element co2e = new Element( "co2_extinction" ); 
     
    161162 
    162163            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 ); 
    163168            longitude.setText( obs.getLongitude().toString() ); 
    164169            observatory.addContent( longitude ); 
    165170 
    166171            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 ); 
    167176            latitude.setText( obs.getLatitude().toString() ); 
    168177            observatory.addContent( latitude ); 
    169178 
    170179            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 ); 
    171184            altitude.setText( obs.getAltitude().toString() ); 
    172185            observatory.addContent( altitude ); 
     
    231244 
    232245            // 
    233             final Element ilsfChoice = new Element( "ilsfChoice" ); 
     246            final Element ilsfChoice = new Element( "ilsf_choice" ); 
    234247            validR = new Attribute( "valid", iRequest.getObservation().getInstrument().getIlsfChoice().getFirstValue() ); 
    235248            ilsfChoice.setAttribute( validR ); 
     
    286299        tapas.addContent( listRequest ); 
    287300 
    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 
    293337    } 
    294338 
     
    298342    { 
    299343        String commande=""; 
    300         String commandePath=prop.getProperty( "service_path" )+"/"+user.getLastName()+"/"+repCommande+"/"; 
     344        String commandePath=prop.getProperty( "service_path" )+"/"+repCommande+"/"; 
    301345 
    302346        //copie run qsub dans repertoire commande 
    303347        commande = "cp "+prop.getProperty( "src_path" )+"/"+prop.getProperty( "process_name" )+" "+commandePath; 
    304348 
     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" ); 
    305373        try 
    306374        { 
     
    393461 
    394462 
    395     public void createXMLFile( final Document document, final String commandePath ) 
     463    public void createXMLFile( final Document document, final String commandePath, final Properties prop ) 
    396464    { 
    397465        try 
     
    400468            try 
    401469            { 
    402                 EtherHelper.execProcess( "mkdir -p "+commandePath ); 
     470                EtherHelper.execProcess( "mkdir -p "+commandePath+" ; chown "+prop.getProperty( "chown_user" )+" "+commandePath ); 
    403471            } 
    404472            catch( FormattedException e ) 
     
    417485            sortie.output( document, new FileOutputStream( fichier ) ); 
    418486 
    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); 
    420497 
    421498        } 
  • tapas/service/interface/com/ether/TapasService.java

    r504 r507  
    2020{ 
    2121 
    22     public void createXMLRequest( @NotNull final Tapas tapas, @NotNull final User user, @NotNull final Properties prop ) 
     22    public void createXMLRequest( @NotNull final Tapas tapas, @NotNull final Properties prop ) 
    2323            throws ServiceException; 
    2424 
    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 ); 
    2629 
    2730    public List<Observatory> getAllObservatories() throws ServiceException; 
Note: See TracChangeset for help on using the changeset viewer.