Search in sources :

Example 31 with Op

use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.

the class WebHdfsFileSystem method access.

@Override
public void access(final Path path, final FsAction mode) throws IOException {
    final HttpOpParam.Op op = GetOpParam.Op.CHECKACCESS;
    new FsPathRunner(op, path, new FsActionParam(mode)).run();
}
Also used : Op(org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op)

Example 32 with Op

use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.

the class WebHdfsFileSystem method setStoragePolicy.

@Override
public void setStoragePolicy(Path p, String policyName) throws IOException {
    if (policyName == null) {
        throw new IOException("policyName == null");
    }
    statistics.incrementWriteOps(1);
    storageStatistics.incrementOpCounter(OpType.SET_STORAGE_POLICY);
    final HttpOpParam.Op op = PutOpParam.Op.SETSTORAGEPOLICY;
    new FsPathRunner(op, p, new StoragePolicyParam(policyName)).run();
}
Also used : Op(org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op) IOException(java.io.IOException)

Example 33 with Op

use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.

the class WebHdfsFileSystem method cancelDelegationToken.

@Override
public synchronized void cancelDelegationToken(final Token<?> token) throws IOException {
    final HttpOpParam.Op op = PutOpParam.Op.CANCELDELEGATIONTOKEN;
    new FsPathRunner(op, null, new TokenArgumentParam(token.encodeToUrlString())).run();
}
Also used : Op(org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op)

Example 34 with Op

use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.

the class WebHdfsFileSystem method createSymlink.

/**
   * Create a symlink pointing to the destination path.
   */
public void createSymlink(Path destination, Path f, boolean createParent) throws IOException {
    statistics.incrementWriteOps(1);
    storageStatistics.incrementOpCounter(OpType.CREATE_SYM_LINK);
    final HttpOpParam.Op op = PutOpParam.Op.CREATESYMLINK;
    new FsPathRunner(op, f, new DestinationParam(makeQualified(destination).toUri().getPath()), new CreateParentParam(createParent)).run();
}
Also used : Op(org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op)

Example 35 with Op

use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.

the class WebHdfsFileSystem method listStatus.

@Override
public FileStatus[] listStatus(final Path f) throws IOException {
    statistics.incrementReadOps(1);
    storageStatistics.incrementOpCounter(OpType.LIST_STATUS);
    final HttpOpParam.Op op = GetOpParam.Op.LISTSTATUS;
    return new FsPathResponseRunner<FileStatus[]>(op, f) {

        @Override
        FileStatus[] decodeResponse(Map<?, ?> json) {
            HdfsFileStatus[] hdfsStatuses = JsonUtilClient.toHdfsFileStatusArray(json);
            final FileStatus[] statuses = new FileStatus[hdfsStatuses.length];
            for (int i = 0; i < hdfsStatuses.length; i++) {
                statuses[i] = makeQualified(hdfsStatuses[i], f);
            }
            return statuses;
        }
    }.run();
}
Also used : Op(org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op)

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