Example usage for org.apache.commons.vfs2 FileType FILE

List of usage examples for org.apache.commons.vfs2 FileType FILE

Introduction

In this page you can find the example usage for org.apache.commons.vfs2 FileType FILE.

Prototype

FileType FILE

To view the source code for org.apache.commons.vfs2 FileType FILE.

Click Source Link

Document

A regular file.

Usage

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

public void obtainUrls(FileObject rootEar, FileObject ear, CopyOnWriteArrayList<FileObject> fileObjects,
        ConcurrentHashMap jarclassListMap, CopyOnWriteArrayList<FileObject> warObjects,
        StandardFileSystemManager fsManager) throws IOException {
    FileObject[] childrenJars = ear.getChildren();
    for (int childcount = 0; childcount < childrenJars.length; childcount++) {
        if (childrenJars[childcount].getType() == FileType.FOLDER) {
            obtainUrls(rootEar, childrenJars[childcount], fileObjects, jarclassListMap, warObjects, fsManager);
        }/*from www.  j av a  2  s  . co  m*/
        // System.out.println(childrenJars[childcount]);
        // System.out.println(childrenJars[childcount].getName().getBaseName());
        // System.out.println(ear.getURL());
        if (childrenJars[childcount].getType() == FileType.FILE
                && (childrenJars[childcount].getName().getBaseName().endsWith(".jar")
                        || childrenJars[childcount].getName().getBaseName().endsWith(".war"))) {
            // System.out.println(childrenJars[childcount].getURL());
            if (childrenJars[childcount].getName().getBaseName().endsWith(".war")) {
                File file = new File(scanDirectory + "/" + childrenJars[childcount].getName().getBaseName());
                if (!file.exists() || (file.exists() && file.lastModified() != childrenJars[childcount]
                        .getContent().getLastModifiedTime())) {
                    InputStream fistr = childrenJars[childcount].getContent().getInputStream();
                    byte[] filyByt = new byte[4096];
                    FileOutputStream warFile = new FileOutputStream(
                            scanDirectory + "/" + childrenJars[childcount].getName().getBaseName());
                    int len = 0;
                    while ((len = fistr.read(filyByt)) != -1) {
                        warFile.write(filyByt, 0, len);
                    }
                    warFile.close();
                    fistr.close();
                    warObjects.add(childrenJars[childcount]);
                }
            }
            // System.out.println(childrenJars[childcount].getURL().toString()+" "+rootEar.getURL());
            else if (!childrenJars[childcount].getURL().toString().trim()
                    .startsWith(rootEar.getURL().toString() + "lib/")) {
                CopyOnWriteArrayList<String> classList = new CopyOnWriteArrayList<String>();
                getClassList(childrenJars[childcount], classList, fsManager);
                jarclassListMap.put(childrenJars[childcount], classList);
            } else {
                System.out.println("ear libs/" + childrenJars[childcount]);
                fileObjects.add(childrenJars[childcount]);
            }
        } else {
            childrenJars[childcount].close();
        }
    }
}

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;/*from   www  .j a v  a 2  s . c  o  m*/
    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);
    }
}

From source file:de.innovationgate.wgpublisher.design.fs.FileSystemDesignProvider.java

