Java Code Examples for org.apache.commons.vfs2.FileSystemManager#createFileSystem()
The following examples show how to use
org.apache.commons.vfs2.FileSystemManager#createFileSystem() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VFSClassLoader.java From commons-vfs with Apache License 2.0 | 6 votes |
/** * Appends the specified FileObjects to the list of FileObjects to search for classes and resources. * * @param manager The FileSystemManager. * @param files the FileObjects to append to the search path. * @throws FileSystemException if an error occurs. */ private void addFileObjects(final FileSystemManager manager, final FileObject[] files) throws FileSystemException { for (FileObject file : files) { if (!FileObjectUtils.exists(file)) { // Does not exist - skip continue; } // TODO - use federation instead if (manager.canCreateFileSystem(file)) { // Use contents of the file file = manager.createFileSystem(file); } resources.add(file); } }
Example 2
Source File: NestedTarTestCase.java From commons-vfs with Apache License 2.0 | 6 votes |
/** * Returns the base folder for tests. */ @Override public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { // We test with non-empty FS options to make sure they are propagated final FileSystemOptions opts = new FileSystemOptions(); DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, new StaticUserAuthenticator("domain", null, null)); // Locate the base Tar file final String tarFilePath = AbstractVfsTestCase.getTestResource("nested.tar").getAbsolutePath(); // Now build the nested file system final String uri = "tar:file:" + tarFilePath + "!/test.tar"; final FileObject tarFile = manager.resolveFile(uri, opts); final FileObject nestedFS = manager.createFileSystem(tarFile); return nestedFS.resolveFile("/"); }
Example 3
Source File: NestedZipTestCase.java From commons-vfs with Apache License 2.0 | 5 votes |
/** * Returns the base folder for tests. */ @Override public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { // Locate the base Zip file final String zipFilePath = AbstractVfsTestCase.getTestResource("nested.zip").getAbsolutePath(); final String uri = "zip:file:" + zipFilePath + "!/test.zip"; final FileObject zipFile = manager.resolveFile(uri); // Now build the nested file system final FileObject nestedFS = manager.createFileSystem(zipFile); return nestedFS.resolveFile("/"); }
Example 4
Source File: NestedJarTestCase.java From commons-vfs with Apache License 2.0 | 5 votes |
/** * Returns the base folder for tests. */ @Override public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { // Locate the Jar file final File outerFile = AbstractVfsTestCase.getTestResource("nested.jar"); final String uri = "jar:file:" + outerFile.getAbsolutePath() + "!/test.jar"; final FileObject jarFile = manager.resolveFile(uri); // Now build the nested file system final FileObject nestedFS = manager.createFileSystem(jarFile); return nestedFS.resolveFile("/"); }
Example 5
Source File: NestedTgzTestCase.java From commons-vfs with Apache License 2.0 | 5 votes |
/** * Returns the base folder for tests. */ @Override public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { // Locate the base Tar file final String tarFilePath = AbstractVfsTestCase.getTestResource("nested.tgz").getAbsolutePath(); final String uri = "tgz:file:" + tarFilePath + "!/test.tgz"; final FileObject tarFile = manager.resolveFile(uri); // Now build the nested file system final FileObject nestedFS = manager.createFileSystem(tarFile); return nestedFS.resolveFile("/"); }
Example 6
Source File: NestedTbz2TestCase.java From commons-vfs with Apache License 2.0 | 5 votes |
/** * Returns the base folder for tests. */ @Override public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { // Locate the base Tar file final String tarFilePath = AbstractVfsTestCase.getTestResource("nested.tbz2").getAbsolutePath(); final String uri = "tbz2:file:" + tarFilePath + "!/test.tbz2"; final FileObject tarFile = manager.resolveFile(uri); // Now build the nested file system final FileObject nestedFS = manager.createFileSystem(tarFile); return nestedFS.resolveFile("/"); }
Example 7
Source File: FileSystemManagerFactoryTestCase.java From commons-vfs with Apache License 2.0 | 5 votes |
private void check(final FileSystemManager manager, FileObject file) throws FileSystemException { assertNotNull(file); assertTrue(file.exists()); assertSame(FileType.FILE, file.getType()); assertTrue(file.isFile()); // Expand it file = manager.createFileSystem(file); assertNotNull(file); assertTrue(file.exists()); assertSame(FileType.FOLDER, file.getType()); assertTrue(file.isFolder()); }