Example usage for org.apache.commons.vfs2.impl StandardFileSystemManager createFileSystem

List of usage examples for org.apache.commons.vfs2.impl StandardFileSystemManager createFileSystem

Introduction

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

Prototype

@Override
public FileObject createFileSystem(final FileObject file) throws FileSystemException 

Source Link

Document

Creates a layered file system.

Usage

From source file:com.app.server.EARDeployer.java

public static void getClassList(FileObject jarFile, CopyOnWriteArrayList classList,
        StandardFileSystemManager fsManager) throws FileSystemException {
    // log.info(jarFile);
    FileObject nestedFS = null;/*from www. j ava  2 s. c  om*/
    FileObject[] children = null;
    if (jarFile.getURL().toString().trim().endsWith(".jar")) {
        nestedFS = fsManager.createFileSystem(jarFile);
        children = nestedFS.resolveFile("/").getChildren();
    } else if (jarFile.getType() == FileType.FOLDER) {
        children = jarFile.getChildren();
    }
    // log.info();
    // log.info( "Children of " + jarFile.getName().getURI() );
    if (children == null)
        return;
    for (int i = 0; i < children.length; i++) {
        // log.info(children[i].+" "+
        // children[i].getName().getBaseName() );
        if (children[i].getType() == FileType.FILE && children[i].getName().getBaseName().endsWith(".class"))
            classList.add(children[i].toString().substring(children[i].toString().lastIndexOf('!') + 2));
        getClassList(children[i], classList, fsManager);
    }
}

From source file:com.web.server.EARDeployer.java

public static void getClassList(FileObject jarFile, CopyOnWriteArrayList classList,
        StandardFileSystemManager fsManager) throws FileSystemException {
    // System.out.println(jarFile);
    FileObject nestedFS = null;// www  .  ja  va2 s . com
    FileObject[] children = null;
    if (jarFile.getURL().toString().trim().endsWith(".jar")) {
        nestedFS = fsManager.createFileSystem(jarFile);
        children = nestedFS.resolveFile("/").getChildren();
    } else if (jarFile.getType() == FileType.FOLDER) {
        children = jarFile.getChildren();
    }
    // System.out.println();
    // System.out.println( "Children of " + jarFile.getName().getURI() );
    if (children == null)
        return;
    for (int i = 0; i < children.length; i++) {
        // System.out.println(children[i].+" "+
        // children[i].getName().getBaseName() );
        if (children[i].getType() == FileType.FILE && children[i].getName().getBaseName().endsWith(".class"))
            classList.add(children[i].toString().substring(children[i].toString().lastIndexOf('!') + 2));
        getClassList(children[i], classList, fsManager);
    }
}