1 package fr.in2p3.jsaga.adaptor.data;
2
3 import java.io.EOFException;
4 import java.io.IOException;
5
6 import org.apache.log4j.Logger;
7 import org.globus.ftp.GridFTPClient;
8 import org.globus.ftp.exception.ServerException;
9 import org.globus.ftp.vanilla.BasicClientControlChannel;
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 public class GsiftpClient extends GridFTPClient {
25 private static Logger logger = Logger.getLogger(GsiftpClient.class);
26 public String welcomeMessage = null;
27 public GsiftpClient(String host, int port) throws IOException,
28 ServerException {
29 super(host, port);
30
31 welcomeMessage = getLastReply().getMessage();
32
33 this.session.maxWait = BasicClientControlChannel.WAIT_FOREVER;
34 }
35
36 public String getWelcome() {
37 return this.welcomeMessage;
38 }
39
40 public boolean isAppendSupported() {
41
42
43
44 if (this.getWelcome().contains("[VDT patched")) {
45 return false;
46 }
47 return true;
48 }
49
50 @Override
51 public void close() throws ServerException, IOException {
52
53 }
54
55 public void disconnect() throws ServerException, IOException {
56 try{
57 super.close();
58 } catch(EOFException e){
59
60 logger.warn("The GSIFTP connection seems already closed: " + e.getMessage());
61 } catch (ServerException se) {
62 logger.warn(se.getCustomMessage());
63 }
64 }
65 }