private static boolean performChange(ChangedDocument changedDocument,
        FileSystemDesignProvider originalDesignProvider, OverlayStatus status, String targetEncoding,
        FileObject baseFolder, Logger log, DesignFileValidator validator) throws FileSystemException,
        NoSuchAlgorithmException, UnsupportedEncodingException, IOException, WGDesignSyncException {

    boolean conflictFileCreated = false;
    log.info("Updating overlay resource " + changedDocument.getDocumentKey());

    // Find files which represent the document in source and target
    FileObject sourceDocFile = originalDesignProvider.getBaseFolder()
            .resolveFile(changedDocument.getSourceFilePath());
    FileObject targetDocFile = baseFolder.resolveFile(changedDocument.getTargetFilePath());

    // Collect files to copy and delete
    Map<FileObject, FileObject> filesToCopy = new HashMap<FileObject, FileObject>();
    List<FileObject> filesToDelete = new ArrayList<FileObject>();

    // Collect for file containers: Must traverse container content
    if (changedDocument.getDocumentKey().getDocType() == WGDocument.TYPE_FILECONTAINER) {

        if (changedDocument.getChangeType() == ChangeType.NEW) {
            targetDocFile.createFolder();
        }// w  ww.j  a  va2 s.c o  m

        // Copy all files in container from the source to the target 
        for (FileObject sourceFile : sourceDocFile.getChildren()) {
            if (sourceFile.getType().equals(FileType.FILE)) {
                if (!isValidDesignFile(sourceFile, validator)) {
                    continue;
                }
                filesToCopy.put(sourceFile, targetDocFile.resolveFile(sourceFile.getName().getBaseName()));
            }
        }

        // Delete all files in target that were deployed with previous base version but are deleted in current base version 
        for (FileObject targetFile : targetDocFile.getChildren()) {
            if (targetFile.getType().equals(FileType.FILE)) {
                if (!isValidDesignFile(targetFile, validator)) {
                    continue;
                }

                FileObject sourceFile = sourceDocFile.resolveFile(targetFile.getName().getBaseName());
                if (sourceFile.exists()) {
                    continue;
                }

                // Only delete those that were deployed with previous base version and have unaltered content
                String resourcePath = baseFolder.getName().getRelativeName(targetFile.getName());
                ResourceData resourceData = status.getOverlayData().getOverlayResources().get(resourcePath);
                if (resourceData != null) {
                    String hash = MD5HashingInputStream.getStreamHash(targetFile.getContent().getInputStream());
                    if (resourceData.getMd5Hash().equals(hash)) {
                        filesToDelete.add(targetFile);
                    }
                }
            }
        }

    }

    // Collect for anything else
    else {
        filesToCopy.put(sourceDocFile, targetDocFile);
    }

    // Copy files
    for (Map.Entry<FileObject, FileObject> files : filesToCopy.entrySet()) {

        FileObject sourceFile = files.getKey();
        FileObject targetFile = files.getValue();
        String resourcePath = baseFolder.getName().getRelativeName(targetFile.getName());

        if (changedDocument.getChangeType() == ChangeType.CONFLICT) {
            // Do a test if the current file is conflicting. If so we write to a conflict file instead
            InputStream in = new BufferedInputStream(sourceFile.getContent().getInputStream());
            String currentHash = MD5HashingInputStream.getStreamHash(in);
            ResourceData deployedHash = status.getOverlayData().getOverlayResources().get(resourcePath);
            boolean skipConflict = false;

            // Conflict on file container: A single file might just be missing in the target. We can safely copy that to the target without treating as conflict (#00002440)
            if (deployedHash == null
                    && changedDocument.getDocumentKey().getDocType() == WGDocument.TYPE_FILECONTAINER
                    && !targetFile.exists()) {
                skipConflict = true;
            }

            if (!skipConflict && (deployedHash == null || !deployedHash.getMd5Hash().equals(currentHash))) {
                targetFile = createConflictFile(targetFile);
                conflictFileCreated = true;
                log.warn("Modified overlay resource " + resourcePath
                        + " is updated in base design. We write the updated base version to conflict file for manual resolution: "
                        + baseFolder.getName().getRelativeName(targetFile.getName()));
            }
        }

        // Write file
        InputStream in = new BufferedInputStream(sourceFile.getContent().getInputStream());
        MD5HashingOutputStream out = new MD5HashingOutputStream(
                new BufferedOutputStream(targetFile.getContent().getOutputStream(false)));

        // Update resource data
        resourceInToOut(in, originalDesignProvider.getFileEncoding(), out, targetEncoding);
        OverlayData.ResourceData resourceData = new OverlayData.ResourceData();
        resourceData.setMd5Hash(out.getHash());
        status.getOverlayData().setOverlayResource(resourcePath, resourceData);

    }

    // Delete files
    for (FileObject fileToDelete : filesToDelete) {
        String resourcePath = baseFolder.getName().getRelativeName(fileToDelete.getName());
        fileToDelete.delete();
        status.getOverlayData().removeOverlayResource(resourcePath);
    }

    return conflictFileCreated;

}

From source file:de.innovationgate.wgpublisher.design.fs.FileSystemDesignProvider.java

