|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.vfs.impl.DefaultFileSystemManager
A default file system manager implementation.
Constructor Summary | |
DefaultFileSystemManager()
|
Method Summary | |
void |
_closeFileSystem(FileSystem filesystem)
Closes the given filesystem. |
void |
addExtensionMap(String extension,
String scheme)
Adds an filename extension mapping. |
void |
addMimeTypeMap(String mimeType,
String scheme)
Adds a mime type mapping. |
void |
addOperationProvider(String[] schemes,
FileOperationProvider operationProvider)
|
void |
addOperationProvider(String scheme,
FileOperationProvider operationProvider)
Adds the specified FileOperationProvider for the specified scheme. |
void |
addProvider(String[] urlSchemes,
FileProvider provider)
Registers a file system provider. |
void |
addProvider(String urlScheme,
FileProvider provider)
Registers a file system provider. |
boolean |
canCreateFileSystem(FileObject file)
Determines if a layered file system can be created for a given file. |
void |
close()
Closes all files created by this manager, and cleans up any temporary files. |
void |
closeFileSystem(FileSystem filesystem)
Closes the given filesystem. |
FileObject |
createFileSystem(FileObject file)
Creates a layered file system. |
FileObject |
createFileSystem(String scheme,
FileObject file)
Creates a layered file system. |
FileObject |
createVirtualFileSystem(FileObject rootFile)
Creates a virtual file system. |
FileObject |
createVirtualFileSystem(String rootUri)
Creates an empty virtual file system. |
void |
freeUnusedResources()
Free all resources used by unused filesystems created by this manager. |
FileObject |
getBaseFile()
Returns the base file used to resolve relative URI. |
CacheStrategy |
getCacheStrategy()
Get the cache strategy used |
FileContentInfoFactory |
getFileContentInfoFactory()
get the fileContentInfoFactory used to determine the infos of a file content. |
Class |
getFileObjectDecorator()
Get the file object decorator used |
Constructor |
getFileObjectDecoratorConst()
The constructor associated to the fileObjectDecorator. |
FilesCache |
getFilesCache()
Returns the filesCache implementation used to cache files |
FileSystemConfigBuilder |
getFileSystemConfigBuilder(String scheme)
Get the configuration builder for the given scheme |
protected org.apache.commons.logging.Log |
getLogger()
Returns the logger used by this manager. |
FileOperationProvider[] |
getOperationProviders(String scheme)
|
Collection |
getProviderCapabilities(String scheme)
Get the capabilities for a given scheme. |
FileReplicator |
getReplicator()
Returns the file replicator. |
String[] |
getSchemes()
Get the schemes currently available. |
TemporaryFileStore |
getTemporaryFileStore()
Returns the temporary file store. |
URLStreamHandlerFactory |
getURLStreamHandlerFactory()
Get the URLStreamHandlerFactory. |
boolean |
hasProvider(String scheme)
Returns true if this manager has a provider for a particular scheme. |
void |
init()
Initialises this manager. |
FileObject |
resolveFile(FileObject baseFile,
String uri)
Resolves a URI, relative to a base file. |
FileObject |
resolveFile(FileObject baseFile,
String uri,
FileSystemOptions fileSystemOptions)
Resolves a URI, realtive to a base file with specified FileSystem configuration |
FileObject |
resolveFile(File baseFile,
String uri)
Locates a file by URI. |
FileObject |
resolveFile(String uri)
Locates a file by URI. |
FileObject |
resolveFile(String uri,
FileSystemOptions fileSystemOptions)
Locate a file by URI, use the FileSystemOptions for file-system creation |
FileName |
resolveName(FileName root,
String path)
Resolves a name, relative to the file. |
FileName |
resolveName(FileName base,
String name,
NameScope scope)
Resolves a name, relative to the root. |
FileName |
resolveURI(String uri)
resolve the uri to a filename |
void |
setBaseFile(File baseFile)
Sets the base file to use when resolving relative URI. |
void |
setBaseFile(FileObject baseFile)
Sets the base file to use when resolving relative URI. |
void |
setCacheStrategy(CacheStrategy fileCacheStrategy)
Set the cache strategy to use when dealing with file object data. |
void |
setDefaultProvider(FileProvider provider)
Sets the default provider. |
void |
setFileContentInfoFactory(FileContentInfoFactory fileContentInfoFactory)
set the fileContentInfoFactory used to determine the infos of a file content. |
void |
setFileObjectDecorator(Class fileObjectDecorator)
set a fileObject decorator to be used for ALL returned file objects |
void |
setFilesCache(FilesCache filesCache)
Sets the filesCache implementation used to cache files |
void |
setLogger(org.apache.commons.logging.Log log)
Sets the logger to use. |
void |
setReplicator(FileReplicator replicator)
Sets the file replicator to use. |
void |
setTemporaryFileStore(TemporaryFileStore tempFileStore)
Sets the temporary file store to use. |
FileObject |
toFileObject(File file)
Converts a local file into a FileObject . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DefaultFileSystemManager()
Method Detail |
protected org.apache.commons.logging.Log getLogger()
public void addProvider(String urlScheme, FileProvider provider) throws FileSystemException
urlScheme
- The scheme the provider will handle.provider
- The provider.
FileSystemException
public void addProvider(String[] urlSchemes, FileProvider provider) throws FileSystemException
urlSchemes
- The schemes the provider will handle.provider
- The provider.
FileSystemException
public boolean hasProvider(String scheme)
public void addExtensionMap(String extension, String scheme)
extension
- The file name extension.scheme
- The scheme to use for files with this extension.public void addMimeTypeMap(String mimeType, String scheme)
mimeType
- The mime type.scheme
- The scheme to use for files with this mime type.public void setDefaultProvider(FileProvider provider) throws FileSystemException
FileSystemException
public FilesCache getFilesCache()
getFilesCache
in interface FileSystemManager
public void setFilesCache(FilesCache filesCache) throws FileSystemException
FileSystemException
public void setCacheStrategy(CacheStrategy fileCacheStrategy) throws FileSystemException
Set the cache strategy to use when dealing with file object data. You can set it only once before the FileSystemManager is initialized.
The default is CacheStrategy.ON_RESOLVE
FileSystemException
- if this is not possible. e.g. it is already set.public CacheStrategy getCacheStrategy()
getCacheStrategy
in interface FileSystemManager
public Class getFileObjectDecorator()
getFileObjectDecorator
in interface FileSystemManager
public Constructor getFileObjectDecoratorConst()
getFileObjectDecoratorConst
in interface FileSystemManager
public void setFileObjectDecorator(Class fileObjectDecorator) throws FileSystemException
fileObjectDecorator
- must be inherted from DecoratedFileObject
a has to provide a
constructor with a single FileObject
as argument
FileSystemException
public FileContentInfoFactory getFileContentInfoFactory()
getFileContentInfoFactory
in interface FileSystemManager
public void setFileContentInfoFactory(FileContentInfoFactory fileContentInfoFactory) throws FileSystemException
FileSystemException
public void setReplicator(FileReplicator replicator) throws FileSystemException
FileSystemException
public void setTemporaryFileStore(TemporaryFileStore tempFileStore) throws FileSystemException
FileSystemException
public void setLogger(org.apache.commons.logging.Log log)
setLogger
in interface FileSystemManager
public FileReplicator getReplicator() throws FileSystemException
FileSystemException
public TemporaryFileStore getTemporaryFileStore() throws FileSystemException
FileSystemException
public void init() throws FileSystemException
FileSystemException
public void close()
public void freeUnusedResources()
public void setBaseFile(FileObject baseFile) throws FileSystemException
FileSystemException
public void setBaseFile(File baseFile) throws FileSystemException
FileSystemException
public FileObject getBaseFile() throws FileSystemException
getBaseFile
in interface FileSystemManager
FileSystemException
public FileObject resolveFile(String uri) throws FileSystemException
resolveFile
in interface FileSystemManager
uri
- The name of the file.
FileSystemException
- On error parsing the file name.public FileObject resolveFile(String uri, FileSystemOptions fileSystemOptions) throws FileSystemException
resolveFile
in interface FileSystemManager
uri
- The name of the file.fileSystemOptions
- The FileSystemOptions used for FileSystem creation
FileSystemException
- On error parsing the file name.public FileObject resolveFile(File baseFile, String uri) throws FileSystemException
resolveFile
in interface FileSystemManager
baseFile
- The base file to use to resolve relative paths.
May be null.uri
- The name of the file.
FileSystemException
- On error parsing the file name.public FileObject resolveFile(FileObject baseFile, String uri) throws FileSystemException
resolveFile
in interface FileSystemManager
uri
- 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.public FileObject resolveFile(FileObject baseFile, String uri, FileSystemOptions fileSystemOptions) throws FileSystemException
FileSystemException
public FileName resolveName(FileName root, String path) throws FileSystemException
resolveName
in interface FileSystemManager
root
- the base filenamepath
- The name to resolve.
FileName
object representing the resolved file name.
FileSystemException
- If the name is invalid.public FileName resolveName(FileName base, String name, NameScope scope) throws FileSystemException
resolveName
in interface FileSystemManager
base
- the base filenamename
- the namescope
- the NameScope
FileName
object representing the resolved file name.
FileSystemException
public FileName resolveURI(String uri) throws FileSystemException
resolveURI
in interface FileSystemManager
FileSystemException
public FileObject toFileObject(File file) throws FileSystemException
FileObject
.
toFileObject
in interface FileSystemManager
file
- The file to convert.
FileObject
that represents the local file. Never
returns null.
FileSystemException
- On error converting the file.public FileObject createFileSystem(String scheme, FileObject file) throws FileSystemException
createFileSystem
in interface FileSystemManager
scheme
- 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.public FileObject createFileSystem(FileObject file) throws FileSystemException
createFileSystem
in interface FileSystemManager
file
- The file to use to create the file system.
FileSystemException
- On error creating the file system.public boolean canCreateFileSystem(FileObject file) throws FileSystemException
canCreateFileSystem
in interface FileSystemManager
file
- The file to check for.
FileSystemException
public FileObject createVirtualFileSystem(FileObject rootFile) throws FileSystemException
createVirtualFileSystem
in interface FileSystemManager
rootFile
- The root file to backs the file system.
FileSystemException
public FileObject createVirtualFileSystem(String rootUri) throws FileSystemException
createVirtualFileSystem
in interface FileSystemManager
rootUri
- The root URI to use for the new file system. Can be null.
FileSystemException
public URLStreamHandlerFactory getURLStreamHandlerFactory()
getURLStreamHandlerFactory
in interface FileSystemManager
public void closeFileSystem(FileSystem filesystem)
closeFileSystem
in interface FileSystemManager
public void _closeFileSystem(FileSystem filesystem)
public String[] getSchemes()
getSchemes
in interface FileSystemManager
public Collection getProviderCapabilities(String scheme) throws FileSystemException
getProviderCapabilities
in interface FileSystemManager
FileSystemException
- if the given scheme is not konwnpublic FileSystemConfigBuilder getFileSystemConfigBuilder(String scheme) throws FileSystemException
getFileSystemConfigBuilder
in interface FileSystemManager
FileSystemException
- if the given scheme is not konwnpublic void addOperationProvider(String scheme, FileOperationProvider operationProvider) throws FileSystemException
addOperationProvider
in interface FileSystemManager
scheme
- operationProvider
-
FileSystemException
public void addOperationProvider(String[] schemes, FileOperationProvider operationProvider) throws FileSystemException
addOperationProvider
in interface FileSystemManager
schemes
- operationProvider
-
FileSystemException
FileSystemManager.addOperationProvider(String,
org.apache.commons.vfs.operations.FileOperationProvider)
public FileOperationProvider[] getOperationProviders(String scheme) throws FileSystemException
getOperationProviders
in interface FileSystemManager
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 |