本文整理汇总了Java中org.apache.hadoop.fs.permission.FsPermission.getUMask方法的典型用法代码示例。如果您正苦于以下问题:Java FsPermission.getUMask方法的具体用法?Java FsPermission.getUMask怎么用?Java FsPermission.getUMask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.fs.permission.FsPermission
的用法示例。
在下文中一共展示了FsPermission.getUMask方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FileContext
import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
private FileContext(final AbstractFileSystem defFs,
final FsPermission theUmask, final Configuration aConf) {
defaultFS = defFs;
umask = FsPermission.getUMask(aConf);
conf = aConf;
tracer = FsTracer.get(aConf);
try {
ugi = UserGroupInformation.getCurrentUser();
} catch (IOException e) {
LOG.error("Exception in getCurrentUser: ",e);
throw new RuntimeException("Failed to get the current user " +
"while creating a FileContext", e);
}
/*
* Init the wd.
* WorkingDir is implemented at the FileContext layer
* NOT at the AbstractFileSystem layer.
* If the DefaultFS, such as localFilesystem has a notion of
* builtin WD, we use that as the initial WD.
* Otherwise the WD is initialized to the home directory.
*/
workingDir = defaultFS.getInitialWorkingDirectory();
if (workingDir == null) {
workingDir = defaultFS.getHomeDirectory();
}
resolveSymlinks = conf.getBoolean(
CommonConfigurationKeys.FS_CLIENT_RESOLVE_REMOTE_SYMLINKS_KEY,
CommonConfigurationKeys.FS_CLIENT_RESOLVE_REMOTE_SYMLINKS_DEFAULT);
util = new Util(); // for the inner class
}
示例2: createDir
import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
private void createDir(FileSystem fs, Path path, FsPermission fsPerm)
throws IOException {
FsPermission dirPerm = new FsPermission(fsPerm);
fs.mkdirs(path, dirPerm);
FsPermission umask = FsPermission.getUMask(fs.getConf());
if (!dirPerm.equals(dirPerm.applyUMask(umask))) {
fs.setPermission(path, new FsPermission(fsPerm));
}
}
示例3: FileContext
import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
private FileContext(final AbstractFileSystem defFs,
final FsPermission theUmask, final Configuration aConf) {
defaultFS = defFs;
umask = FsPermission.getUMask(aConf);
conf = aConf;
try {
ugi = UserGroupInformation.getCurrentUser();
} catch (IOException e) {
LOG.error("Exception in getCurrentUser: ",e);
throw new RuntimeException("Failed to get the current user " +
"while creating a FileContext", e);
}
/*
* Init the wd.
* WorkingDir is implemented at the FileContext layer
* NOT at the AbstractFileSystem layer.
* If the DefaultFS, such as localFilesystem has a notion of
* builtin WD, we use that as the initial WD.
* Otherwise the WD is initialized to the home directory.
*/
workingDir = defaultFS.getInitialWorkingDirectory();
if (workingDir == null) {
workingDir = defaultFS.getHomeDirectory();
}
resolveSymlinks = conf.getBoolean(
CommonConfigurationKeys.FS_CLIENT_RESOLVE_REMOTE_SYMLINKS_KEY,
CommonConfigurationKeys.FS_CLIENT_RESOLVE_REMOTE_SYMLINKS_DEFAULT);
util = new Util(); // for the inner class
}
示例4: initialize
import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
@Override
public void initialize(URI uri, Configuration conf) throws IOException {
super.initialize(uri, conf);
setConf(conf);
umask = FsPermission.getUMask(conf);
}
示例5: create
import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
@Override
public FSDataOutputStream create(Path f, EnumSet<CreateFlag> createFlag,
CreateOpts... opts) throws AccessControlException,
FileAlreadyExistsException, FileNotFoundException,
ParentNotDirectoryException, UnsupportedFileSystemException, IOException {
// Need to translate the FileContext-style options into FileSystem-style
// Permissions with umask
CreateOpts.Perms permOpt = CreateOpts.getOpt(
CreateOpts.Perms.class, opts);
FsPermission umask = FsPermission.getUMask(fs.getConf());
FsPermission permission = (permOpt != null) ? permOpt.getValue()
: FsPermission.getFileDefault().applyUMask(umask);
permission = permission.applyUMask(umask);
// Overwrite
boolean overwrite = createFlag.contains(CreateFlag.OVERWRITE);
// bufferSize
int bufferSize = fs.getConf().getInt(
CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_KEY,
CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_DEFAULT);
CreateOpts.BufferSize bufOpt = CreateOpts.getOpt(
CreateOpts.BufferSize.class, opts);
bufferSize = (bufOpt != null) ? bufOpt.getValue() : bufferSize;
// replication
short replication = fs.getDefaultReplication(f);
CreateOpts.ReplicationFactor repOpt =
CreateOpts.getOpt(CreateOpts.ReplicationFactor.class, opts);
replication = (repOpt != null) ? repOpt.getValue() : replication;
// blockSize
long blockSize = fs.getDefaultBlockSize(f);
CreateOpts.BlockSize blockOpt = CreateOpts.getOpt(
CreateOpts.BlockSize.class, opts);
blockSize = (blockOpt != null) ? blockOpt.getValue() : blockSize;
// Progressable
Progressable progress = null;
CreateOpts.Progress progressOpt = CreateOpts.getOpt(
CreateOpts.Progress.class, opts);
progress = (progressOpt != null) ? progressOpt.getValue() : progress;
return fs.create(f, permission, overwrite, bufferSize, replication,
blockSize, progress);
}
示例6: getFileContext
import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
/**
* Create a FileContext with specified FS as default using the specified
* config.
*
* @param defFS
* @param aConf
* @return new FileContext with specified FS as default.
*/
public static FileContext getFileContext(final AbstractFileSystem defFS,
final Configuration aConf) {
return new FileContext(defFS, FsPermission.getUMask(aConf), aConf);
}
示例7: getFileContext
import org.apache.hadoop.fs.permission.FsPermission; //导入方法依赖的package包/类
/**
* Create a FileContext with specified FS as default using the specified
* config.
*
* @param defFS
* @param aConf
* @return new FileContext with specifed FS as default.
*/
public static FileContext getFileContext(final AbstractFileSystem defFS,
final Configuration aConf) {
return new FileContext(defFS, FsPermission.getUMask(aConf), aConf);
}