Class AbstractFileProvider
java.lang.Object
org.apache.commons.vfs2.provider.AbstractVfsComponent
org.apache.commons.vfs2.provider.AbstractVfsContainer
org.apache.commons.vfs2.provider.AbstractFileProvider
- All Implemented Interfaces:
Closeable, AutoCloseable, FileProvider, VfsComponent
- Direct Known Subclasses:
AbstractLayeredFileProvider, AbstractOriginatingFileProvider, CompositeFileProvider, ResourceFileProvider, TemporaryFileProvider, UrlFileProvider
A partial
FileProvider implementation. Takes care of managing the file systems created by the provider.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final AbstractFileSystem[]private final Map<FileSystemKey, FileSystem> The cached file systems.private FileNameParser -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddFileSystem(Comparable<?> key, FileSystem fs) Adds a file system to those cached by this provider.voidclose()Closes the file systems created by this provider.voidcloseFileSystem(FileSystem fileSystem) Close the FileSystem.createFileSystem(String scheme, FileObject file, FileSystemOptions fileSystemOptions) Creates a layered file system.protected FileSystemfindFileSystem(Comparable<?> key, FileSystemOptions fileSystemOptions) Locates a cached file system.voidFree unused resources.Returns the FileSystemConfigBuidler.protected FileNameParserParses an absolute URI.protected voidsetFileNameParser(FileNameParser parser) Methods inherited from class AbstractVfsContainer
addComponent, removeComponentMethods inherited from class AbstractVfsComponent
getContext, getLogger, init, setContext, setLoggerMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface FileProvider
findFile, getCapabilities
-
Field Details
-
EMPTY_ABSTRACT_FILE_SYSTEMS
-
fileSystemMap
The cached file systems.This is a mapping from
FileSystemKey(root URI and options) toFileSystem. -
parser
-
-
Constructor Details
-
AbstractFileProvider
public AbstractFileProvider()
-
-
Method Details
-
getFileNameParser
-
setFileNameParser
-
close
public void close()Closes the file systems created by this provider.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceVfsComponent- Overrides:
closein classAbstractVfsContainer
-
createFileSystem
public FileObject createFileSystem(String scheme, FileObject file, FileSystemOptions fileSystemOptions) throws FileSystemException Creates a layered file system. This method throws a 'not supported' exception.- Specified by:
createFileSystemin interfaceFileProvider- Parameters:
scheme- The protocol to use to access the file.file- a FileObject.fileSystemOptions- Options to the file system.- Returns:
- A FileObject associated with the new FileSystem.
- Throws:
FileSystemException- if an error occurs.
-
addFileSystem
Adds a file system to those cached by this provider.The file system may implement
VfsComponent, in which case it is initialized.- Parameters:
key- The root file of the file system, part of the cache key.fs- the file system to add.- Throws:
FileSystemException- if any error occurs.
-
findFileSystem
Locates a cached file system.- Parameters:
key- The root file of the file system, part of the cache key.fileSystemOptions- file system options the file system instance must have, may be null.- Returns:
- The file system instance, or null if it is not cached.
-
getConfigBuilder
Returns the FileSystemConfigBuidler.- Specified by:
getConfigBuilderin interfaceFileProvider- Returns:
- the FileSystemConfigBuilder.
-
freeUnusedResources
public void freeUnusedResources()Free unused resources. -
closeFileSystem
Close the FileSystem.- Parameters:
fileSystem- The FileSystem to close.
-
parseUri
Parses an absolute URI.- Specified by:
parseUriin interfaceFileProvider- Parameters:
base- The base file - if null theurineeds to be absoluteuri- The URI to parse.- Returns:
- The FileName.
- Throws:
FileSystemException- if an error occurs.
-