Java Code Examples for org.apache.commons.vfs2.impl.DefaultFileSystemManager#addProvider()

The following examples show how to use org.apache.commons.vfs2.impl.DefaultFileSystemManager#addProvider() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConnectionFileProviderTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {
  connectionManager = ConnectionManager.getInstance();
  connectionManager.setMetastoreSupplier( () -> memoryMetaStore );
  addOne();

  DefaultFileSystemManager fsm = (DefaultFileSystemManager) KettleVFS.getInstance().getFileSystemManager();
  if ( !fsm.hasProvider( ConnectionFileProvider.SCHEME ) ) {
    fsm.addProvider( ConnectionFileProvider.SCHEME, new ConnectionFileProvider() );
  }
  if ( !fsm.hasProvider( TestFileProvider.SCHEME ) ) {
    fsm.addProvider( TestFileProvider.SCHEME, new TestFileProvider() );
  }
  if ( !fsm.hasProvider( TestFileWithDomainProvider.SCHEME ) ) {
    fsm.addProvider( TestFileWithDomainProvider.SCHEME, new TestFileWithDomainProvider() );
  }
}
 
Example 2
Source File: DefaultFileSystemManagerProvider.java    From spoofax with Apache License 2.0 6 votes vote down vote up
protected void addProviders(DefaultFileSystemManager manager) throws FileSystemException {
    manager.addProvider("tmp", new TemporaryFileProvider());
    manager.addProvider("res", new ResourceFileProvider());
    manager.addProvider("ram", new RamFileProvider());
    manager.addProvider("zip", new ZipFileProvider());
    manager.addProvider("jar", new JarFileProvider());
    manager.addProvider("tar", new TarFileProvider());
    manager.addProvider("tgz", new TgzFileProvider());
    manager.addProvider("tbz2", new Tbz2FileProvider());
    manager.addProvider("gz", new GzipFileProvider());
    manager.addProvider("bz2", new Bzip2FileProvider());
    manager.addProvider("http", new HttpFileProvider());
    manager.addProvider("https", new HttpsFileProvider());
    manager.addProvider("ftp", new FtpFileProvider());
    manager.addProvider("ftps", new FtpsFileProvider());
}
 
Example 3
Source File: TgzProviderTestCase.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
/**
 * Prepares the file system manager.
 */
@Override
public void prepare(final DefaultFileSystemManager manager) throws Exception {
    // manager.addProvider("tgz", new TgzFileProvider());
    manager.addProvider("tgz", new TarFileProvider());
    manager.addProvider("tar", new TarFileProvider());
}
 
Example 4
Source File: NestedTgzTestCase.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
/**
 * Prepares the file system manager.
 */
@Override
public void prepare(final DefaultFileSystemManager manager) throws Exception {
    manager.addProvider("tgz", new TarFileProvider());
    manager.addExtensionMap("tgz", "tgz");
    manager.addProvider("tar", new TarFileProvider());
}
 
Example 5
Source File: RamProviderTestCase.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
/**
 * Prepares the file system manager.
 *
 * Imports test data from the disk.
 *
 * @throws Exception
 */
@Override
public void prepare(final DefaultFileSystemManager manager) throws Exception {
    try {
        manager.addProvider("ram", new RamFileProvider());
        manager.addProvider("file", new DefaultLocalFileProvider());
    } catch (final Exception e) {
        log.error(e);
        throw e;
    }
}
 
Example 6
Source File: LargeTarTestCase.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    manager = new DefaultFileSystemManager();

    manager.setFilesCache(new SoftRefFilesCache());
    manager.setCacheStrategy(CacheStrategy.ON_RESOLVE);

    manager.addProvider("file", new DefaultLocalFileProvider());
    manager.addProvider("tgz", new TarFileProvider());
    manager.addProvider("tar", new TarFileProvider());

    new File(baseDir).mkdir(); // if test is run standalone
    createLargeFile(largeFilePath, largeFileName);
}
 
Example 7
Source File: NestedTarTestCase.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
/**
 * Prepares the file system manager.
 */
@Override
public void prepare(final DefaultFileSystemManager manager) throws Exception {
    manager.addProvider("tar", new TarFileProvider());
    manager.addExtensionMap("tar", "tar");
    manager.addMimeTypeMap("application/x-tar", "tar");
}
 
Example 8
Source File: NestedTbz2TestCase.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
/**
 * Prepares the file system manager.
 */
@Override
public void prepare(final DefaultFileSystemManager manager) throws Exception {
    manager.addProvider("tbz2", new TarFileProvider());
    manager.addExtensionMap("tbz2", "tbz2");
    manager.addProvider("tar", new TarFileProvider());
}
 
