|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FileSystemManager
A FileSystemManager manages a set of file systems. This interface is
used to locate a FileObject
by name from one of those file systems.
To locate a FileObject
, use one of the resolveFile()
methods.
A file system manager can recognise several types of file names:
Absolute URI. These must start with a scheme, such as
file:
or ftp:
, followed by a scheme dependent
file name. Some examples:
file:/c:/somefile ftp://somewhere.org/somefile
Absolute local file name. For example,
/home/someuser/a-file
or c:\dir\somefile.html
.
Elements in the name can be separated using any of the following
characters: /
, \
, or the native file separator
character. For example, the following file names are the same:
c:\somedir\somefile.xml c:/somedir/somefile.xml
Relative path. For example: ../somefile
or
somedir/file.txt
. The file system manager resolves relative
paths against its base file. Elements in the relative path can be
separated using /
, \
, or file system specific
separator characters. Relative paths may also contain ..
and
.
elements. See FileObject.resolveFile(java.lang.String, org.apache.commons.vfs.NameScope)
for more
details.
Method Summary | |
---|---|
void |
addOperationProvider(java.lang.String[] schemes,
FileOperationProvider operationProvider)
|
void |
addOperationProvider(java.lang.String scheme,
FileOperationProvider operationProvider)
Adds the specified FileOperationProvider for the specified scheme. |
boolean |
canCreateFileSystem(FileObject file)
Determines if a layered file system can be created for a given file. |
void |
closeFileSystem(FileSystem filesystem)
Closes the given filesystem. If you use VFS as singleton it is VERY dangerous to call this method. |
FileObject |
createFileSystem(FileObject file)
Creates a layered file system. |
FileObject |
createFileSystem(java.lang.String provider,
FileObject file)
Creates a layered file system. |
FileObject |
createVirtualFileSystem(FileObject rootFile)
Creates a virtual file system. |
FileObject |
createVirtualFileSystem(java.lang.String rootUri)
Creates an empty virtual file system. |
FileObject |
getBaseFile()
Returns the base file used to resolve relative paths. |
CacheStrategy |
getCacheStrategy()
Get the cache strategy used |
FileContentInfoFactory |
getFileContentInfoFactory()
The class to use to determine the content-type (mime-type) |
java.lang.Class |
getFileObjectDecorator()
Get the file object decorator used |
java.lang.reflect.Constructor |
getFileObjectDecoratorConst()
The constructor associated to the fileObjectDecorator. |
FilesCache |
getFilesCache()
Get the cache used to cache fileobjects. |
FileSystemConfigBuilder |
getFileSystemConfigBuilder(java.lang.String scheme)
Get the configuration builder for the given scheme |
FileOperationProvider[] |
getOperationProviders(java.lang.String scheme)
|
java.util.Collection |
getProviderCapabilities(java.lang.String scheme)
Get the capabilities for a given scheme. |
java.lang.String[] |
getSchemes()
Get the schemes currently available. |
java.net.URLStreamHandlerFactory |
getURLStreamHandlerFactory()
Returns a streamhandler factory to enable URL lookup using this FileSystemManager. |
FileObject |
resolveFile(FileObject baseFile,
java.lang.String name)
Locates a file by name. |
FileObject |
resolveFile(java.io.File baseFile,
java.lang.String name)
Locates a file by name. |
FileObject |
resolveFile(java.lang.String name)
Locates a file by name. |
FileObject |
resolveFile(java.lang.String name,
FileSystemOptions fileSystemOptions)
Locates a file by name. |
FileName |
resolveName(FileName root,
java.lang.String name)
Resolves a name, relative to this file name. |
FileName |
resolveName(FileName root,
java.lang.String name,
NameScope scope)
Resolves a name, relative to the "root" file name. |
FileName |
resolveURI(java.lang.String uri)
Resolve the uri to a filename |
void |
setLogger(org.apache.commons.logging.Log log)
Sets the logger to use. |
FileObject |
toFileObject(java.io.File file)
Converts a local file into a FileObject . |
Method Detail |
---|
FileObject getBaseFile() throws FileSystemException
FileSystemException
FileObject resolveFile(java.lang.String name) throws FileSystemException
resolveFile(uri, getBaseName())
.
name
- The name of the file.
FileSystemException
- On error parsing the file name.FileObject resolveFile(java.lang.String name, FileSystemOptions fileSystemOptions) throws FileSystemException
resolveFile(uri, getBaseName())
.
name
- The name of the file.fileSystemOptions
- The FileSystemOptions used for FileSystem creation
FileSystemException
- On error parsing the file name.FileObject resolveFile(FileObject baseFile, java.lang.String name) throws FileSystemException
baseFile
.
Note that the file does not have to exist when this method is called.
name
- The name of the file.baseFile
- The base file to use to resolve relative paths.
May be null.
FileSystemException
- On error parsing the file name.FileObject resolveFile(java.io.File baseFile, java.lang.String name) throws FileSystemException
resolveFile(FileObject, String)
for details.
baseFile
- The base file to use to resolve relative paths.
May be null.name
- The name of the file.
FileSystemException
- On error parsing the file name.FileName resolveName(FileName root, java.lang.String name) throws FileSystemException
resolveName( path, NameScope.FILE_SYSTEM )
.
root
- the base filenamename
- The name to resolve.
FileName
object representing the resolved file name.
FileSystemException
- If the name is invalid.FileName resolveName(FileName root, java.lang.String name, NameScope scope) throws FileSystemException
NameScope
for a description of how names are resolved.
root
- the base filenamename
- The name to resolve.scope
- The NameScope
to use when resolving the name.
FileName
object representing the resolved file name.
FileSystemException
- If the name is invalid.FileObject toFileObject(java.io.File file) throws FileSystemException
FileObject
.
file
- The file to convert.
FileObject
that represents the local file. Never
returns null.
FileSystemException
- On error converting the file.FileObject createFileSystem(java.lang.String provider, FileObject file) throws FileSystemException
provider
- The name of the file system provider to use. This name
is the same as the scheme used in URI to identify the provider.file
- The file to use to create the file system.
FileSystemException
- On error creating the file system.void closeFileSystem(FileSystem filesystem)
FileObject createFileSystem(FileObject file) throws FileSystemException
file
- The file to use to create the file system.
FileSystemException
- On error creating the file system.FileObject createVirtualFileSystem(java.lang.String rootUri) throws FileSystemException
rootUri
- The root URI to use for the new file system. Can be null.
FileSystemException
FileObject createVirtualFileSystem(FileObject rootFile) throws FileSystemException
rootFile
- The root file to backs the file system.
FileSystemException
java.net.URLStreamHandlerFactory getURLStreamHandlerFactory()
boolean canCreateFileSystem(FileObject file) throws FileSystemException
file
- The file to check for.
FileSystemException
FilesCache getFilesCache()
CacheStrategy getCacheStrategy()
java.lang.Class getFileObjectDecorator()
java.lang.reflect.Constructor getFileObjectDecoratorConst()
FileContentInfoFactory getFileContentInfoFactory()
java.lang.String[] getSchemes()
java.util.Collection getProviderCapabilities(java.lang.String scheme) throws FileSystemException
FileSystemException
- if the given scheme is not konwnvoid setLogger(org.apache.commons.logging.Log log)
FileSystemConfigBuilder getFileSystemConfigBuilder(java.lang.String scheme) throws FileSystemException
FileSystemException
- if the given scheme is not konwnFileName resolveURI(java.lang.String uri) throws FileSystemException
FileSystemException
- if this is not possiblevoid addOperationProvider(java.lang.String scheme, FileOperationProvider operationProvider) throws FileSystemException
scheme
- operationProvider
-
FileSystemException
void addOperationProvider(java.lang.String[] schemes, FileOperationProvider operationProvider) throws FileSystemException
schemes
- operationProvider
-
FileSystemException
addOperationProvider(String, org.apache.commons.vfs.operations.FileOperationProvider)
FileOperationProvider[] getOperationProviders(java.lang.String scheme) throws FileSystemException
scheme
- the scheme for wich we want to get the list af registered providers.
FileSystemException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |