當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。