diff --git a/CHANGES.txt b/CHANGES.txt index df66086904e..54ba52fbe06 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -375,6 +375,9 @@ Trunk (unreleased changes) HADOOP-6634. Fix AccessControlList to use short names to verify access control. (Vinod Kumar Vavilapalli via sharad) + + HADOOP-6709. Re-instate deprecated FileSystem methods that were removed + after 0.20. (tomwhite) Release 0.21.0 - Unreleased diff --git a/src/java/org/apache/hadoop/fs/FileSystem.java b/src/java/org/apache/hadoop/fs/FileSystem.java index 95ff7bf4769..54c4c54f400 100644 --- a/src/java/org/apache/hadoop/fs/FileSystem.java +++ b/src/java/org/apache/hadoop/fs/FileSystem.java @@ -137,6 +137,17 @@ public abstract class FileSystem extends Configured implements Closeable { /** Returns a URI whose scheme and authority identify this FileSystem.*/ public abstract URI getUri(); + /** @deprecated call #getUri() instead.*/ + @Deprecated + public String getName() { return getUri().toString(); } + + /** @deprecated call #get(URI,Configuration) instead. */ + @Deprecated + public static FileSystem getNamed(String name, Configuration conf) + throws IOException { + return get(URI.create(fixName(name)), conf); + } + /** Update old-format filesystem names, for back-compatibility. This should * eventually be replaced with a checkName() method that throws an exception * for old-format names. */ @@ -813,6 +824,19 @@ public abstract class FileSystem extends Configured implements Closeable { public abstract FSDataOutputStream append(Path f, int bufferSize, Progressable progress) throws IOException; + /** + * Get replication. + * + * @deprecated Use getFileStatus() instead + * @param src file name + * @return file replication + * @throws IOException + */ + @Deprecated + public short getReplication(Path src) throws IOException { + return getFileStatus(src).getReplication(); + } + /** * Set replication for an existing file. * @@ -922,6 +946,15 @@ public abstract class FileSystem extends Configured implements Closeable { } } + /** + * Delete a file + * @deprecated Use {@link #delete(Path, boolean)} instead. + */ + @Deprecated + public boolean delete(Path f) throws IOException { + return delete(f, true); + } + /** Delete a file. * * @param f the path to delete. @@ -1009,6 +1042,13 @@ public abstract class FileSystem extends Configured implements Closeable { return false; // f does not exist } } + + /** The number of bytes in a file. */ + /** @deprecated Use getFileStatus() instead */ + @Deprecated + public long getLength(Path f) throws IOException { + return getFileStatus(f).getLen(); + } /** Return the {@link ContentSummary} of a given {@link Path}. */ public ContentSummary getContentSummary(Path f) throws IOException { @@ -1608,6 +1648,17 @@ public abstract class FileSystem extends Configured implements Closeable { } return used; } + + /** + * Get the block size for a particular file. + * @param f the filename + * @return the number of bytes in a block + */ + /** @deprecated Use getFileStatus() instead */ + @Deprecated + public long getBlockSize(Path f) throws IOException { + return getFileStatus(f).getBlockSize(); + } /** Return the number of bytes that large input files should be optimally * be split into to minimize i/o time. */