Package org.apache.hadoop.fs
Class DelegateToFileSystem
java.lang.Object
org.apache.hadoop.fs.AbstractFileSystem
org.apache.hadoop.fs.DelegateToFileSystem
- All Implemented Interfaces:
PathCapabilities
- Direct Known Subclasses:
FtpFs,HarFs,RawLocalFs
Implementation of AbstractFileSystem based on the existing implementation of
FileSystem.-
Field Summary
FieldsFields inherited from class org.apache.hadoop.fs.AbstractFileSystem
statistics -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDelegateToFileSystem(URI theUri, FileSystem theFsImpl, Configuration conf, String supportedScheme, boolean authorityRequired) -
Method Summary
Modifier and TypeMethodDescriptioncreateInternal(Path f, EnumSet<CreateFlag> flag, FsPermission absolutePermission, int bufferSize, short replication, long blockSize, Progressable progress, Options.ChecksumOpt checksumOpt, boolean createParent) The specification of this method matches that ofAbstractFileSystem.create(Path, EnumSet, Options.CreateOpts...)except that the opts have been declared explicitly.voidcreateSymlink(Path target, Path link, boolean createParent) The specification of this method matches that ofFileContext.createSymlink(Path, Path, boolean);booleanThe specification of this method matches that ofFileContext.delete(Path, boolean)except that Path f must be for this file system.Get a canonical name for this file system.getDelegationTokens(String renewer) Get one or more delegation tokens associated with the filesystem.getFileBlockLocations(Path f, long start, long len) The specification of this method matches that ofFileContext.getFileBlockLocations(Path, long, long)except that Path f must be for this file system.The specification of this method matches that ofFileContext.getFileChecksum(Path)except that Path f must be for this file system.The specification of this method matches that ofFileContext.getFileLinkStatus(Path)except that an UnresolvedLinkException may be thrown if a symlink is encountered in the path leading up to the final path component.The specification of this method matches that ofFileContext.getFileStatus(Path)except that an UnresolvedLinkException may be thrown if a symlink is encountered in the path.The specification of this method matches that ofFileContext.getFsStatus(Path).getFsStatus(Path f) The specification of this method matches that ofFileContext.getFsStatus(Path)except that Path f must be for this file system.Return the current user's home directory in this file system.Some file systems like LocalFileSystem have an initial workingDir that is used as the starting workingDir.Partially resolves the path.Deprecated.Return a set of server default configuration values based on path.intThe default port of this file system.booleanhasPathCapability(Path path, String capability) Probe for a specific capability under the given path.listStatus(Path f) The specification of this method matches that ofFileContext.Util.listStatus(Path)except that Path f must be for this file system.voidmkdir(Path dir, FsPermission permission, boolean createParent) The specification of this method matches that ofFileContext.mkdir(Path, FsPermission, boolean)except that the Path f must be fully qualified and the permission is absolute (i.e.The specification of this method matches that ofFileContext.open(Path, int)except that Path f must be for this file system.openFileWithOptions(Path path, OpenFileParameters parameters) Open a file by delegating toFileSystem.openFileWithOptions(Path, org.apache.hadoop.fs.impl.OpenFileParameters).voidrenameInternal(Path src, Path dst) The specification of this method matches that ofFileContext.rename(Path, Path, Options.Rename...)except that Path f must be for this file system and NO OVERWRITE is performed.voidThe specification of this method matches that ofFileContext.setOwner(Path, String, String)except that Path f must be for this file system.voidsetPermission(Path f, FsPermission permission) The specification of this method matches that ofFileContext.setPermission(Path, FsPermission)except that Path f must be for this file system.booleansetReplication(Path f, short replication) The specification of this method matches that ofFileContext.setReplication(Path, short)except that Path f must be for this file system.voidThe specification of this method matches that ofFileContext.setTimes(Path, long, long)except that Path f must be for this file system.voidsetVerifyChecksum(boolean verifyChecksum) The specification of this method matches that ofFileContext.setVerifyChecksum(boolean, Path)except that Path f must be for this file system.booleanReturns true if the file system supports symlinks, false otherwise.booleanThe specification of this method matches that ofFileContext.truncate(Path, long)except that Path f must be for this file system.Methods inherited from class org.apache.hadoop.fs.AbstractFileSystem
access, checkPath, checkScheme, clearStatistics, create, createFileSystem, createMultipartUploader, createSnapshot, deleteSnapshot, equals, get, getAclStatus, getAllStatistics, getAllStoragePolicies, getEnclosingRoot, getStatistics, getStatistics, getStoragePolicy, getUri, getUriPath, getXAttr, getXAttrs, getXAttrs, hashCode, isValidName, listCorruptFileBlocks, listLocatedStatus, listStatusIterator, listXAttrs, makeQualified, methodNotSupported, modifyAclEntries, msync, open, printStatistics, removeAcl, removeAclEntries, removeDefaultAcl, removeXAttr, rename, renameInternal, renameSnapshot, resolvePath, satisfyStoragePolicy, setAcl, setStoragePolicy, setXAttr, setXAttr, unsetStoragePolicy
-
Field Details
-
fsImpl
-
-
Constructor Details
-
DelegateToFileSystem
protected DelegateToFileSystem(URI theUri, FileSystem theFsImpl, Configuration conf, String supportedScheme, boolean authorityRequired) throws IOException, URISyntaxException - Throws:
IOExceptionURISyntaxException
-
-
Method Details
-
getInitialWorkingDirectory
Description copied from class:AbstractFileSystemSome file systems like LocalFileSystem have an initial workingDir that is used as the starting workingDir. For other file systems like HDFS there is no built in notion of an initial workingDir.- Overrides:
getInitialWorkingDirectoryin classAbstractFileSystem- Returns:
- the initial workingDir if the file system has such a notion otherwise return a null.
-
createInternal
public FSDataOutputStream createInternal(Path f, EnumSet<CreateFlag> flag, FsPermission absolutePermission, int bufferSize, short replication, long blockSize, Progressable progress, Options.ChecksumOpt checksumOpt, boolean createParent) throws IOException Description copied from class:AbstractFileSystemThe specification of this method matches that ofAbstractFileSystem.create(Path, EnumSet, Options.CreateOpts...)except that the opts have been declared explicitly.- Specified by:
createInternalin classAbstractFileSystem- Parameters:
f- the path.flag- create flag.absolutePermission- absolute permission.bufferSize- buffer size.replication- replications.blockSize- block size.progress- progress.checksumOpt- check sum opt.createParent- create parent.- Returns:
- output stream.
- Throws:
AccessControlException- access control exception.FileAlreadyExistsException- file already exists exception.FileNotFoundException- file not found exception.ParentNotDirectoryException- parent not directory exception.UnsupportedFileSystemException- unsupported filesystem exception.UnresolvedLinkException- unresolved link exception.IOException- raised on errors performing I/O.
-
delete
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.delete(Path, boolean)except that Path f must be for this file system.- Specified by:
deletein classAbstractFileSystem- Parameters:
f- the path.recursive- recursive flag.- Returns:
- if successfully deleted success true, not false.
- Throws:
AccessControlException- access control exception.FileNotFoundException- file not found exception.UnresolvedLinkException- unresolved link exception.IOException- raised on errors performing I/O.
-
getFileBlockLocations
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.getFileBlockLocations(Path, long, long)except that Path f must be for this file system.- Specified by:
getFileBlockLocationsin classAbstractFileSystem- Parameters:
f- the path.start- start.len- length.- Returns:
- BlockLocation Array.
- Throws:
AccessControlException- access control exception.FileNotFoundException- file not found exception.UnresolvedLinkException- unresolved link exception.IOException- raised on errors performing I/O.
-
getFileChecksum
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.getFileChecksum(Path)except that Path f must be for this file system.- Specified by:
getFileChecksumin classAbstractFileSystem- Parameters:
f- the path.- Returns:
- File Check sum.
- Throws:
AccessControlException- access control exception.FileNotFoundException- file not found exception.UnresolvedLinkException- unresolved link exception.IOException- raised on errors performing I/O.
-
getFileStatus
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.getFileStatus(Path)except that an UnresolvedLinkException may be thrown if a symlink is encountered in the path.- Specified by:
getFileStatusin classAbstractFileSystem- Parameters:
f- the path.- Returns:
- File Status
- Throws:
AccessControlException- access control exception.FileNotFoundException- file not found exception.UnresolvedLinkException- unresolved link exception.IOException- raised on errors performing I/O.
-
getFileLinkStatus
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.getFileLinkStatus(Path)except that an UnresolvedLinkException may be thrown if a symlink is encountered in the path leading up to the final path component. If the file system does not support symlinks then the behavior is equivalent toAbstractFileSystem.getFileStatus(Path).- Overrides:
getFileLinkStatusin classAbstractFileSystem- Parameters:
f- the path.- Returns:
- file status.
- Throws:
AccessControlException- access control exception.FileNotFoundException- file not found exception.UnsupportedFileSystemException- UnSupported File System Exception.IOException- raised on errors performing I/O.
-
getFsStatus
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.getFsStatus(Path).- Specified by:
getFsStatusin classAbstractFileSystem- Returns:
- Fs Status.
- Throws:
AccessControlException- access control exception.FileNotFoundException- file not found exception.IOException- raised on errors performing I/O.
-
getFsStatus
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.getFsStatus(Path)except that Path f must be for this file system.- Overrides:
getFsStatusin classAbstractFileSystem- Parameters:
f- the path.- Returns:
- Fs Status.
- Throws:
AccessControlException- access control exception.FileNotFoundException- file not found exception.UnresolvedLinkException- unresolved link exception.IOException- raised on errors performing I/O.
-
getServerDefaults
Deprecated.Description copied from class:AbstractFileSystemReturn a set of server default configuration values.- Specified by:
getServerDefaultsin classAbstractFileSystem- Returns:
- server default configuration values
- Throws:
IOException- an I/O error occurred
-
getServerDefaults
Description copied from class:AbstractFileSystemReturn a set of server default configuration values based on path.- Overrides:
getServerDefaultsin classAbstractFileSystem- Parameters:
f- path to fetch server defaults- Returns:
- server default configuration values for path
- Throws:
IOException- an I/O error occurred
-
getHomeDirectory
Description copied from class:AbstractFileSystemReturn the current user's home directory in this file system. The default implementation returns "/user/$USER/".- Overrides:
getHomeDirectoryin classAbstractFileSystem- Returns:
- current user's home directory.
-
getUriDefaultPort
public int getUriDefaultPort()Description copied from class:AbstractFileSystemThe default port of this file system.- Specified by:
getUriDefaultPortin classAbstractFileSystem- Returns:
- default port of this file system's Uri scheme A uri with a port of -1 => default port;
-
listStatus
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.Util.listStatus(Path)except that Path f must be for this file system.- Specified by:
listStatusin classAbstractFileSystem- Parameters:
f- the path.- Returns:
- FileStatus Iterator.
- Throws:
AccessControlException- access control exception.FileNotFoundException- file not found exception.UnresolvedLinkException- unresolved link exception.IOException- raised on errors performing I/O.
-
mkdir
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.mkdir(Path, FsPermission, boolean)except that the Path f must be fully qualified and the permission is absolute (i.e. umask has been applied).- Specified by:
mkdirin classAbstractFileSystem- Parameters:
dir- directory.permission- permission.createParent- create parent flag.- Throws:
AccessControlException- access control exception.FileAlreadyExistsException- file already exists exception.FileNotFoundException- file not found exception.UnresolvedLinkException- unresolved link exception.IOException- raised on errors performing I/O.
-
open
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.open(Path, int)except that Path f must be for this file system.- Specified by:
openin classAbstractFileSystem- Parameters:
f- the path.bufferSize- buffer size.- Returns:
- if successfully open success true, not false.
- Throws:
AccessControlException- access control exception.FileNotFoundException- file not found exception.UnresolvedLinkException- unresolved link exception.IOException- raised on errors performing I/O.
-
truncate
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.truncate(Path, long)except that Path f must be for this file system.- Overrides:
truncatein classAbstractFileSystem- Parameters:
f- the path.newLength- new length.- Returns:
- if successfully truncate success true, not false.
- Throws:
AccessControlException- access control exception.FileNotFoundException- file not found exception.UnresolvedLinkException- unresolved link exception.IOException- raised on errors performing I/O.
-
renameInternal
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.rename(Path, Path, Options.Rename...)except that Path f must be for this file system and NO OVERWRITE is performed. File systems that do not have a built in overwrite need implement only this method and can take advantage of the default impl of the otherAbstractFileSystem.renameInternal(Path, Path, boolean)- Specified by:
renameInternalin classAbstractFileSystem- Parameters:
src- src.dst- dst.- Throws:
AccessControlException- access control exception.FileAlreadyExistsException- file already exists exception.FileNotFoundException- file not found exception.ParentNotDirectoryException- parent not directory exception.UnresolvedLinkException- unresolved link exception.IOException- raised on errors performing I/O.
-
setOwner
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.setOwner(Path, String, String)except that Path f must be for this file system.- Specified by:
setOwnerin classAbstractFileSystem- Parameters:
f- the path.username- username.groupname- groupname.- Throws:
AccessControlException- access control exception.FileNotFoundException- file not found exception.UnresolvedLinkException- unresolved link exception.IOException- raised on errors performing I/O.
-
setPermission
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.setPermission(Path, FsPermission)except that Path f must be for this file system.- Specified by:
setPermissionin classAbstractFileSystem- Parameters:
f- the path.permission- permission.- Throws:
AccessControlException- access control exception.FileNotFoundException- file not found exception.UnresolvedLinkException- unresolved link exception.IOException- raised on errors performing I/O.
-
setReplication
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.setReplication(Path, short)except that Path f must be for this file system.- Specified by:
setReplicationin classAbstractFileSystem- Parameters:
f- the path.replication- replication.- Returns:
- if successfully set replication success true, not false.
- Throws:
AccessControlException- access control exception.FileNotFoundException- file not found exception.UnresolvedLinkException- unresolved link exception.IOException- raised on errors performing I/O.
-
setTimes
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.setTimes(Path, long, long)except that Path f must be for this file system.- Specified by:
setTimesin classAbstractFileSystem- Parameters:
f- the path.mtime- modify time.atime- access time.- Throws:
AccessControlException- access control exception.FileNotFoundException- file not found exception.UnresolvedLinkException- unresolved link exception.IOException- raised on errors performing I/O.
-
setVerifyChecksum
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.setVerifyChecksum(boolean, Path)except that Path f must be for this file system.- Specified by:
setVerifyChecksumin classAbstractFileSystem- Parameters:
verifyChecksum- verify check sum flag.- Throws:
AccessControlException- access control exception.IOException- raised on errors performing I/O.
-
supportsSymlinks
public boolean supportsSymlinks()Description copied from class:AbstractFileSystemReturns true if the file system supports symlinks, false otherwise.- Overrides:
supportsSymlinksin classAbstractFileSystem- Returns:
- true if filesystem supports symlinks
-
createSymlink
Description copied from class:AbstractFileSystemThe specification of this method matches that ofFileContext.createSymlink(Path, Path, boolean);- Overrides:
createSymlinkin classAbstractFileSystem- Parameters:
target- target.link- link.createParent- create parent.- Throws:
IOException- raised on errors performing I/O.UnresolvedLinkException- unresolved link exception.
-
getLinkTarget
Description copied from class:AbstractFileSystemPartially resolves the path. This is used during symlink resolution inFSLinkResolver, and differs from the similarly named methodFileContext.getLinkTarget(Path).- Overrides:
getLinkTargetin classAbstractFileSystem- Parameters:
f- the path.- Returns:
- target path.
- Throws:
IOException- subclass implementations may throw IOException
-
getCanonicalServiceName
Description copied from class:AbstractFileSystemGet a canonical name for this file system.- Overrides:
getCanonicalServiceNamein classAbstractFileSystem- Returns:
- a URI string that uniquely identifies this file system
-
getDelegationTokens
Description copied from class:AbstractFileSystemGet one or more delegation tokens associated with the filesystem. Normally a file system returns a single delegation token. A file system that manages multiple file systems underneath, could return set of delegation tokens for all the file systems it manages- Overrides:
getDelegationTokensin classAbstractFileSystem- Parameters:
renewer- the account name that is allowed to renew the token.- Returns:
- List of delegation tokens. If delegation tokens not supported then return a list of size zero.
- Throws:
IOException- raised on errors performing I/O.
-
openFileWithOptions
public CompletableFuture<FSDataInputStream> openFileWithOptions(Path path, OpenFileParameters parameters) throws IOException Open a file by delegating toFileSystem.openFileWithOptions(Path, org.apache.hadoop.fs.impl.OpenFileParameters).- Overrides:
openFileWithOptionsin classAbstractFileSystem- Parameters:
path- path to the fileparameters- open file parameters from the builder.- Returns:
- a future which will evaluate to the opened file.ControlAlpha
- Throws:
IOException- failure to resolve the link.IllegalArgumentException- unknown mandatory key
-
hasPathCapability
Description copied from interface:PathCapabilitiesProbe for a specific capability under the given path. If the function returnstrue, this instance is explicitly declaring that the capability is available. If the function returnsfalse, it can mean one of:- The capability is not known.
- The capability is known but it is not supported.
- The capability is known but the filesystem does not know if it is supported under the supplied path.
Implementors:
PathCapabilitiesSupportcan be used to help implement this method.- Specified by:
hasPathCapabilityin interfacePathCapabilities- Overrides:
hasPathCapabilityin classAbstractFileSystem- Parameters:
path- path to query the capability of.capability- non-null, non-empty string to query the path for support.- Returns:
- true if the capability is supported under that part of the FS.
- Throws:
IOException- this should not be raised, except on problems resolving paths or relaying the call.
-