1 package fr.in2p3.jsaga.adaptor.data;
2
3 import java.io.IOException;
4
5 import org.globus.ftp.exception.ServerException;
6 import org.ogf.saga.error.AlreadyExistsException;
7 import org.ogf.saga.error.BadParameterException;
8 import org.ogf.saga.error.DoesNotExistException;
9 import org.ogf.saga.error.NoSuccessException;
10 import org.ogf.saga.error.PermissionDeniedException;
11 import org.ogf.saga.error.TimeoutException;
12
13
14
15
16
17
18
19
20
21
22
23
24
25 public class GsiftpStoRMDataAdaptor extends Gsiftp2DataAdaptor {
26 public String getType() {
27 return "gsiftp-storm";
28 }
29
30 protected void checkExists(String absolutePath) throws AlreadyExistsException, NoSuccessException, PermissionDeniedException, BadParameterException, TimeoutException, ParentDoesNotExist {
31 boolean exists;
32 try {
33 exists = m_client.exists(absolutePath);
34 } catch (Exception e) {
35 try {
36 throw rethrowExceptionFull(e);
37 } catch (DoesNotExistException e1) {
38 throw new ParentDoesNotExist(e);
39 }
40 }
41 if (exists) {
42
43
44
45
46
47 try {
48 if (m_client.getSize(absolutePath) > 0)
49 throw new AlreadyExistsException("File already exists: "+absolutePath);
50 } catch (ServerException e) {
51 throw new NoSuccessException(e);
52 } catch (IOException e) {
53 throw new NoSuccessException(e);
54 }
55 }
56 }
57
58
59
60 }