Class FSLinkResolver<T>

java.lang.Object
org.apache.hadoop.fs.FSLinkResolver<T>
Direct Known Subclasses:
FsLinkResolution

@Private @Evolving public abstract class FSLinkResolver<T> extends Object
Used primarily by FileContext to operate on and resolve symlinks in a path. Operations can potentially span multiple AbstractFileSystems.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract T
    Generic helper function overridden on instantiation to perform a specific operation on the given file system using the given path which may result in an UnresolvedLinkException.
    static Path
    qualifySymlinkTarget(URI pathURI, Path pathWithLink, Path target)
    Return a fully-qualified version of the given symlink target if it has no scheme and authority.
    Performs the operation specified by the next function, calling it repeatedly until all symlinks in the given path are resolved.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FSLinkResolver

      public FSLinkResolver()
  • Method Details

    • qualifySymlinkTarget

      public static Path qualifySymlinkTarget(URI pathURI, Path pathWithLink, Path target)
      Return a fully-qualified version of the given symlink target if it has no scheme and authority. Partially and fully-qualified paths are returned unmodified.
      Parameters:
      pathURI - URI of the filesystem of pathWithLink
      pathWithLink - Path that contains the symlink
      target - The symlink's absolute target
      Returns:
      Fully qualified version of the target.
    • next

      public abstract T next(AbstractFileSystem fs, Path p) throws IOException, UnresolvedLinkException
      Generic helper function overridden on instantiation to perform a specific operation on the given file system using the given path which may result in an UnresolvedLinkException.
      Parameters:
      fs - AbstractFileSystem to perform the operation on.
      p - Path given the file system.
      Returns:
      Generic type determined by the specific implementation.
      Throws:
      UnresolvedLinkException - If symbolic link path could not be resolved
      IOException - an I/O error occurred
    • resolve

      public T resolve(FileContext fc, Path path) throws IOException
      Performs the operation specified by the next function, calling it repeatedly until all symlinks in the given path are resolved.
      Parameters:
      fc - FileContext used to access file systems.
      path - The path to resolve symlinks on.
      Returns:
      Generic type determined by the implementation of next.
      Throws:
      IOException - raised on errors performing I/O.