| 1 | |
package org.webslinger.vfs; |
| 2 | |
|
| 3 | |
import java.io.IOException; |
| 4 | |
|
| 5 | |
import org.apache.commons.vfs.FileName; |
| 6 | |
import org.apache.commons.vfs.FileObject; |
| 7 | |
import org.apache.commons.vfs.FileSystemManager; |
| 8 | |
|
| 9 | |
public class CommonsVfsFileNameVFSDelegate extends VFSDelegateProxy { |
| 10 | |
private final FileSystemManager fsm; |
| 11 | |
|
| 12 | |
public CommonsVfsFileNameVFSDelegate(VFSDelegate delegate, FileSystemManager fsm) { |
| 13 | 0 | super(delegate, FileObject.class); |
| 14 | 0 | this.fsm = fsm; |
| 15 | 0 | } |
| 16 | |
|
| 17 | |
protected Object getReal(Object id) throws IOException { |
| 18 | 0 | return fsm.resolveFile(((FileName) id).toString()); |
| 19 | |
} |
| 20 | |
|
| 21 | |
public FileSystemManager getFileSystemManager() { |
| 22 | 0 | return fsm; |
| 23 | |
} |
| 24 | |
|
| 25 | |
public FileName getId(FileName id) { |
| 26 | 0 | return id; |
| 27 | |
} |
| 28 | |
|
| 29 | |
public String absolutePath(FileName id) { |
| 30 | 0 | return id.getPath(); |
| 31 | |
} |
| 32 | |
|
| 33 | |
public String getBaseName(FileName id) { |
| 34 | 0 | return id.getBaseName(); |
| 35 | |
} |
| 36 | |
|
| 37 | |
public FileName getParent(FileName id) { |
| 38 | 0 | return id.getParent(); |
| 39 | |
} |
| 40 | |
|
| 41 | |
public FileName resolve(FileName id, String name) throws IOException { |
| 42 | 0 | return fsm.resolveName(id, name); |
| 43 | |
} |
| 44 | |
} |