Package org.apache.commons.vfs2.impl
Class VirtualFileSystem
java.lang.Object
org.apache.commons.vfs2.provider.AbstractVfsComponent
org.apache.commons.vfs2.provider.AbstractFileSystem
org.apache.commons.vfs2.impl.VirtualFileSystem
- All Implemented Interfaces:
Closeable
,AutoCloseable
,FileSystem
,VfsComponent
A logical file system, made up of set of junctions, or links, to files from other file systems.
TODO - Handle nested junctions.
-
Constructor Summary
ConstructorsConstructorDescriptionVirtualFileSystem
(AbstractFileName rootFileName, FileSystemOptions fileSystemOptions) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addCapabilities
(Collection<Capability> caps) Adds the capabilities of this file system.void
addJunction
(String junctionPoint, FileObject targetFile) Adds a junction to this file system.void
close()
Closes this component.protected FileObject
createFile
(AbstractFileName name) Creates a file object.void
removeJunction
(String junctionPoint) Removes a junction from this file system.Methods inherited from class org.apache.commons.vfs2.provider.AbstractFileSystem
addListener, closeCommunicationLink, decorateFileObject, doCloseCommunicationLink, doReplicateFile, fireFileChanged, fireFileCreated, fireFileDeleted, getAttribute, getFileFromCache, getFileSystemManager, getFileSystemOptions, getLastModTimeAccuracy, getParentLayer, getRoot, getRootName, getRootURI, hasCapability, init, isOpen, isReleaseable, notifyAllStreamsClosed, putFileToCache, removeFileFromCache, removeListener, replicateFile, resolveFile, resolveFile, setAttribute
Methods inherited from class org.apache.commons.vfs2.provider.AbstractVfsComponent
getContext, getLogger, setContext, setLogger
-
Constructor Details
-
VirtualFileSystem
Constructs a new instance.- Parameters:
rootFileName
- The root file name of this file system.fileSystemOptions
- Options to build this file system.
-
-
Method Details
-
addCapabilities
Adds the capabilities of this file system.- Specified by:
addCapabilities
in classAbstractFileSystem
- Parameters:
caps
- collections of Capabilities, can be immutable.
-
addJunction
Adds a junction to this file system.- Specified by:
addJunction
in interfaceFileSystem
- Overrides:
addJunction
in classAbstractFileSystem
- Parameters:
junctionPoint
- The location of the junction.targetFile
- The target file to base the junction on.- Throws:
FileSystemException
- if an error occurs.
-
close
Description copied from class:AbstractFileSystem
Closes this component.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceVfsComponent
- Overrides:
close
in classAbstractFileSystem
-
createFile
Creates a file object. This method is called only if the requested file is not cached.- Specified by:
createFile
in classAbstractFileSystem
- Parameters:
name
- name referencing the new file.- Returns:
- new created FileObject.
- Throws:
Exception
- might throw an Exception, which is then wrapped in FileSystemException.
-
removeJunction
Removes a junction from this file system.- Specified by:
removeJunction
in interfaceFileSystem
- Overrides:
removeJunction
in classAbstractFileSystem
- Parameters:
junctionPoint
- The junction to remove.- Throws:
FileSystemException
- if an error occurs.
-