private static void determineChangedResources(int resourceType, FileObject categoryFolder, FileObject source,
        FileObject target, FileObject baseFolder, String sourceEncoding, String targetEncoding,
        OverlayStatus status, Logger log, DesignFileValidator validator)
        throws WGDesignSyncException, NoSuchAlgorithmException, IOException {

    for (FileObject sourceFile : source.getChildren()) {
        if (!isValidDesignFile(sourceFile, validator)) {
            continue;
        }/* www  .j  av  a  2s.c o m*/

        FileObject targetFile = target.resolveFile(sourceFile.getName().getBaseName());
        String resourcePath = baseFolder.getName().getRelativeName(targetFile.getName());

        if (sourceFile.getType().equals(FileType.FOLDER)) {
            if (!targetFile.exists()) {
                status.getNewFolders().add(targetFile.getName().getPath());
            } else if (targetFile.getType().equals(FileType.FILE)) {
                throw new WGDesignSyncException("Unable to apply overlay. Folder '"
                        + baseFolder.getName().getRelativeName(targetFile.getName())
                        + " already exists as file. Delete it to enable overlay management again");
            }
            determineChangedResources(resourceType, categoryFolder, sourceFile, targetFile, baseFolder,
                    sourceEncoding, targetEncoding, status, log, validator);
        } else if (sourceFile.getType().equals(FileType.FILE)) {

            // File does not exist.
            if (!targetFile.exists()) {

                // Was it once deployed?
                ResourceData originalHash = status.getOverlayData().getOverlayResources().get(resourcePath);
                if (originalHash == null) { // No, so it must be new in base
                    status.addChangedResource(resourceType, sourceFile, targetFile, categoryFolder,
                            OverlayStatus.ChangeType.NEW, resourcePath, null);
                } else { // Yes, Check if the base file changed since deployment
                    String newHash = MD5HashingInputStream
                            .getStreamHash(sourceFile.getContent().getInputStream());
                    if (newHash.equals(originalHash.getMd5Hash())) { // Nope. So this is no change. The overlay just chose not to use the file
                        continue;
                    } else { // Yes, so it is indeed a conflict
                        status.addChangedResource(resourceType, sourceFile, targetFile, categoryFolder,
                                OverlayStatus.ChangeType.CONFLICT, resourcePath, null);
                    }
                }

            }

            // File does exist: Determine if is updated in base since the overlay file was deployed
            else {

                ResourceData originalHash = status.getOverlayData().getOverlayResources().get(resourcePath);
                if (originalHash == null) {
                    if (!status.isUpdatedBaseDesign()) {
                        log.info("There is no information about the original deployment state of  resource "
                                + resourcePath
                                + ". Setting original deployment state now to the current base version.");
                        OverlayData.ResourceData resource = new OverlayData.ResourceData();
                        resource.setMd5Hash(
                                MD5HashingInputStream.getStreamHash(sourceFile.getContent().getInputStream()));
                        status.getOverlayData().setOverlayResource(resourcePath, resource);
                    } else {
                        log.info("Cannot update overlay resource " + resourcePath
                                + " as there is no information of its original deployment state.");
                    }
                    continue;
                }

                // First determine if the resource really changed from what was distributed
                String newHash = MD5HashingInputStream.getStreamHash(sourceFile.getContent().getInputStream());
                if (newHash.equals(originalHash.getMd5Hash())) {
                    continue;
                }

                // Determine if the target file is the same as was distributed. If not then it was user modified, so it is a conflict
                String currentHash = MD5HashingInputStream
                        .getStreamHash(targetFile.getContent().getInputStream());
                if (!currentHash.equals(originalHash.getMd5Hash())) {
                    status.addChangedResource(resourceType, sourceFile, targetFile, categoryFolder,
                            OverlayStatus.ChangeType.CONFLICT, resourcePath, null);
                }

                // It is a normal change
                else {
                    status.addChangedResource(resourceType, sourceFile, targetFile, categoryFolder,
                            OverlayStatus.ChangeType.CHANGED, resourcePath, null);
                }
            }
        }
    }

}

From source file:de.innovationgate.wgpublisher.design.fs.FileSystemDesignProvider.java

private static void determineChangedFileContainerResources(FileObject categoryFolder, FileObject source,
        FileObject target, FileObject baseFolder, String sourceEncoding, String targetEncoding,
        OverlayStatus status, Logger log, DesignFileValidator validator)
        throws WGDesignSyncException, NoSuchAlgorithmException, IOException {

    String targetResourcePath = baseFolder.getName().getRelativeName(target.getName());
    Set<String> involvedFiles = new HashSet<String>();

    // Completely new folder is a new file container
    if (!target.exists()) {

        status.addChangedResource(WGDocument.TYPE_FILECONTAINER, source, target, categoryFolder, ChangeType.NEW,
                targetResourcePath, null);
        // Als add all subfolders
        for (FileObject sourceFile : source.getChildren()) {
            if (sourceFile.getType().equals(FileType.FOLDER)) {
                FileObject targetFile = target.resolveFile(sourceFile.getName().getBaseName());
                determineChangedFileContainerResources(categoryFolder, sourceFile, targetFile, baseFolder,
                        sourceEncoding, targetEncoding, status, log, validator);
            }/*ww w  . ja  v a2  s  .  com*/
        }
        return;
    }

    if (target.getType().equals(FileType.FILE)) {
        throw new WGDesignSyncException(
                "Unable to apply overlay. Folder '" + baseFolder.getName().getRelativeName(target.getName())
                        + " already exists as file. Delete it to enable overlay management again");
    }

    // Determine change type by iterating through source child files and compare with target
    boolean overlayChanged = false;
    boolean baseChanged = false;
    boolean directConflict = false;

    for (FileObject sourceFile : source.getChildren()) {
        if (!isValidDesignFile(sourceFile, validator)) {
            continue;
        }

        FileObject targetFile = target.resolveFile(sourceFile.getName().getBaseName());
        String fileResourcePath = baseFolder.getName().getRelativeName(targetFile.getName());

        if (sourceFile.getType().equals(FileType.FOLDER)) {
            // Descend onto subcontainer
            determineChangedFileContainerResources(categoryFolder, sourceFile, targetFile, baseFolder,
                    sourceEncoding, targetEncoding, status, log, validator);
        } else if (sourceFile.getType().equals(FileType.FILE)) {

            // File does not exist. Look if it was once deployed.
            if (!targetFile.exists()) {

                ResourceData resourceData = status.getOverlayData().getOverlayResources().get(fileResourcePath);
                if (resourceData != null) {
                    // Did already exist. But did it have the same content?
                    String newHash = MD5HashingInputStream
                            .getStreamHash(sourceFile.getContent().getInputStream());
                    if (newHash.equals(resourceData.getMd5Hash())) {
                        overlayChanged = true;
                        involvedFiles.add(sourceFile.getName().getBaseName() + " (removed in overlay)");
                    } else {
                        baseChanged = true;
                        overlayChanged = true;
                        directConflict = true;
                        involvedFiles.add(
                                sourceFile.getName().getBaseName() + " (removed in overlay, changed in base)");
                    }

                }

                // Did not yet exist. It is a new file in the base version.
                else {
                    baseChanged = true;
                    involvedFiles.add(sourceFile.getName().getBaseName() + " (new in base)");
                }

            }

            // File does exist: Determine if is updated in base since the overlay file was deployed
            else {

                ResourceData originalHash = status.getOverlayData().getOverlayResources().get(fileResourcePath);
                if (originalHash == null) {
                    log.warn("There is no information about the original deployment state of resource '"
                            + fileResourcePath + "' so its change status cannot be determined.");
                    OverlayData.ResourceData resource = new OverlayData.ResourceData();
                    resource.setMd5Hash(
                            MD5HashingInputStream.getStreamHash(sourceFile.getContent().getInputStream()));
                    status.getOverlayData().setOverlayResource(fileResourcePath, resource);
                    continue;
                }

                // First determine if the resource really changed from what was distributed
                String newHash = MD5HashingInputStream.getStreamHash(sourceFile.getContent().getInputStream());
                if (newHash.equals(originalHash.getMd5Hash())) {
                    continue;
                }

                // Determine if the target file is the same as was distributed. If not then it was user modified, so it is a conflict
                String currentHash = MD5HashingInputStream
                        .getStreamHash(targetFile.getContent().getInputStream());
                if (!currentHash.equals(originalHash.getMd5Hash())) {
                    overlayChanged = true;
                    baseChanged = true;
                    directConflict = true;
                    involvedFiles.add(sourceFile.getName().getBaseName() + " (changed in base and overlay)");
                    break;
                }

                // It is a normal change
                else {
                    baseChanged = true;
                    involvedFiles.add(sourceFile.getName().getBaseName() + " (changed in base)");
                }
            }
        }
    }

    // Test the target files. Files may have been added there, or files from the previous base version may still be present that got deleted in the new base version.
    if (!baseChanged || !overlayChanged) {
        for (FileObject targetFile : target.getChildren()) {
            FileObject sourceFile = source.resolveFile(targetFile.getName().getBaseName());
            if (!sourceFile.exists()) {

                // Look if it was deployed with the previous base version.
                String fileResourcePath = baseFolder.getName().getRelativeName(targetFile.getName());
                ResourceData resourceData = status.getOverlayData().getOverlayResources().get(fileResourcePath);
                if (resourceData != null) {
                    // Was deployed. But with same contents?
                    String targetHash = MD5HashingInputStream
                            .getStreamHash(targetFile.getContent().getInputStream());
                    if (targetHash.equals(resourceData.getMd5Hash())) {
                        // This is a file that was from previous base version and got removed in the new base version.
                        involvedFiles.add(targetFile.getName().getBaseName() + " (removed from base)");
                        baseChanged = true;
                    }

                    // File got removed in new base version, updated in overlay. Conflict.
                    else {
                        baseChanged = true;
                        overlayChanged = true;
                        directConflict = true;
                        involvedFiles.add(targetFile.getName().getBaseName()
                                + " (removed from base, changed in overlay)");
                        break;
                    }
                } else {
                    involvedFiles.add(targetFile.getName().getBaseName() + " (new in overlay)");
                    overlayChanged = true;
                }
            }
        }
    }

    // Determine change type based on the found changes
    ChangeType changeType = null;
    if (baseChanged) {
        if (overlayChanged) {
            changeType = ChangeType.CONFLICT;
        } else {
            changeType = ChangeType.CHANGED;
        }
    }

    if (changeType != null) {
        status.addChangedResource(WGDocument.TYPE_FILECONTAINER, source, target, categoryFolder, changeType,
                targetResourcePath, involvedFiles);
    }

}

