Example usage for org.apache.hadoop.fs.permission FsPermission applyUMask

List of usage examples for org.apache.hadoop.fs.permission FsPermission applyUMask

Introduction

In this page you can find the example usage for org.apache.hadoop.fs.permission FsPermission applyUMask.

Prototype

public FsPermission applyUMask(FsPermission umask) 

Source Link

Document

Apply a umask to this permission and return a new one.

Usage

From source file:com.bigstep.datalake.DLFileSystem.java

License:Apache License

private FsPermission applyUMask(FsPermission permission) {
    if (permission == null) {
        permission = new FsPermission(this.defaultFilePermissions);
    }/*w ww .j a v a  2  s  . c  o  m*/
    FsPermission umask = new FsPermission(this.defaultUMask);
    LOG.info("permission = " + permission + " and umask=" + umask);
    return permission.applyUMask(umask);
}

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

License:Apache License

/**
 * Same as {@link #create(String, FsPermission, EnumSet, boolean, short, long, Progressable, int, ChecksumOpt)} with the addition of favoredNodes
 * that is//from   w w w .j a  va2s  .  c  o  m
 * a hint to where the namenode should place the file blocks.
 * The favored nodes hint is not persisted in HDFS. Hence it may be honored
 * at the creation time only. HDFS could move the blocks during balancing or
 * replication, to move the blocks from favored nodes. A value of null means
 * no favored nodes for this create
 */
public DFSOutputStream create(String src, FsPermission permission, EnumSet<CreateFlag> flag,
        boolean createParent, short replication, long blockSize, Progressable progress, int buffersize,
        ChecksumOpt checksumOpt, InetSocketAddress[] favoredNodes) throws IOException {
    checkOpen();
    if (permission == null) {
        permission = FsPermission.getFileDefault();
    }
    FsPermission masked = permission.applyUMask(dfsClientConf.getuMask());
    if (LOG.isDebugEnabled()) {
        LOG.debug(src + ": masked=" + masked);
    }
    final DFSOutputStream result = DFSOutputStream.newStreamForCreate(this, src, masked, flag, createParent,
            replication, blockSize, progress, buffersize, dfsClientConf.createChecksum(checksumOpt),
            getFavoredNodesStr(favoredNodes));
    beginFileLease(result.getFileId(), result);
    return result;
}

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

License:Apache License

/**
 * Create a directory (or hierarchy of directories) with the given
 * name and permission./*from   ww w.j  ava  2s. co  m*/
 * 
 * @param src
 *            The path of the directory being created
 * @param permission
 *            The permission of the directory being created.
 *            If permission == null, use {@link FsPermission#getDefault()}.
 * @param createParent
 *            create missing parent directory if true
 * 
 * @return True if the operation success.
 * 
 * @see ClientProtocol#mkdirs(String, FsPermission, boolean)
 */
public boolean mkdirs(String src, FsPermission permission, boolean createParent) throws IOException {
    if (permission == null) {
        permission = FsPermission.getDefault();
    }
    FsPermission masked = permission.applyUMask(dfsClientConf.getuMask());
    return primitiveMkdir(src, masked, createParent);
}

From source file:oz.hadoop.yarn.test.cluster.InJvmContainerExecutor.java

License:Apache License

/**
 * Copied from super class/*from   w  ww.j  a  va2s .com*/
 */
private void createDir(Path dirPath, FsPermission perms, boolean createParent) throws IOException {
    fc.mkdir(dirPath, perms, createParent);
    if (!perms.equals(perms.applyUMask(fc.getUMask()))) {
        fc.setPermission(dirPath, perms);
    }
}