|
@@ -64,11 +64,10 @@ public class DistributedFileSystem extends FileSystem {
|
|
initialize(NameNode.getUri(namenode), conf);
|
|
initialize(NameNode.getUri(namenode), conf);
|
|
}
|
|
}
|
|
|
|
|
|
- /** @deprecated */
|
|
|
|
- public String getName() { return uri.getAuthority(); }
|
|
|
|
-
|
|
|
|
|
|
+ @Override
|
|
public URI getUri() { return uri; }
|
|
public URI getUri() { return uri; }
|
|
|
|
|
|
|
|
+ @Override
|
|
public void initialize(URI uri, Configuration conf) throws IOException {
|
|
public void initialize(URI uri, Configuration conf) throws IOException {
|
|
setConf(conf);
|
|
setConf(conf);
|
|
|
|
|
|
@@ -84,6 +83,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
}
|
|
}
|
|
|
|
|
|
/** Permit paths which explicitly specify the default port. */
|
|
/** Permit paths which explicitly specify the default port. */
|
|
|
|
+ @Override
|
|
protected void checkPath(Path path) {
|
|
protected void checkPath(Path path) {
|
|
URI thisUri = this.getUri();
|
|
URI thisUri = this.getUri();
|
|
URI thatUri = path.toUri();
|
|
URI thatUri = path.toUri();
|
|
@@ -99,6 +99,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
}
|
|
}
|
|
|
|
|
|
/** Normalize paths that explicitly specify the default port. */
|
|
/** Normalize paths that explicitly specify the default port. */
|
|
|
|
+ @Override
|
|
public Path makeQualified(Path path) {
|
|
public Path makeQualified(Path path) {
|
|
URI thisUri = this.getUri();
|
|
URI thisUri = this.getUri();
|
|
URI thatUri = path.toUri();
|
|
URI thatUri = path.toUri();
|
|
@@ -115,15 +116,17 @@ public class DistributedFileSystem extends FileSystem {
|
|
return super.makeQualified(path);
|
|
return super.makeQualified(path);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ @Override
|
|
public Path getWorkingDirectory() {
|
|
public Path getWorkingDirectory() {
|
|
return workingDir;
|
|
return workingDir;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
public long getDefaultBlockSize() {
|
|
public long getDefaultBlockSize() {
|
|
return dfs.getDefaultBlockSize();
|
|
return dfs.getDefaultBlockSize();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
public short getDefaultReplication() {
|
|
public short getDefaultReplication() {
|
|
return dfs.getDefaultReplication();
|
|
return dfs.getDefaultReplication();
|
|
}
|
|
}
|
|
@@ -136,6 +139,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
public void setWorkingDirectory(Path dir) {
|
|
public void setWorkingDirectory(Path dir) {
|
|
String result = makeAbsolute(dir).toUri().getPath();
|
|
String result = makeAbsolute(dir).toUri().getPath();
|
|
if (!DFSUtil.isValidName(result)) {
|
|
if (!DFSUtil.isValidName(result)) {
|
|
@@ -146,6 +150,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
}
|
|
}
|
|
|
|
|
|
/** {@inheritDoc} */
|
|
/** {@inheritDoc} */
|
|
|
|
+ @Override
|
|
public Path getHomeDirectory() {
|
|
public Path getHomeDirectory() {
|
|
return new Path("/user/" + dfs.ugi.getUserName()).makeQualified(this);
|
|
return new Path("/user/" + dfs.ugi.getUserName()).makeQualified(this);
|
|
}
|
|
}
|
|
@@ -160,7 +165,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ @Override
|
|
public BlockLocation[] getFileBlockLocations(FileStatus file, long start,
|
|
public BlockLocation[] getFileBlockLocations(FileStatus file, long start,
|
|
long len) throws IOException {
|
|
long len) throws IOException {
|
|
if (file == null) {
|
|
if (file == null) {
|
|
@@ -169,16 +174,19 @@ public class DistributedFileSystem extends FileSystem {
|
|
return dfs.getBlockLocations(getPathName(file.getPath()), start, len);
|
|
return dfs.getBlockLocations(getPathName(file.getPath()), start, len);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
public void setVerifyChecksum(boolean verifyChecksum) {
|
|
public void setVerifyChecksum(boolean verifyChecksum) {
|
|
this.verifyChecksum = verifyChecksum;
|
|
this.verifyChecksum = verifyChecksum;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
public FSDataInputStream open(Path f, int bufferSize) throws IOException {
|
|
public FSDataInputStream open(Path f, int bufferSize) throws IOException {
|
|
return new DFSClient.DFSDataInputStream(
|
|
return new DFSClient.DFSDataInputStream(
|
|
dfs.open(getPathName(f), bufferSize, verifyChecksum, statistics));
|
|
dfs.open(getPathName(f), bufferSize, verifyChecksum, statistics));
|
|
}
|
|
}
|
|
|
|
|
|
/** This optional operation is not yet supported. */
|
|
/** This optional operation is not yet supported. */
|
|
|
|
+ @Override
|
|
public FSDataOutputStream append(Path f, int bufferSize,
|
|
public FSDataOutputStream append(Path f, int bufferSize,
|
|
Progressable progress) throws IOException {
|
|
Progressable progress) throws IOException {
|
|
|
|
|
|
@@ -186,6 +194,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
return new FSDataOutputStream(op, statistics, op.getInitialLen());
|
|
return new FSDataOutputStream(op, statistics, op.getInitialLen());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
public FSDataOutputStream create(Path f, FsPermission permission,
|
|
public FSDataOutputStream create(Path f, FsPermission permission,
|
|
boolean overwrite,
|
|
boolean overwrite,
|
|
int bufferSize, short replication, long blockSize,
|
|
int bufferSize, short replication, long blockSize,
|
|
@@ -197,6 +206,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
statistics);
|
|
statistics);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
public boolean setReplication(Path src,
|
|
public boolean setReplication(Path src,
|
|
short replication
|
|
short replication
|
|
) throws IOException {
|
|
) throws IOException {
|
|
@@ -206,6 +216,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
/**
|
|
/**
|
|
* Rename files/dirs
|
|
* Rename files/dirs
|
|
*/
|
|
*/
|
|
|
|
+ @Override
|
|
public boolean rename(Path src, Path dst) throws IOException {
|
|
public boolean rename(Path src, Path dst) throws IOException {
|
|
return dfs.rename(getPathName(src), getPathName(dst));
|
|
return dfs.rename(getPathName(src), getPathName(dst));
|
|
}
|
|
}
|
|
@@ -214,11 +225,13 @@ public class DistributedFileSystem extends FileSystem {
|
|
* requires a boolean check to delete a non
|
|
* requires a boolean check to delete a non
|
|
* empty directory recursively.
|
|
* empty directory recursively.
|
|
*/
|
|
*/
|
|
|
|
+ @Override
|
|
public boolean delete(Path f, boolean recursive) throws IOException {
|
|
public boolean delete(Path f, boolean recursive) throws IOException {
|
|
return dfs.delete(getPathName(f), recursive);
|
|
return dfs.delete(getPathName(f), recursive);
|
|
}
|
|
}
|
|
|
|
|
|
/** {@inheritDoc} */
|
|
/** {@inheritDoc} */
|
|
|
|
+ @Override
|
|
public ContentSummary getContentSummary(Path f) throws IOException {
|
|
public ContentSummary getContentSummary(Path f) throws IOException {
|
|
return dfs.getContentSummary(getPathName(f));
|
|
return dfs.getContentSummary(getPathName(f));
|
|
}
|
|
}
|
|
@@ -239,6 +252,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
f.getPath().makeQualified(this)); // fully-qualify path
|
|
f.getPath().makeQualified(this)); // fully-qualify path
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
public FileStatus[] listStatus(Path p) throws IOException {
|
|
public FileStatus[] listStatus(Path p) throws IOException {
|
|
FileStatus[] infos = dfs.listPaths(getPathName(p));
|
|
FileStatus[] infos = dfs.listPaths(getPathName(p));
|
|
if (infos == null) return null;
|
|
if (infos == null) return null;
|
|
@@ -249,11 +263,13 @@ public class DistributedFileSystem extends FileSystem {
|
|
return stats;
|
|
return stats;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
public boolean mkdirs(Path f, FsPermission permission) throws IOException {
|
|
public boolean mkdirs(Path f, FsPermission permission) throws IOException {
|
|
return dfs.mkdirs(getPathName(f), permission);
|
|
return dfs.mkdirs(getPathName(f), permission);
|
|
}
|
|
}
|
|
|
|
|
|
/** {@inheritDoc} */
|
|
/** {@inheritDoc} */
|
|
|
|
+ @Override
|
|
public void close() throws IOException {
|
|
public void close() throws IOException {
|
|
try {
|
|
try {
|
|
super.processDeleteOnExit();
|
|
super.processDeleteOnExit();
|
|
@@ -263,6 +279,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
public String toString() {
|
|
public String toString() {
|
|
return "DFS[" + dfs + "]";
|
|
return "DFS[" + dfs + "]";
|
|
}
|
|
}
|
|
@@ -288,6 +305,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
}
|
|
}
|
|
|
|
|
|
/** {@inheritDoc} */
|
|
/** {@inheritDoc} */
|
|
|
|
+ @Override
|
|
public FsStatus getStatus(Path p) throws IOException {
|
|
public FsStatus getStatus(Path p) throws IOException {
|
|
return dfs.getDiskStatus();
|
|
return dfs.getDiskStatus();
|
|
}
|
|
}
|
|
@@ -420,6 +438,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
* Returns the stat information about the file.
|
|
* Returns the stat information about the file.
|
|
* @throws FileNotFoundException if the file does not exist.
|
|
* @throws FileNotFoundException if the file does not exist.
|
|
*/
|
|
*/
|
|
|
|
+ @Override
|
|
public FileStatus getFileStatus(Path f) throws IOException {
|
|
public FileStatus getFileStatus(Path f) throws IOException {
|
|
FileStatus fi = dfs.getFileInfo(getPathName(f));
|
|
FileStatus fi = dfs.getFileInfo(getPathName(f));
|
|
if (fi != null) {
|
|
if (fi != null) {
|
|
@@ -430,17 +449,20 @@ public class DistributedFileSystem extends FileSystem {
|
|
}
|
|
}
|
|
|
|
|
|
/** {@inheritDoc} */
|
|
/** {@inheritDoc} */
|
|
|
|
+ @Override
|
|
public MD5MD5CRC32FileChecksum getFileChecksum(Path f) throws IOException {
|
|
public MD5MD5CRC32FileChecksum getFileChecksum(Path f) throws IOException {
|
|
return dfs.getFileChecksum(getPathName(f));
|
|
return dfs.getFileChecksum(getPathName(f));
|
|
}
|
|
}
|
|
|
|
|
|
/** {@inheritDoc }*/
|
|
/** {@inheritDoc }*/
|
|
|
|
+ @Override
|
|
public void setPermission(Path p, FsPermission permission
|
|
public void setPermission(Path p, FsPermission permission
|
|
) throws IOException {
|
|
) throws IOException {
|
|
dfs.setPermission(getPathName(p), permission);
|
|
dfs.setPermission(getPathName(p), permission);
|
|
}
|
|
}
|
|
|
|
|
|
/** {@inheritDoc }*/
|
|
/** {@inheritDoc }*/
|
|
|
|
+ @Override
|
|
public void setOwner(Path p, String username, String groupname
|
|
public void setOwner(Path p, String username, String groupname
|
|
) throws IOException {
|
|
) throws IOException {
|
|
if (username == null && groupname == null) {
|
|
if (username == null && groupname == null) {
|
|
@@ -450,6 +472,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
}
|
|
}
|
|
|
|
|
|
/** {@inheritDoc }*/
|
|
/** {@inheritDoc }*/
|
|
|
|
+ @Override
|
|
public void setTimes(Path p, long mtime, long atime
|
|
public void setTimes(Path p, long mtime, long atime
|
|
) throws IOException {
|
|
) throws IOException {
|
|
dfs.setTimes(getPathName(p), mtime, atime);
|
|
dfs.setTimes(getPathName(p), mtime, atime);
|