Example usage for org.apache.commons.vfs.impl DefaultFileSystemManager addExtensionMap

List of usage examples for org.apache.commons.vfs.impl DefaultFileSystemManager addExtensionMap

Introduction

In this page you can find the example usage for org.apache.commons.vfs.impl DefaultFileSystemManager addExtensionMap.

Prototype

public void addExtensionMap(final String extension, final String scheme) 

Source Link

Document

Adds an filename extension mapping.

Usage

From source file:com.bedatadriven.renjin.appengine.AppEngineContextFactory.java

@VisibleForTesting
static FileSystemManager createFileSystemManager(LocalFileProvider localFileProvider)
        throws FileSystemException {
    try {//from  www .  j  a va  2 s. c om
        JarFileProvider jarFileProvider = new AppEngineJarFileProvider();

        // this provides a fake local file system rooted in the servlet context root.
        // this is necessary because on the actual appengine platform, any queries to the ancestors
        // of the servlet context (e.g. /base) will throw a security exception

        DefaultFileSystemManager dfsm = new DefaultFileSystemManager();
        dfsm.addProvider("jar", jarFileProvider);
        dfsm.addProvider("file", localFileProvider);
        dfsm.addExtensionMap("jar", "jar");
        dfsm.setDefaultProvider(new UrlFileProvider());
        dfsm.setFilesCache(new NullFilesCache());
        dfsm.setCacheStrategy(CacheStrategy.ON_RESOLVE);
        dfsm.setBaseFile(new File("/"));
        dfsm.init();

        return dfsm;
    } catch (FileSystemException e) {
        LOG.log(Level.SEVERE, "Failed to initialize file system for development server", e);
        throw new RuntimeException(e);
    }
}