Example 9
Source File: NestedZipTestCase.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
/**
 * Prepares the file system manager.
 */
@Override
public void prepare(final DefaultFileSystemManager manager) throws Exception {
    manager.addProvider("zip", new ZipFileProvider());
    manager.addExtensionMap("zip", "zip");
    manager.addMimeTypeMap("application/zip", "zip");
}
 
Example 10
Source File: ZipProviderTestCase.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
/**
 * Prepares the file system manager.
 */
@Override
public void prepare(final DefaultFileSystemManager manager) throws Exception {
    manager.addProvider("zip", new ZipFileProvider());
    manager.addExtensionMap("zip", "zip");
    manager.addMimeTypeMap("application/zip", "zip");
}
 
Example 11
Source File: ZipProviderWithCharsetNullTestCase.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
/**
 * Prepares the file system manager.
 */
@Override
public void prepare(final DefaultFileSystemManager manager) throws Exception {
    manager.addProvider("zip", new ZipFileProvider());
    manager.addExtensionMap("zip", "zip");
    manager.addMimeTypeMap("application/zip", "zip");
}
 
Example 12
Source File: ResourceProviderTestCase.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
/**
 * Prepares the file system manager. This implementation does nothing.
 */
@Override
public void prepare(final DefaultFileSystemManager manager) throws Exception {
    manager.addProvider("res", new ResourceFileProvider());
    manager.addProvider("file", new UrlFileProvider());
    manager.addProvider("jar", new JarFileProvider());
}
 
Example 13
Source File: BasicOperationsTestCase.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
/**
 * JUnit Fixture: Prepare a simple FSM.
 *
 * @throws FileSystemException for runtime problems
 */
@Before
public void setUp() throws FileSystemException {
    manager = new DefaultFileSystemManager();
    final FileProvider fp = new DefaultLocalFileProvider();
    manager.addProvider("file", fp);
    manager.init();
}
 
Example 14
Source File: NestedJarTestCase.java    From commons-vfs with Apache License 2.0 4 votes vote down vote up
/**
 * Prepares the file system manager.
 */
@Override
public void prepare(final DefaultFileSystemManager manager) throws Exception {
    manager.addProvider("jar", new JarFileProvider());
    manager.addExtensionMap("jar", "jar");
}
 
Example 15
Source File: FtpProviderTestCase.java    From commons-vfs with Apache License 2.0 4 votes vote down vote up
/**
 * Prepares the file system manager.
 */
@Override
public void prepare(final DefaultFileSystemManager manager) throws Exception {
    manager.addProvider("ftp", new FtpFileProvider());
}
 
Example 16
Source File: Vfs444TestCase.java    From commons-vfs with Apache License 2.0 4 votes vote down vote up
/**
 * Prepares the file system manager. This implementation does nothing.
 */
@Override
public void prepare(final DefaultFileSystemManager manager) throws Exception {
    manager.addProvider("res", new ResourceFileProvider());
    manager.addProvider("zip", new ZipFileProvider());
}
 
Example 17
Source File: UrlProviderTestCase.java    From commons-vfs with Apache License 2.0 4 votes vote down vote up
/**
 * Prepares the file system manager. This implementation does nothing.
 */
@Override
public void prepare(final DefaultFileSystemManager manager) throws Exception {
    manager.addProvider("file", new UrlFileProvider());
}
 
Example 18
Source File: WebdavProviderTestCase.java    From commons-vfs with Apache License 2.0 4 votes vote down vote up
/**
 * Prepares the file system manager.
 */
@Override
public void prepare(final DefaultFileSystemManager manager) throws Exception {
    manager.addProvider("webdav", new WebdavFileProvider());
    manager.addProvider("tmp", new TemporaryFileProvider());
}
 
Example 19
Source File: UrlProviderHttpTestCase.java    From commons-vfs with Apache License 2.0 4 votes vote down vote up
/**
 * Prepares the file system manager.
 */
@Override
public void prepare(final DefaultFileSystemManager manager) throws Exception {
    manager.addProvider("http", new UrlFileProvider());
}
 
Example 20
Source File: Tbz2ProviderTestCase.java    From commons-vfs with Apache License 2.0 4 votes vote down vote up
/**
 * Prepares the file system manager.
 */
@Override
public void prepare(final DefaultFileSystemManager manager) throws Exception {
    manager.addProvider("tbz2", new TarFileProvider());
    manager.addProvider("tar", new TarFileProvider());
}