-
- All Known Implementing Classes:
AzureFileSystemProvider
,BuiltinStreamProvider
,FTPFileSystemProvider
,GcpFileSystemProvider
,HadoopFileSystemProvider
,LocalFileSystemProvider
,S3FileSystemProvider
,SFTPFileSystemProvider
,URLFileSystemProvider
public interface FileSystemProvider
Provides basic operations on paths for a specific path scheme or schemes. AFileSystemProvider
serves two primary purposes:- It operates as a factory for
Path
objects for the schemes it supports. - It implements file and directory operations for the schemes it supports.
Paths
andFileClient
are used. These handle paths generically, whereas a provider can only deal with paths it knows how to support.To add a new path scheme/file system, it is necessary to provide an implementation of this interface. For the scheme to be supported by the methods in
Paths
, the implementation class must be registered as service forcom.pervasive.datarush.io.FileSystemProvider
in the META-INF of the jar containing the class.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FileConfiguration
getConfigurationTemplate()
Returns a non-populated configuration object to server as a template that the user must fill-in.Map<String,FileConfiguration>
getDefaultConfiguration()
Gets default configuration for the schemes handled by the provider.FileSystem
getFileSystem(FileClient client, FileConfiguration configuration, Path path)
Gets the file system identified by the path.Path
getFileSystemPath(Path path)
Returns the filesystem root path associated with the given path.Path
getPath(String path)
Gets the path identified by the given string.boolean
isPathSupported(String scheme)
Indicates whether the given scheme is handled by the provider.
-
-
-
Method Detail
-
isPathSupported
boolean isPathSupported(String scheme)
Indicates whether the given scheme is handled by the provider.- Parameters:
scheme
- an identifier for a path scheme- Returns:
true
if this provider handles paths using the scheme,false
otherwise.
-
getFileSystem
FileSystem getFileSystem(FileClient client, FileConfiguration configuration, Path path)
Gets the file system identified by the path. The path identifies a file on the file system; the file's file system is returned. This is equivalent to callinggetPath(path).getFileSystem()
, but may be faster.- Parameters:
client
- a file client. most implementations will ignore this parameter. "meta-filesystems" ( those than can span filesystems ) may need the file client.configuration
- the configuration for this filesystempath
- a path identifying a file on the file system- Returns:
- the requested file system object
- Throws:
IllegalArgumentException
- if the path is not prefixed with a scheme supported by the provider
-
getPath
Path getPath(String path)
Gets the path identified by the given string. The resulting path represents a location in an abstract file system. Use the methods inFileClient
to perform operations on the files and directories represented by paths.- Parameters:
path
- the path name to resolve into a path object- Returns:
- the requested path object
- Throws:
IllegalArgumentException
- if the path is not prefixed with a scheme supported by the provider
-
getDefaultConfiguration
Map<String,FileConfiguration> getDefaultConfiguration()
Gets default configuration for the schemes handled by the provider. Default configuration is inherited from the execution environment.A provider should return a map with entries only for schemes having default configuration; if no schemes do, an empty map should be returned.
- Returns:
- a mapping of schemes to default configuration
-
getConfigurationTemplate
FileConfiguration getConfigurationTemplate()
Returns a non-populated configuration object to server as a template that the user must fill-in.- Returns:
- a configuration template
-
-