1 /** 2 * Copyright 2009, Frederic Bregier, and individual contributors by the @author 3 * tags. See the COPYRIGHT.txt in the distribution for a full listing of 4 * individual contributors. 5 * 6 * This is free software; you can redistribute it and/or modify it under the 7 * terms of the GNU Lesser General Public License as published by the Free 8 * Software Foundation; either version 3.0 of the License, or (at your option) 9 * any later version. 10 * 11 * This software is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 14 * details. 15 * 16 * You should have received a copy of the GNU Lesser General Public License 17 * along with this software; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF 19 * site: http://www.fsf.org. 20 */ 21 package goldengate.ftp.exec.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 }