use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.
the class WebHdfsFileSystem method createNonRecursive.
@Override
public FSDataOutputStream createNonRecursive(final Path f, final FsPermission permission, final EnumSet<CreateFlag> flag, final int bufferSize, final short replication, final long blockSize, final Progressable progress) throws IOException {
statistics.incrementWriteOps(1);
storageStatistics.incrementOpCounter(OpType.CREATE_NON_RECURSIVE);
final FsPermission modes = applyUMask(permission);
final HttpOpParam.Op op = PutOpParam.Op.CREATE;
return new FsPathOutputStreamRunner(op, f, bufferSize, new PermissionParam(modes.getMasked()), new UnmaskedPermissionParam(modes.getUnmasked()), new CreateFlagParam(flag), new CreateParentParam(false), new BufferSizeParam(bufferSize), new ReplicationParam(replication), new BlockSizeParam(blockSize)).run();
}
use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.
the class WebHdfsFileSystem method getHomeDirectory.
@Override
public Path getHomeDirectory() {
if (cachedHomeDirectory == null) {
final HttpOpParam.Op op = GetOpParam.Op.GETHOMEDIRECTORY;
try {
String pathFromDelegatedFS = new FsPathResponseRunner<String>(op, null, new UserParam(ugi)) {
@Override
String decodeResponse(Map<?, ?> json) throws IOException {
return JsonUtilClient.getPath(json);
}
}.run();
cachedHomeDirectory = new Path(pathFromDelegatedFS).makeQualified(this.getUri(), null);
} catch (IOException e) {
LOG.error("Unable to get HomeDirectory from original File System", e);
cachedHomeDirectory = new Path("/user/" + ugi.getShortUserName()).makeQualified(this.getUri(), null);
}
}
return cachedHomeDirectory;
}
use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.
the class WebHdfsFileSystem method setPermission.
@Override
public void setPermission(final Path p, final FsPermission permission) throws IOException {
statistics.incrementWriteOps(1);
storageStatistics.incrementOpCounter(OpType.SET_PERMISSION);
final HttpOpParam.Op op = PutOpParam.Op.SETPERMISSION;
new FsPathRunner(op, p, new PermissionParam(permission)).run();
}
use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.
the class WebHdfsFileSystem method rename.
@SuppressWarnings("deprecation")
@Override
public void rename(final Path src, final Path dst, final Options.Rename... options) throws IOException {
statistics.incrementWriteOps(1);
storageStatistics.incrementOpCounter(OpType.RENAME);
final HttpOpParam.Op op = PutOpParam.Op.RENAME;
new FsPathRunner(op, src, new DestinationParam(makeQualified(dst).toUri().getPath()), new RenameOptionSetParam(options)).run();
}
use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.
the class WebHdfsFileSystem method setAcl.
@Override
public void setAcl(final Path p, final List<AclEntry> aclSpec) throws IOException {
statistics.incrementWriteOps(1);
storageStatistics.incrementOpCounter(OpType.SET_ACL);
final HttpOpParam.Op op = PutOpParam.Op.SETACL;
new FsPathRunner(op, p, new AclPermissionParam(aclSpec)).run();
}
Aggregations