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