Package org.apache.commons.vfs2.provider
Class AbstractFileSystem
java.lang.Object
org.apache.commons.vfs2.provider.AbstractVfsComponent
org.apache.commons.vfs2.provider.AbstractFileSystem
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- FileSystem,- VfsComponent
- Direct Known Subclasses:
- CompressedFileFileSystem,- FtpFileSystem,- Http4FileSystem,- Http5FileSystem,- HttpFileSystem,- LocalFileSystem,- RamFileSystem,- SftpFileSystem,- TarFileSystem,- UrlFileSystem,- VirtualFileSystem,- ZipFileSystem
A partial 
FileSystem implementation.- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedAbstractFileSystem(FileName rootName, FileObject parentLayer, FileSystemOptions fileSystemOptions) Constructs a new instance.
- 
Method SummaryModifier and TypeMethodDescriptionprotected abstract voidaddCapabilities(Collection<Capability> caps) Adds the capabilities of this file system.voidaddJunction(String junctionPoint, FileObject targetFile) Adds a junction to this file system.voidaddListener(FileObject file, FileListener listener) Adds a listener on a file in this file system.voidclose()Closes this component.voidCloses the underlying link used to access the files.protected abstract FileObjectcreateFile(AbstractFileName name) Creates a file object.protected FileObjectdecorateFileObject(FileObject file) Decorates the given file object.protected voidCloses the underlying link used to access the files.protected FiledoReplicateFile(FileObject file, FileSelector selector) Creates a temporary local copy of a file and its descendants.voidfireFileChanged(FileObject file) Fires a file changed event.voidfireFileCreated(FileObject file) Fires a file create event.voidfireFileDeleted(FileObject file) Fires a file delete event.getAttribute(String attrName) Gets the attribute with the specified name.protected FileObjectgetFileFromCache(FileName name) Gets a cached file.Gets the FileSystemManager used to instantiate this file system.Gets the FileSystemOptions used to instantiate this file system.doubleGets the accuracy of the last modification time.Gets the parent layer if this is a layered file system.getRoot()Gets the root file of this file system.Gets the name of the root of this file system.Gets the root URI specified for this file System.booleanhasCapability(Capability capability) Tests whether this file system has a particular capability.voidinit()Initializes this component.booleanisOpen()Tests whether this file system has open streams.booleanTests whether any files are using this FileSystem.protected voidCalled after all file-objects closed their streams.protected voidputFileToCache(FileObject file) Adds a file object to the cache.protected voidremoveFileFromCache(FileName name) Removes a cached file.voidremoveJunction(String junctionPoint) Removes a junction from this file system.voidremoveListener(FileObject file, FileListener listener) Removes a listener from a file in this file system.replicateFile(FileObject file, FileSelector selector) Creates a temporary local copy of a file and its descendants.resolveFile(String nameStr) Finds a file in this file system.resolveFile(FileName name) Finds a file in this file system.voidsetAttribute(String attrName, Object value) Sets the attribute with the specified name.Methods inherited from class org.apache.commons.vfs2.provider.AbstractVfsComponentgetContext, getLogger, setContext, setLogger
- 
Constructor Details- 
AbstractFileSystemprotected AbstractFileSystem(FileName rootName, FileObject parentLayer, FileSystemOptions fileSystemOptions) Constructs a new instance.- Parameters:
- rootName- The root file name of this file system.
- parentLayer- The parent layer of this file system.
- fileSystemOptions- Options to build this file system.
 
 
- 
- 
Method Details- 
addCapabilitiesAdds the capabilities of this file system.- Parameters:
- caps- collections of Capabilities, can be immutable.
 
- 
addJunctionAdds a junction to this file system.- Specified by:
- addJunctionin interface- FileSystem
- Parameters:
- junctionPoint- The junction point.
- targetFile- The target to add.
- Throws:
- FileSystemException- if an error occurs.
 
- 
addListenerAdds a listener on a file in this file system.- Specified by:
- addListenerin interface- FileSystem
- Parameters:
- file- The FileObject to be monitored.
- listener- The FileListener
 
- 
closeCloses this component.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Specified by:
- closein interface- VfsComponent
- Overrides:
- closein class- AbstractVfsComponent
 
- 
closeCommunicationLinkCloses the underlying link used to access the files.
- 
createFileCreates a file object.This method is called only if the requested file is not cached. - Parameters:
- name- name referencing the new file.
- Returns:
- new created FileObject.
- Throws:
- Exception- might throw an Exception, which is then wrapped in FileSystemException.
 
- 
decorateFileObjectDecorates the given file object.- Parameters:
- file- the file object.
- Returns:
- the decorated file object.
- Throws:
- FileSystemException- if a file system error occurs.
 
- 
doCloseCommunicationLinkCloses the underlying link used to access the files.
- 
doReplicateFileCreates a temporary local copy of a file and its descendants.- Parameters:
- file- the start of the tree.
- selector- selection what to do with children.
- Returns:
- replicated root file.
- Throws:
- Exception- any Exception is wrapped as FileSystemException.
 
