1 /**
2 This file is part of GoldenGate Project (named also GoldenGate or GG).
3
4 Copyright 2009, Frederic Bregier, and individual contributors by the @author
5 tags. See the COPYRIGHT.txt in the distribution for a full listing of
6 individual contributors.
7
8 All GoldenGate Project is free software: you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as published
10 by the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 GoldenGate is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GoldenGate . If not, see <http://www.gnu.org/licenses/>.
20 */
21 package goldengate.ftp.simpleimpl.file;
22
23 import goldengate.common.command.exception.CommandAbstractException;
24 import goldengate.ftp.core.file.FtpFile;
25 import goldengate.ftp.core.session.FtpSession;
26 import goldengate.ftp.filesystembased.FilesystemBasedFtpFile;
27
28 import java.io.File;
29
30 /**
31 * FtpFile implementation based on true directories and files
32 *
33 * @author Frederic Bregier
34 *
35 */
36 public class FileBasedFile extends FilesystemBasedFtpFile {
37 /**
38 * @param session
39 * @param fileBasedDir
40 * It is not necessary the directory that owns this file.
41 * @param path
42 * @param append
43 * @throws CommandAbstractException
44 */
45 public FileBasedFile(FtpSession session, FileBasedDir fileBasedDir,
46 String path, boolean append) throws CommandAbstractException {
47 super(session, fileBasedDir, path, append);
48 }
49
50 /**
51 * This method is a good to have in a true {@link FtpFile} implementation.
52 *
53 * @return the File associated with the current FtpFile
54 * operation
55 */
56 public File getTrueFile() {
57 try {
58 return getFileFromPath(getFile());
59 } catch (CommandAbstractException e) {
60 return null;
61 }
62 }
63 }