Example usage for org.apache.hadoop.fs FileStatus setSymlink

List of usage examples for org.apache.hadoop.fs FileStatus setSymlink

Introduction

In this page you can find the example usage for org.apache.hadoop.fs FileStatus setSymlink.

Prototype

public void setSymlink(final Path p) 

Source Link

Usage

From source file:com.mellanox.r4h.DistributedFileSystem.java

License:Apache License

@Override
public FileStatus getFileLinkStatus(final Path f)
        throws AccessControlException, FileNotFoundException, UnsupportedFileSystemException, IOException {
    statistics.incrementReadOps(1);//from  www. java2 s  .c  o m
    final Path absF = fixRelativePart(f);
    FileStatus status = new FileSystemLinkResolver<FileStatus>() {
        @Override
        public FileStatus doCall(final Path p) throws IOException, UnresolvedLinkException {
            HdfsFileStatus fi = dfs.getFileLinkInfo(getPathName(p));
            if (fi != null) {
                return fi.makeQualified(getUri(), p);
            } else {
                throw new FileNotFoundException("File does not exist: " + p);
            }
        }

        @Override
        public FileStatus next(final FileSystem fs, final Path p) throws IOException, UnresolvedLinkException {
            return fs.getFileLinkStatus(p);
        }
    }.resolve(this, absF);
    // Fully-qualify the symlink
    if (status.isSymlink()) {
        Path targetQual = FSLinkResolver.qualifySymlinkTarget(this.getUri(), status.getPath(),
                status.getSymlink());
        status.setSymlink(targetQual);
    }
    return status;
}