当前位置: 首页>>代码示例>>Java>>正文


Java FsPermission.toShort方法代码示例

本文整理汇总了Java中org.apache.hadoop.fs.permission.FsPermission.toShort方法的典型用法代码示例。如果您正苦于以下问题:Java FsPermission.toShort方法的具体用法?Java FsPermission.toShort怎么用?Java FsPermission.toShort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.fs.permission.FsPermission的用法示例。


在下文中一共展示了FsPermission.toShort方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mkdir

import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
private void mkdir(FileSystem fs, Path path, FsPermission fsp)
    throws IOException {
  if (!fs.exists(path)) {
    try {
      fs.mkdirs(path, fsp);
      FileStatus fsStatus = fs.getFileStatus(path);
      LOG.info("Perms after creating " + fsStatus.getPermission().toShort()
          + ", Expected: " + fsp.toShort());
      if (fsStatus.getPermission().toShort() != fsp.toShort()) {
        LOG.info("Explicitly setting permissions to : " + fsp.toShort()
            + ", " + fsp);
        fs.setPermission(path, fsp);
      }
    } catch (FileAlreadyExistsException e) {
      LOG.info("Directory: [" + path + "] already exists.");
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:JobHistoryEventHandler.java

示例2: mkdir

import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
private void mkdir(FileContext fc, Path path, FsPermission fsp)
    throws IOException {
  if (!fc.util().exists(path)) {
    try {
      fc.mkdir(path, fsp, true);

      FileStatus fsStatus = fc.getFileStatus(path);
      LOG.info("Perms after creating " + fsStatus.getPermission().toShort()
          + ", Expected: " + fsp.toShort());
      if (fsStatus.getPermission().toShort() != fsp.toShort()) {
        LOG.info("Explicitly setting permissions to : " + fsp.toShort()
            + ", " + fsp);
        fc.setPermission(path, fsp);
      }
    } catch (FileAlreadyExistsException e) {
      LOG.info("Directory: [" + path + "] already exists.");
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:HistoryFileManager.java

示例3: makeDoneSubdir

import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
private void makeDoneSubdir(Path path) throws IOException {
  try {
    doneDirFc.getFileStatus(path);
    existingDoneSubdirs.add(path);
  } catch (FileNotFoundException fnfE) {
    try {
      FsPermission fsp = new FsPermission(
          JobHistoryUtils.HISTORY_DONE_DIR_PERMISSION);
      doneDirFc.mkdir(path, fsp, true);
      FileStatus fsStatus = doneDirFc.getFileStatus(path);
      LOG.info("Perms after creating " + fsStatus.getPermission().toShort()
          + ", Expected: " + fsp.toShort());
      if (fsStatus.getPermission().toShort() != fsp.toShort()) {
        LOG.info("Explicitly setting permissions to : " + fsp.toShort()
            + ", " + fsp);
        doneDirFc.setPermission(path, fsp);
      }
      existingDoneSubdirs.add(path);
    } catch (FileAlreadyExistsException faeE) { // Nothing to do.
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:HistoryFileManager.java

示例4: createAndCheckPermission

import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
private void createAndCheckPermission(OpType op, Path name, short umask,
    FsPermission permission, boolean delete) throws Exception {
  // create the file/directory
  create(op, name, umask, permission);

  // get the short form of the permission
  short permissionNum = (DEFAULT_PERMISSION.equals(permission)) ? MAX_PERMISSION
      : permission.toShort();

  // get the expected permission
  short expectedPermission = (op == OpType.CREATE) ? (short) (~umask
      & permissionNum) : (short) (~umask & permissionNum);

  // check if permission is correctly set
  checkPermission(name, expectedPermission, delete);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:TestDFSPermission.java

示例5: FsPermissionExtension

import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
/**
 * Constructs a new FsPermissionExtension based on the given FsPermission.
 *
 * @param perm FsPermission containing permission bits
 */
public FsPermissionExtension(FsPermission perm, boolean hasAcl,
    boolean isEncrypted) {
  super(perm.toShort());
  aclBit = hasAcl;
  encryptedBit = isEncrypted;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:FsPermissionExtension.java

示例6: setPermission

import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
@Override
void setPermission(FsPermission permission) {
  final short mode = permission.toShort();
  updatePermissionStatus(PermissionStatusFormat.MODE, mode);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:6,代码来源:INodeWithAdditionalFields.java

示例7: PermissionParam

import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
/**
 * Constructor.
 * @param value the parameter value.
 */
public PermissionParam(final FsPermission value) {
  super(DOMAIN, value == null? null: value.toShort(), null, null);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:PermissionParam.java


注:本文中的org.apache.hadoop.fs.permission.FsPermission.toShort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。