Search in sources :

Example 1 with Op

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();
}
Also used : Op(org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op)

Example 2 with Op

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();
}
Also used : Op(org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op) IOException(java.io.IOException)

Example 3 with Op

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;
}
Also used : DelegationTokenIdentifier(org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier) Op(org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op) AccessControlException(org.apache.hadoop.security.AccessControlException) InvalidToken(org.apache.hadoop.security.token.SecretManager.InvalidToken) Token(org.apache.hadoop.security.token.Token) IOException(java.io.IOException)

Example 4 with Op

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();
}
Also used : Op(org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op)

Example 5 with Op

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();
}
Also used : Op(org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op) IOException(java.io.IOException) Map(java.util.Map)

Aggregations

Op (org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op)40 IOException (java.io.IOException)8 Path (org.apache.hadoop.fs.Path)3 FsPermission (org.apache.hadoop.fs.permission.FsPermission)3 FileNotFoundException (java.io.FileNotFoundException)2 Map (java.util.Map)1 ContentSummary (org.apache.hadoop.fs.ContentSummary)1 MD5MD5CRC32FileChecksum (org.apache.hadoop.fs.MD5MD5CRC32FileChecksum)1 AclStatus (org.apache.hadoop.fs.permission.AclStatus)1 HdfsFileStatus (org.apache.hadoop.hdfs.protocol.HdfsFileStatus)1 DelegationTokenIdentifier (org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier)1 AccessControlException (org.apache.hadoop.security.AccessControlException)1 InvalidToken (org.apache.hadoop.security.token.SecretManager.InvalidToken)1 Token (org.apache.hadoop.security.token.Token)1