From source file:org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader.java

static FileObject[] resolve(FileSystemManager vfs, String uris, ArrayList<FileObject> pathsToMonitor)
        throws FileSystemException {
    if (uris == null)
        return new FileObject[0];

    ArrayList<FileObject> classpath = new ArrayList<FileObject>();

    pathsToMonitor.clear();/* ww w . ja  v a 2  s  . c o  m*/

    for (String path : uris.split(",")) {

        path = path.trim();

        if (path.equals(""))
            continue;

        path = AccumuloClassLoader.replaceEnvVars(path, System.getenv());

        FileObject fo = vfs.resolveFile(path);

        switch (fo.getType()) {
        case FILE:
        case FOLDER:
            classpath.add(fo);
            pathsToMonitor.add(fo);
            break;
        case IMAGINARY:
            // assume its a pattern
            String pattern = fo.getName().getBaseName();
            if (fo.getParent() != null && fo.getParent().getType() == FileType.FOLDER) {
                pathsToMonitor.add(fo.getParent());
                FileObject[] children = fo.getParent().getChildren();
                for (FileObject child : children) {
                    if (child.getType() == FileType.FILE && child.getName().getBaseName().matches(pattern)) {
                        classpath.add(child);
                    }
                }
            } else {
                log.warn("ignoring classpath entry " + fo);
            }
            break;
        default:
            log.warn("ignoring classpath entry " + fo);
            break;
        }

    }

    return classpath.toArray(new FileObject[classpath.size()]);
}

From source file:org.apache.accumulo.start.classloader.vfs.providers.HdfsFileObject.java

@Override
protected FileType doGetType() throws Exception {
    try {//from  w  w w.  j av a2 s .c om
        doAttach();
        if (null == stat) {
            return FileType.IMAGINARY;
        }
        if (stat.isDirectory()) {
            return FileType.FOLDER;
        } else {
            return FileType.FILE;
        }
    } catch (final FileNotFoundException fnfe) {
        return FileType.IMAGINARY;
    }
}

From source file:org.apache.accumulo.start.classloader.vfs.providers.ReadOnlyHdfsFileProviderTest.java

