From 8acdf5c2742c081f3e0e96e13eb940a39964a58f Mon Sep 17 00:00:00 2001 From: Arpit Agarwal Date: Wed, 11 Oct 2017 12:29:35 -0700 Subject: [PATCH] HDFS-12542. Update javadoc and documentation for listStatus. Contributed by Ajay Kumar. --- .../hadoop/hdfs/web/WebHdfsFileSystem.java | 16 ++++++++++++++++ .../fs/http/client/HttpFSFileSystem.java | 18 ++++++++++++------ .../hadoop-hdfs/src/site/markdown/WebHDFS.md | 5 +++++ 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java index d3a8b2371c..0fb6f225ca 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java @@ -1495,6 +1495,15 @@ protected URL getResolvedUrl(final HttpURLConnection connection } } + /** + * Get {@link FileStatus} of files/directories in the given path. If path + * corresponds to a file then {@link FileStatus} of that file is returned. + * Else if path represents a directory then {@link FileStatus} of all + * files/directories inside given path is returned. + * + * @param f given path + * @return the statuses of the files/directories in the given path + */ @Override public FileStatus[] listStatus(final Path f) throws IOException { statistics.incrementReadOps(1); @@ -1519,6 +1528,13 @@ FileStatus[] decodeResponse(Map json) { private static final byte[] EMPTY_ARRAY = new byte[] {}; + /** + * Get DirectoryEntries of the given path. DirectoryEntries contains an array + * of {@link FileStatus}, as well as iteration information. + * + * @param f given path + * @return DirectoryEntries for given path + */ @Override public DirectoryEntries listStatusBatch(Path f, byte[] token) throws FileNotFoundException, IOException { diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/client/HttpFSFileSystem.java b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/client/HttpFSFileSystem.java index 3ff7a615a5..ffd64a1811 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/client/HttpFSFileSystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/client/HttpFSFileSystem.java @@ -705,14 +705,13 @@ private FileStatus[] toFileStatuses(JSONObject json, Path f) { } /** - * List the statuses of the files/directories in the given path if the path is - * a directory. + * Get {@link FileStatus} of files/directories in the given path. If path + * corresponds to a file then {@link FileStatus} of that file is returned. + * Else if path represents a directory then {@link FileStatus} of all + * files/directories inside given path is returned. * * @param f given path - * - * @return the statuses of the files/directories in the given patch - * - * @throws IOException + * @return the statuses of the files/directories in the given path */ @Override public FileStatus[] listStatus(Path f) throws IOException { @@ -725,6 +724,13 @@ public FileStatus[] listStatus(Path f) throws IOException { return toFileStatuses(json, f); } + /** + * Get {@link DirectoryEntries} of the given path. {@link DirectoryEntries} + * contains an array of {@link FileStatus}, as well as iteration information. + * + * @param f given path + * @return {@link DirectoryEntries} for given path + */ @Override public DirectoryEntries listStatusBatch(Path f, byte[] token) throws FileNotFoundException, IOException { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/WebHDFS.md b/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/WebHDFS.md index 73c6558f4c..4a1395ee25 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/WebHDFS.md +++ b/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/WebHDFS.md @@ -467,6 +467,8 @@ See also: [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).getFileSt { "accessTime" : 1320171722771, "blockSize" : 33554432, + "childrenNum" : 0, + "fileId" : 16388, "group" : "supergroup", "length" : 24930, "modificationTime": 1320171722771, @@ -474,11 +476,14 @@ See also: [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).getFileSt "pathSuffix" : "a.patch", "permission" : "644", "replication" : 1, + "storagePolicy" : 0, "type" : "FILE" }, { "accessTime" : 0, "blockSize" : 0, + "childrenNum" : 0, + "fileId" : 16389, "group" : "supergroup", "length" : 0, "modificationTime": 1320895981256,