1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package goldengate.ftp.core.data;
22
23 import goldengate.common.command.exception.CommandAbstractException;
24 import goldengate.ftp.core.command.FtpCommandCode;
25 import goldengate.ftp.core.exception.FtpNoFileException;
26 import goldengate.ftp.core.file.FtpFile;
27
28 import java.util.List;
29
30
31
32
33
34
35
36 public class FtpTransfer {
37
38
39
40 private final FtpCommandCode command;
41
42
43
44
45 private final List<String> info;
46
47
48
49
50 private String path = null;
51
52
53
54
55 private final FtpFile currentFile;
56
57
58
59
60 private boolean status = false;
61
62
63
64
65
66
67 public FtpTransfer(FtpCommandCode command, List<String> fileOrInfo,
68 String path) {
69 this.command = command;
70 info = fileOrInfo;
71 this.path = path;
72 currentFile = null;
73 }
74
75
76
77
78
79 public FtpTransfer(FtpCommandCode command, FtpFile file) {
80 this.command = command;
81 currentFile = file;
82 try {
83 path = file.getFile();
84 } catch (CommandAbstractException e) {
85 }
86 info = null;
87 }
88
89
90
91
92 public FtpCommandCode getCommand() {
93 return command;
94 }
95
96
97
98
99
100 public FtpFile getFtpFile() throws FtpNoFileException {
101 if (currentFile == null) {
102 throw new FtpNoFileException("No file associated with the transfer");
103 }
104 return currentFile;
105 }
106
107
108
109
110 public List<String> getInfo() {
111 return info;
112 }
113
114
115
116
117 public String getPath() {
118 return path;
119 }
120
121
122
123
124 public boolean getStatus() {
125 return status;
126 }
127
128
129
130
131 public void setStatus(boolean status) {
132 this.status = status;
133 }
134
135
136
137
138 @Override
139 public String toString() {
140 return command.name() + " " + path;
141 }
142 }