Example usage for org.apache.commons.vfs2 FileSystemManager getClass

List of usage examples for org.apache.commons.vfs2 FileSystemManager getClass

Introduction

In this page you can find the example usage for org.apache.commons.vfs2 FileSystemManager getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:org.apache.metron.common.utils.VFSClassloaderUtil.java

/**
 * Create a classloader backed by a virtual filesystem which can handle the following URI types:
 * * res - resource files//from  w  ww .j  av a2  s  .  c  om
 * * jar
 * * tar
 * * bz2
 * * tgz
 * * zip
 * * HDFS
 * * FTP
 * * HTTP/S
 * * file
 * @param paths A set of comma separated paths.  The paths are URIs or URIs with a regex pattern at the end.
 * @return A classloader object if it can create it
 * @throws FileSystemException
 */
public static Optional<ClassLoader> configureClassloader(String paths) throws FileSystemException {
    if (paths.trim().isEmpty()) {
        return Optional.empty();
    }
    FileSystemManager vfs = generateVfs();
    FileObject[] objects = resolve(vfs, paths);
    if (objects == null || objects.length == 0) {
        return Optional.empty();
    }
    return Optional.of(new VFSClassLoader(objects, vfs, vfs.getClass().getClassLoader()));
}