本文整理汇总了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.");
}
}
}
示例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.");
}
}
}
示例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.
}
}
}
示例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);
}
示例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;
}
示例6: setPermission
import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
@Override
void setPermission(FsPermission permission) {
final short mode = permission.toShort();
updatePermissionStatus(PermissionStatusFormat.MODE, mode);
}
示例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);
}