1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package goldengate.ftp.filesystembased;
22
23 import goldengate.common.command.exception.CommandAbstractException;
24 import goldengate.common.command.exception.Reply502Exception;
25 import goldengate.common.file.filesystembased.FilesystemBasedRestartImpl;
26 import goldengate.ftp.core.command.FtpArgumentCode.TransferMode;
27 import goldengate.ftp.core.command.FtpArgumentCode.TransferStructure;
28 import goldengate.ftp.core.command.FtpArgumentCode.TransferType;
29 import goldengate.ftp.core.data.FtpDataAsyncConn;
30 import goldengate.ftp.core.session.FtpSession;
31
32
33
34
35
36
37
38
39 public class FilesystemBasedFtpRestart extends FilesystemBasedRestartImpl {
40
41
42
43 public FilesystemBasedFtpRestart(FtpSession session) {
44 super(session);
45 }
46
47 @Override
48 public boolean restartMarker(String marker) throws CommandAbstractException {
49 FtpDataAsyncConn dataConn = ((FtpSession) getSession()).getDataConn();
50 if (dataConn.getStructure() == TransferStructure.FILE &&
51 dataConn.getMode() == TransferMode.STREAM &&
52 dataConn.getType() != TransferType.LENGTH) {
53 long newposition = 0;
54 try {
55 newposition = Long.parseLong(marker);
56 } catch (NumberFormatException e) {
57 throw new Reply502Exception(
58 "Marker must be length in byte as a position");
59 }
60 position = newposition;
61 setSet(true);
62 return true;
63 }
64 throw new Reply502Exception(
65 "Marker not implemented for such Mode, Type and Structure");
66 }
67 }