| 1 | |
package org.webslinger.commons.vfs; |
| 2 | |
|
| 3 | |
import org.apache.commons.vfs.FileName; |
| 4 | |
import org.apache.commons.vfs.FileObject; |
| 5 | |
import org.apache.commons.vfs.FileSystem; |
| 6 | |
import org.apache.commons.vfs.FileSystemException; |
| 7 | |
|
| 8 | |
public abstract class FilteringFileObject<N extends FileName, F extends FilteringFileObject<N, F, S>, S extends FilteringFileSystem<N, F, S>> extends LayeredFileObject<N, F, S> { |
| 9 | |
private final S lfs; |
| 10 | |
private final FileObject realFile; |
| 11 | |
|
| 12 | |
public FilteringFileObject(N name, S lfs, FileObject realFile) throws FileSystemException { |
| 13 | 7125 | super(name, lfs); |
| 14 | 7125 | this.lfs = lfs; |
| 15 | 7125 | this.realFile = realFile; |
| 16 | 7125 | } |
| 17 | |
|
| 18 | |
protected FileObject getFile(boolean create) throws FileSystemException { |
| 19 | 15059 | return getRealFile(); |
| 20 | |
} |
| 21 | |
|
| 22 | |
public FileObject getRealFile() throws FileSystemException { |
| 23 | 26105 | return realFile; |
| 24 | |
} |
| 25 | |
|
| 26 | |
protected void doDelete() throws FileSystemException { |
| 27 | 6 | getRealFile().delete(); |
| 28 | 6 | super.doDelete(); |
| 29 | 6 | } |
| 30 | |
|
| 31 | |
public void close() throws FileSystemException { |
| 32 | 328 | super.close(); |
| 33 | 328 | getRealFile().close(); |
| 34 | 328 | } |
| 35 | |
|
| 36 | |
public void refresh() throws FileSystemException { |
| 37 | 6440 | super.refresh(); |
| 38 | 6440 | getRealFile().refresh(); |
| 39 | 6440 | children.set(null); |
| 40 | 6440 | } |
| 41 | |
} |