- 
fireFileChangedFires a file changed event.This will only happen if you monitor the file using FileMonitor.- Parameters:
- file- The FileObject that changed.
 
- 
fireFileCreatedFires a file create event.- Parameters:
- file- The FileObject that was created.
 
- 
fireFileDeletedFires a file delete event.- Parameters:
- file- The FileObject that was deleted.
 
- 
getAttributeGets the attribute with the specified name. The default implementation simply throws an exception.- Specified by:
- getAttributein interface- FileSystem
- Parameters:
- attrName- The name of the attribute.
- Returns:
- the Object associated with the attribute or null if no object is.
- Throws:
- FileSystemException- if an error occurs.
- See Also:
 
- 
getFileFromCacheGets a cached file.- Parameters:
- name- name to search for.
- Returns:
- file object or null if not found.
 
- 
getFileSystemManagerGets the FileSystemManager used to instantiate this file system.- Specified by:
- getFileSystemManagerin interface- FileSystem
- Returns:
- the FileSystemManager.
 
- 
getFileSystemOptionsGets the FileSystemOptions used to instantiate this file system.- Specified by:
- getFileSystemOptionsin interface- FileSystem
- Returns:
- the FileSystemOptions.
 
- 
getLastModTimeAccuracyGets the accuracy of the last modification time.- Specified by:
- getLastModTimeAccuracyin interface- FileSystem
- Returns:
- milliseconds, 0 means perfectly accurate, > 0might be off by this value, for examnple, sftp is 1000 milliseconds.
 
- 
getParentLayerGets the parent layer if this is a layered file system.- Specified by:
- getParentLayerin interface- FileSystem
- Returns:
- The FileObject for the parent layer.
- Throws:
- FileSystemException- if an error occurs.
 
- 
getRootGets the root file of this file system.- Specified by:
- getRootin interface- FileSystem
- Returns:
- The root FileObject of the FileSystem
- Throws:
- FileSystemException- if an error occurs.
 
- 
getRootNameGets the name of the root of this file system.- Specified by:
- getRootNamein interface- FileSystem
- Returns:
- the root FileName.
 
- 
getRootURIGets the root URI specified for this file System.- Specified by:
- getRootURIin interface- FileSystem
- Returns:
- The root URI used in this file system.
- Since:
- 2.0
 
- 
hasCapabilityTests whether this file system has a particular capability.- Specified by:
- hasCapabilityin interface- FileSystem
- Parameters:
- capability- the Capability to check for.
- Returns:
- true if the FileSystem has the Capability, false otherwise.
 
- 
initInitializes this component.- Specified by:
- initin interface- VfsComponent
- Overrides:
- initin class- AbstractVfsComponent
- Throws:
- FileSystemException- if an error occurs.
 
- 
isOpenTests whether this file system has open streams.- Returns:
- true if the FileSystem has open streams.
 
- 
isReleaseableTests whether any files are using this FileSystem.- Returns:
- whether any files are using this FileSystem.
 
- 
notifyAllStreamsClosedCalled after all file-objects closed their streams.
- 
putFileToCacheAdds a file object to the cache.- Parameters:
- file- the file to add.
 
- 
removeFileFromCacheRemoves a cached file.- Parameters:
- name- The file name to remove.
 
- 
removeJunctionRemoves a junction from this file system.- Specified by:
- removeJunctionin interface- FileSystem
- Parameters:
- junctionPoint- The junction point.
- Throws:
- FileSystemException- if an error occurs
 
- 
removeListenerRemoves a listener from a file in this file system.- Specified by:
- removeListenerin interface- FileSystem
- Parameters:
- file- The FileObject to be monitored.
- listener- The FileListener
 
- 
replicateFileCreates a temporary local copy of a file and its descendants.- Specified by:
- replicateFilein interface- FileSystem
- Parameters:
- file- The FileObject to replicate.
- selector- The FileSelector.
- Returns:
- The replicated File.
- Throws:
- FileSystemException- if an error occurs.
 
- 
resolveFileFinds a file in this file system.- Specified by:
- resolveFilein interface- FileSystem
- Parameters:
- name- The name of the file to locate.
- Returns:
- The located FileObject or null if none could be located.
- Throws:
- FileSystemException- if an error occurs.
 
- 
resolveFileFinds a file in this file system.- Specified by:
- resolveFilein interface- FileSystem
- Parameters:
- nameStr- The name of the file to resolve.
- Returns:
- The located FileObject or null if none could be located.
- Throws:
- FileSystemException- if an error occurs.
 
- 
setAttributeSets the attribute with the specified name. The default implementation simply throws an exception.- Specified by:
- setAttributein interface- FileSystem
- Parameters:
- attrName- the attribute name.
- value- The object to associate with the attribute.
- Throws:
- FileSystemException- if an error occurs.
- See Also:
 
 
-