View Javadoc

1   package fr.in2p3.jsaga.adaptor.data;
2   
3   import org.globus.ftp.exception.UnexpectedReplyCodeException;
4   import org.ogf.saga.error.*;
5   
6   /* ***************************************************
7   * *** Centre de Calcul de l'IN2P3 - Lyon (France) ***
8   * ***             http://cc.in2p3.fr/             ***
9   * ***************************************************
10  * File:   GsiftpDCacheDataAdaptor
11  * Author: Sylvain Reynaud (sreynaud@in2p3.fr)
12  * Date:   2 nov. 2007
13  * ***************************************************
14  * Description:                                      */
15  /**
16   *
17   */
18  public class GsiftpDCacheDataAdaptor extends Gsiftp2DataAdaptor {
19      public String getType() {
20          return "gsiftp-dcache";
21      }
22  
23      protected void rethrowParsedException(UnexpectedReplyCodeException e) throws DoesNotExistException, AlreadyExistsException, PermissionDeniedException, NoSuccessException {
24          String message = e.getReply().getMessage();
25          if (message.indexOf("not a plain file") > -1 || message.indexOf("Local error") > -1 || message.indexOf("File not found") > -1) {
26              throw new DoesNotExistException(e);
27          } else if (message.indexOf("exists") > -1) {
28              throw new AlreadyExistsException(e);
29          } else if (message.indexOf("Permission denied") > -1) {
30              throw new PermissionDeniedException(e);
31          } else {
32              throw new NoSuccessException(e);
33          }
34      }
35  }