Example usage for org.apache.hadoop.fs FileSystem createSymlink

List of usage examples for org.apache.hadoop.fs FileSystem createSymlink

Introduction

In this page you can find the example usage for org.apache.hadoop.fs FileSystem createSymlink.

Prototype

public void createSymlink(final Path target, final Path link, final boolean createParent)
        throws AccessControlException, FileAlreadyExistsException, FileNotFoundException,
        ParentNotDirectoryException, UnsupportedFileSystemException, IOException 

Source Link

Document

See FileContext#createSymlink(Path,Path,boolean) .

Usage

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

License:Apache License

@SuppressWarnings("deprecation")
@Override//  w ww .  j  a  v  a2s.c  om
public void createSymlink(final Path target, final Path link, final boolean createParent)
        throws AccessControlException, FileAlreadyExistsException, FileNotFoundException,
        ParentNotDirectoryException, UnsupportedFileSystemException, IOException {
    if (!FileSystem.areSymlinksEnabled()) {
        throw new UnsupportedOperationException("Symlinks not supported");
    }
    statistics.incrementWriteOps(1);
    final Path absF = fixRelativePart(link);
    new FileSystemLinkResolver<Void>() {
        @Override
        public Void doCall(final Path p) throws IOException, UnresolvedLinkException {
            dfs.createSymlink(target.toString(), getPathName(p), createParent);
            return null;
        }

        @Override
        public Void next(final FileSystem fs, final Path p) throws IOException, UnresolvedLinkException {
            fs.createSymlink(target, p, createParent);
            return null;
        }
    }.resolve(this, absF);
}

From source file:org.apache.oozie.util.FSUtils.java

License:Apache License

public static void createSymlink(FileSystem fs, Path target, Path link, boolean createParent)
        throws IOException {
    fs.createSymlink(target, link, createParent);
}