public class HdfsUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
HdfsUtils.HadoopFileStatus |
| Constructor and Description |
|---|
HdfsUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkFileAccess(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.FileStatus stat,
org.apache.hadoop.fs.permission.FsAction action)
Check the permissions on a file.
|
static long |
getFileId(org.apache.hadoop.fs.FileSystem fs,
String path) |
static org.apache.hadoop.fs.Path |
getFileIdPath(org.apache.hadoop.fs.FileSystem fileSystem,
org.apache.hadoop.fs.Path path,
long fileId) |
static boolean |
isPathEncrypted(org.apache.hadoop.conf.Configuration conf,
URI fsUri,
org.apache.hadoop.fs.Path path) |
static boolean |
runDistCp(List<org.apache.hadoop.fs.Path> srcPaths,
org.apache.hadoop.fs.Path dst,
org.apache.hadoop.conf.Configuration conf) |
static boolean |
runDistCpAs(List<org.apache.hadoop.fs.Path> srcPaths,
org.apache.hadoop.fs.Path dst,
org.apache.hadoop.conf.Configuration conf,
String doAsUser) |
static void |
setFullFileStatus(org.apache.hadoop.conf.Configuration conf,
HdfsUtils.HadoopFileStatus sourceStatus,
String targetGroup,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path target,
boolean recursion)
Copy the permissions, group, and ACLs from a source
HdfsUtils.HadoopFileStatus to a target Path. |
public static void checkFileAccess(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.FileStatus stat,
org.apache.hadoop.fs.permission.FsAction action)
throws IOException,
LoginException
fs - Filesystem the file is contained instat - Stat info for the fileaction - action to be performedIOException - If thrown by Hadooporg.apache.hadoop.security.AccessControlException - if the file cannot be accessedLoginExceptionpublic static boolean isPathEncrypted(org.apache.hadoop.conf.Configuration conf,
URI fsUri,
org.apache.hadoop.fs.Path path)
throws IOException
IOExceptionpublic static boolean runDistCpAs(List<org.apache.hadoop.fs.Path> srcPaths, org.apache.hadoop.fs.Path dst, org.apache.hadoop.conf.Configuration conf, String doAsUser) throws IOException
IOExceptionpublic static boolean runDistCp(List<org.apache.hadoop.fs.Path> srcPaths, org.apache.hadoop.fs.Path dst, org.apache.hadoop.conf.Configuration conf) throws IOException
IOExceptionpublic static org.apache.hadoop.fs.Path getFileIdPath(org.apache.hadoop.fs.FileSystem fileSystem,
org.apache.hadoop.fs.Path path,
long fileId)
public static long getFileId(org.apache.hadoop.fs.FileSystem fs,
String path)
throws IOException
IOExceptionpublic static void setFullFileStatus(org.apache.hadoop.conf.Configuration conf,
HdfsUtils.HadoopFileStatus sourceStatus,
String targetGroup,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path target,
boolean recursion)
HdfsUtils.HadoopFileStatus to a target Path. This method
will only log a warning if permissions cannot be set, no exception will be thrown.conf - the Configuration used when setting permissions and ACLssourceStatus - the source HdfsUtils.HadoopFileStatus to copy permissions and ACLs fromtargetGroup - the group of the target Path, if this is set and it is equal to the source group, an
extra set group operation is avoidedfs - the FileSystem that contains the target Pathtarget - the Path to copy permissions, group, and ACLs torecursion - recursively set permissions and ACLs on the target PathCopyright © 2019 The Apache Software Foundation. All Rights Reserved.