org.apache.commons.vfs2.provider
Class AbstractFileProvider

java.lang.Object
  extended by org.apache.commons.vfs2.provider.AbstractVfsComponent
      extended by org.apache.commons.vfs2.provider.AbstractVfsContainer
          extended by org.apache.commons.vfs2.provider.AbstractFileProvider
All Implemented Interfaces:
FileProvider, VfsComponent
Direct Known Subclasses:
AbstractLayeredFileProvider, AbstractOriginatingFileProvider, CompositeFileProvider, ResourceFileProvider, TemporaryFileProvider, UrlFileProvider

public abstract class AbstractFileProvider
extends AbstractVfsContainer
implements FileProvider

A partial FileProvider implementation. Takes care of managing the file systems created by the provider.

Author:
Commons VFS team

Constructor Summary
AbstractFileProvider()
           
 
Method Summary
protected  void addFileSystem(Comparable<?> key, FileSystem fs)
          Adds a file system to those cached by this provider.
 void close()
          Closes the file systems created by this provider.
 void closeFileSystem(FileSystem filesystem)
          Close the FileSystem.
 FileObject createFileSystem(String scheme, FileObject file, FileSystemOptions properties)
          Creates a layered file system.
protected  FileSystem findFileSystem(Comparable<?> key, FileSystemOptions fileSystemProps)
          Locates a cached file system
 void freeUnusedResources()
          Free unused resources.
 FileSystemConfigBuilder getConfigBuilder()
          Returns the FileSystemConfigBuidler.
protected  FileNameParser getFileNameParser()
           
 FileName parseUri(FileName base, String uri)
          Parses an absolute URI.
protected  void setFileNameParser(FileNameParser parser)
           
 
Methods inherited from class org.apache.commons.vfs2.provider.AbstractVfsContainer
addComponent, removeComponent
 
Methods inherited from class org.apache.commons.vfs2.provider.AbstractVfsComponent
getContext, getLogger, init, setContext, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.vfs2.provider.FileProvider
findFile, getCapabilities
 

Constructor Detail

AbstractFileProvider

public AbstractFileProvider()
Method Detail

getFileNameParser

protected FileNameParser getFileNameParser()

setFileNameParser

protected void setFileNameParser(FileNameParser parser)

close

public void close()
Closes the file systems created by this provider.

Specified by:
close in interface VfsComponent
Overrides:
close in class AbstractVfsContainer

createFileSystem

public FileObject createFileSystem(String scheme,
                                   FileObject file,
                                   FileSystemOptions properties)
                            throws FileSystemException
Creates a layered file system. This method throws a 'not supported' exception.

Specified by:
createFileSystem in interface FileProvider
Parameters:
scheme - The protocol to use to access the file.
file - a FileObject.
properties - Options to the file system.
Returns:
A FileObject associated with the new FileSystem.
Throws:
FileSystemException - if an error occurs.

addFileSystem

protected void addFileSystem(Comparable<?> key,
                             FileSystem fs)
                      throws FileSystemException
Adds a file system to those cached by this provider. The file system may implement VfsComponent, in which case it is initialised.

Throws:
FileSystemException

findFileSystem

protected FileSystem findFileSystem(Comparable<?> key,
                                    FileSystemOptions fileSystemProps)
Locates a cached file system

Returns:
The provider, or null if it is not cached.

getConfigBuilder

public FileSystemConfigBuilder getConfigBuilder()
Returns the FileSystemConfigBuidler.

Specified by:
getConfigBuilder in interface FileProvider
Returns:
the FileSystemConfigBuilder.

freeUnusedResources

public void freeUnusedResources()
Free unused resources.


closeFileSystem

public void closeFileSystem(FileSystem filesystem)
Close the FileSystem.

Parameters:
filesystem - The FileSystem to close.

parseUri

public FileName parseUri(FileName base,
                         String uri)
                  throws FileSystemException
Parses an absolute URI.

Specified by:
parseUri in interface FileProvider
Parameters:
base - The base file - if null the uri needs to be absolute
uri - The URI to parse.
Returns:
The FileName.
Throws:
FileSystemException - if an error occurs.


Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.