| 1 | |
package org.webslinger.modules; |
| 2 | |
|
| 3 | |
import java.util.Collection; |
| 4 | |
|
| 5 | |
import org.apache.commons.vfs.FileObject; |
| 6 | |
import org.apache.commons.vfs.FileSystemException; |
| 7 | |
import org.apache.commons.vfs.FileSystemOptions; |
| 8 | |
import org.apache.commons.vfs.provider.AbstractFileProvider; |
| 9 | |
import org.apache.commons.vfs.provider.local.DefaultLocalFileProvider; |
| 10 | |
|
| 11 | 47 | public class WebslingerModulesProvider extends AbstractFileProvider { |
| 12 | |
public Collection getCapabilities() { |
| 13 | 0 | return DefaultLocalFileProvider.capabilities; |
| 14 | |
} |
| 15 | |
|
| 16 | |
public FileObject findFile(FileObject base, String name, FileSystemOptions properties) throws FileSystemException { |
| 17 | |
try { |
| 18 | 55 | FileObject modulesBase = WebslingerModulesConfigBuilder.getInstance().getModulesBase(properties); |
| 19 | 55 | return modulesBase.resolveFile(name.substring("wsmodule://".length())); |
| 20 | 0 | } catch (Exception e) { |
| 21 | 0 | throw (FileSystemException) new FileSystemException(e.getMessage(), null, e).initCause(e); |
| 22 | |
} |
| 23 | |
} |
| 24 | |
} |