use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.
the class WebHdfsFileSystem method removeAclEntries.
@Override
public void removeAclEntries(Path path, List<AclEntry> aclSpec) throws IOException {
statistics.incrementWriteOps(1);
storageStatistics.incrementOpCounter(OpType.REMOVE_ACL_ENTRIES);
final HttpOpParam.Op op = PutOpParam.Op.REMOVEACLENTRIES;
new FsPathRunner(op, path, new AclPermissionParam(aclSpec)).run();
}
use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.
the class WebHdfsFileSystem method getXAttr.
@Override
public byte[] getXAttr(Path p, final String name) throws IOException {
statistics.incrementReadOps(1);
storageStatistics.incrementOpCounter(OpType.GET_XATTR);
final HttpOpParam.Op op = GetOpParam.Op.GETXATTRS;
return new FsPathResponseRunner<byte[]>(op, p, new XAttrNameParam(name), new XAttrEncodingParam(XAttrCodec.HEX)) {
@Override
byte[] decodeResponse(Map<?, ?> json) throws IOException {
return JsonUtilClient.getXAttr(json);
}
}.run();
}
use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.
the class WebHdfsFileSystem method getDelegationToken.
@Override
public Token<DelegationTokenIdentifier> getDelegationToken(final String renewer) throws IOException {
final HttpOpParam.Op op = GetOpParam.Op.GETDELEGATIONTOKEN;
Token<DelegationTokenIdentifier> token = new FsPathResponseRunner<Token<DelegationTokenIdentifier>>(op, null, new RenewerParam(renewer)) {
@Override
Token<DelegationTokenIdentifier> decodeResponse(Map<?, ?> json) throws IOException {
return JsonUtilClient.toDelegationToken(json);
}
}.run();
if (token != null) {
token.setService(tokenServiceName);
} else {
if (disallowFallbackToInsecureCluster) {
throw new AccessControlException(CANT_FALLBACK_TO_INSECURE_MSG);
}
}
return token;
}
use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.
the class WebHdfsFileSystem method deleteSnapshot.
@Override
public void deleteSnapshot(final Path path, final String snapshotName) throws IOException {
statistics.incrementWriteOps(1);
storageStatistics.incrementOpCounter(OpType.DELETE_SNAPSHOT);
final HttpOpParam.Op op = DeleteOpParam.Op.DELETESNAPSHOT;
new FsPathRunner(op, path, new SnapshotNameParam(snapshotName)).run();
}
use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.
the class WebHdfsFileSystem method getXAttrs.
@Override
public Map<String, byte[]> getXAttrs(Path p, final List<String> names) throws IOException {
Preconditions.checkArgument(names != null && !names.isEmpty(), "XAttr names cannot be null or empty.");
Param<?, ?>[] parameters = new Param<?, ?>[names.size() + 1];
for (int i = 0; i < parameters.length - 1; i++) {
parameters[i] = new XAttrNameParam(names.get(i));
}
parameters[parameters.length - 1] = new XAttrEncodingParam(XAttrCodec.HEX);
final HttpOpParam.Op op = GetOpParam.Op.GETXATTRS;
return new FsPathResponseRunner<Map<String, byte[]>>(op, parameters, p) {
@Override
Map<String, byte[]> decodeResponse(Map<?, ?> json) throws IOException {
return JsonUtilClient.toXAttrs(json);
}
}.run();
}
Aggregations