Search in sources :

Example 6 with StandardFileSystemManager

use of org.apache.commons.vfs2.impl.StandardFileSystemManager in project ant-ivy by apache.

the class VfsRepository method createVFSManager.

private StandardFileSystemManager createVFSManager() throws IOException {
    StandardFileSystemManager result = null;
    try {
        /*
             * 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 (String scheme : schemes) {
            Message.verbose("VFS Supported Scheme: " + scheme);
        }
    } 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());
        throw new IOException(e.getLocalizedMessage(), e);
    }
    return result;
}
Also used : FileSystemException(org.apache.commons.vfs2.FileSystemException) StandardFileSystemManager(org.apache.commons.vfs2.impl.StandardFileSystemManager) IOException(java.io.IOException)

Aggregations

StandardFileSystemManager (org.apache.commons.vfs2.impl.StandardFileSystemManager)6 IOException (java.io.IOException)5 FileSystemException (org.apache.commons.vfs2.FileSystemException)3 RepositoryException (javax.jcr.RepositoryException)2 Parameter (org.apache.axis2.description.Parameter)2 FileSystemManager (org.apache.commons.vfs2.FileSystemManager)2 DefaultFileSystemManager (org.apache.commons.vfs2.impl.DefaultFileSystemManager)2 Sardine (com.github.sardine.Sardine)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FTPClient (org.apache.commons.net.ftp.FTPClient)1 FileObject (org.apache.commons.vfs2.FileObject)1 DataStoreException (org.apache.jackrabbit.core.data.DataStoreException)1 FileSystemException (org.apache.jackrabbit.core.fs.FileSystemException)1 VFSParamDTO (org.apache.synapse.commons.vfs.VFSParamDTO)1