1 package fr.in2p3.jsaga.adaptor.data;
2
3 import org.ogf.saga.error.AlreadyExistsException;
4 import org.ogf.saga.error.BadParameterException;
5 import org.ogf.saga.error.DoesNotExistException;
6 import org.ogf.saga.error.NoSuccessException;
7 import org.ogf.saga.error.PermissionDeniedException;
8 import org.ogf.saga.error.TimeoutException;
9
10 import fr.in2p3.jsaga.adaptor.data.read.FileAttributes;
11
12
13
14
15
16
17
18
19
20
21
22
23
24 public class GsiftpDPMDataAdaptor extends Gsiftp2DataAdaptor {
25
26 public String getType() {
27 return "gsiftp-dpm";
28 }
29
30
31
32
33 @Override
34 protected void checkExists(String absolutePath) throws AlreadyExistsException, NoSuccessException, PermissionDeniedException, BadParameterException, TimeoutException, ParentDoesNotExist {
35 try {
36 super.checkExists(absolutePath);
37 } catch (AlreadyExistsException aee) {
38
39 try {
40 FileAttributes fa = this.getAttributes(absolutePath, null);
41 if (fa.getType() == FileAttributes.TYPE_FILE && fa.getSize() == 0) {
42 return;
43 } else {
44 throw aee;
45 }
46 } catch (DoesNotExistException e) {
47 throw new ParentDoesNotExist(e);
48 }
49 }
50 }
51
52
53 }