Example usage for org.apache.commons.vfs.impl StandardFileSystemManager setConfiguration

List of usage examples for org.apache.commons.vfs.impl StandardFileSystemManager setConfiguration

Introduction

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

Prototype

public void setConfiguration(final URL configUri) 

Source Link

Document

Sets the configuration file for this manager.

Usage

From source file:org.apache.ivy.plugins.repository.vfs.VfsRepository.java

private StandardFileSystemManager createVFSManager() throws IOException {
    StandardFileSystemManager result = null;
    try {//from   w  w w  .  j a va 2  s .  co m
        /*
         * The DefaultFileSystemManager gets its configuration from the jakarta-vfs-common
         * implementation which includes the res and tmp schemes which are of no use to use
         * here. Using StandardFileSystemManager lets us specify which schemes to support as
         * well as providing a mechanism to change this support without recompilation.
         */
        result = new StandardFileSystemManager() {
            protected void configurePlugins() throws FileSystemException {
                // disable automatic loading potential unsupported extensions
            }
        };
        result.setConfiguration(getClass().getResource(IVY_VFS_CONFIG));
        result.init();

        // Generate and print a list of available schemes
        Message.verbose("Available VFS schemes...");
        String[] schemes = result.getSchemes();
        Arrays.sort(schemes);
        for (int i = 0; i < schemes.length; i++) {
            Message.verbose("VFS Supported Scheme: " + schemes[i]);
        }
    } catch (FileSystemException e) {
        /*
         * If our attempt to initialize a VFS Repository fails we log the failure but continue
         * on. Given that an Ivy instance may involve numerous different repository types, it
         * seems overly cautious to throw a runtime exception on the initialization failure of
         * just one repository type.
         */
        Message.error("Unable to initialize VFS repository manager!");
        Message.error(e.getLocalizedMessage());
        IOException error = new IOException(e.getLocalizedMessage());
        error.initCause(e);
        throw error;
    }

    return result;
}