|
@@ -27,8 +27,6 @@ import java.net.HttpURLConnection;
|
|
|
import java.net.URI;
|
|
|
import java.net.URISyntaxException;
|
|
|
import java.net.URL;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
@@ -86,17 +84,24 @@ public class WebHdfsFileSystem extends HftpFileSystem {
|
|
|
|
|
|
private static final KerberosUgiAuthenticator AUTH = new KerberosUgiAuthenticator();
|
|
|
|
|
|
- private UserGroupInformation ugi;
|
|
|
+ private final UserGroupInformation ugi;
|
|
|
private final AuthenticatedURL.Token authToken = new AuthenticatedURL.Token();
|
|
|
protected Path workingDir;
|
|
|
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ ugi = UserGroupInformation.getCurrentUser();
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public synchronized void initialize(URI uri, Configuration conf
|
|
|
) throws IOException {
|
|
|
super.initialize(uri, conf);
|
|
|
setConf(conf);
|
|
|
|
|
|
- ugi = UserGroupInformation.getCurrentUser();
|
|
|
this.workingDir = getHomeDirectory();
|
|
|
}
|
|
|
|
|
@@ -110,6 +115,11 @@ public class WebHdfsFileSystem extends HftpFileSystem {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Path getHomeDirectory() {
|
|
|
+ return makeQualified(new Path("/user/" + ugi.getShortUserName()));
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public synchronized Path getWorkingDirectory() {
|
|
|
return workingDir;
|