private FileObject createTestFile(FileSystem hdfs) throws IOException {
    // Create the directory
    hdfs.mkdirs(DIR1_PATH);/*from   ww w  . j  a v a  2 s  .  c  o m*/
    FileObject dir = manager.resolveFile(TEST_DIR1);
    Assert.assertNotNull(dir);
    Assert.assertTrue(dir.exists());
    Assert.assertTrue(dir.getType().equals(FileType.FOLDER));

    // Create the file in the directory
    hdfs.create(FILE1_PATH).close();
    FileObject f = manager.resolveFile(TEST_FILE1);
    Assert.assertNotNull(f);
    Assert.assertTrue(f.exists());
    Assert.assertTrue(f.getType().equals(FileType.FILE));
    return f;
}

From source file:org.apache.commons.vfs2.example.ShowProperties.java

public static void main(final String[] args) {
    if (args.length == 0) {
        System.err.println("Please pass the name of a file as parameter.");
        System.err.println("e.g. java org.apache.commons.vfs2.example.ShowProperties LICENSE.txt");
        return;//from   w w w  .  j  a v  a 2 s.co  m
    }
    for (final String arg : args) {
        try {
            final FileSystemManager mgr = VFS.getManager();
            System.out.println();
            System.out.println("Parsing: " + arg);
            final FileObject file = mgr.resolveFile(arg);
            System.out.println("URL: " + file.getURL());
            System.out.println("getName(): " + file.getName());
            System.out.println("BaseName: " + file.getName().getBaseName());
            System.out.println("Extension: " + file.getName().getExtension());
            System.out.println("Path: " + file.getName().getPath());
            System.out.println("Scheme: " + file.getName().getScheme());
            System.out.println("URI: " + file.getName().getURI());
            System.out.println("Root URI: " + file.getName().getRootURI());
            System.out.println("Parent: " + file.getName().getParent());
            System.out.println("Type: " + file.getType());
            System.out.println("Exists: " + file.exists());
            System.out.println("Readable: " + file.isReadable());
            System.out.println("Writeable: " + file.isWriteable());
            System.out.println("Root path: " + file.getFileSystem().getRoot().getName().getPath());
            if (file.exists()) {
                if (file.getType().equals(FileType.FILE)) {
                    System.out.println("Size: " + file.getContent().getSize() + " bytes");
                } else if (file.getType().equals(FileType.FOLDER) && file.isReadable()) {
                    final FileObject[] children = file.getChildren();
                    System.out.println("Directory with " + children.length + " files");
                    for (int iterChildren = 0; iterChildren < children.length; iterChildren++) {
                        System.out.println("#" + iterChildren + ": " + children[iterChildren].getName());
                        if (iterChildren > SHOW_MAX) {
                            break;
                        }
                    }
                }
                System.out.println("Last modified: "
                        + DateFormat.getInstance().format(new Date(file.getContent().getLastModifiedTime())));
            } else {
                System.out.println("The file does not exist");
            }
            file.close();
        } catch (final FileSystemException ex) {
            ex.printStackTrace();
        }
    }
}

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

/**
 * Resolve a set of URIs into FileObject objects.
 * This is not recursive. The URIs can refer directly to a file or directory or an optional regex at the end.
 * (NOTE: This is NOT a glob)./*from   ww w  .j a  v a2s .  c  om*/
 * @param vfs The file system manager to use to resolve URIs
 * @param uris comma separated URIs and URI + globs
 * @return
 * @throws FileSystemException
 */
static FileObject[] resolve(FileSystemManager vfs, String uris) throws FileSystemException {
    if (uris == null) {
        return new FileObject[0];
    }

    ArrayList<FileObject> classpath = new ArrayList<>();
    for (String path : uris.split(",")) {
        path = path.trim();
        if (path.equals("")) {
            continue;
        }
        FileObject fo = vfs.resolveFile(path);
        switch (fo.getType()) {
        case FILE:
        case FOLDER:
            classpath.add(fo);
            break;
        case IMAGINARY:
            // assume its a pattern
            String pattern = fo.getName().getBaseName();
            if (fo.getParent() != null && fo.getParent().getType() == FileType.FOLDER) {
                FileObject[] children = fo.getParent().getChildren();
                for (FileObject child : children) {
                    if (child.getType() == FileType.FILE && child.getName().getBaseName().matches(pattern)) {
                        classpath.add(child);
                    }
                }
            } else {
                LOG.warn("ignoring classpath entry " + fo);
            }
            break;
        default:
            LOG.warn("ignoring classpath entry " + fo);
            break;
        }
    }
    return classpath.toArray(new FileObject[classpath.size()]);
}