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

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

Introduction

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

Prototype

@VisibleForTesting
    public static boolean areSymlinksEnabled() 

Source Link

Usage

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

License:Apache License

@SuppressWarnings("deprecation")
@Override//from www.  j  a v  a  2s.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);
}