You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@falcon.apache.org by pa...@apache.org on 2015/10/21 07:46:11 UTC

falcon git commit: FALCON-1551 Implement setWorkingDir Method in JailedFileSystem(Pavan Kolamuri)

Repository: falcon
Updated Branches:
  refs/heads/master a0911bd82 -> a3e2320f8


FALCON-1551 Implement setWorkingDir Method in JailedFileSystem(Pavan Kolamuri)


Project: http://git-wip-us.apache.org/repos/asf/falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/a3e2320f
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/a3e2320f
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/a3e2320f

Branch: refs/heads/master
Commit: a3e2320f8e9bf4e9ef14e33b474e67c3ff240124
Parents: a0911bd
Author: Pallavi Rao <pa...@inmobi.com>
Authored: Wed Oct 21 11:15:56 2015 +0530
Committer: Pallavi Rao <pa...@inmobi.com>
Committed: Wed Oct 21 11:15:56 2015 +0530

----------------------------------------------------------------------
 CHANGES.txt                                          |  2 ++
 .../org/apache/falcon/hadoop/JailedFileSystem.java   | 15 +++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/a3e2320f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index a4dc1c8..d5e0bf0 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -71,6 +71,8 @@ Trunk (Unreleased)
     FALCON-1403 Revisit IT cleanup and teardown(Narayan Periwal via Pallavi Rao)
 
   BUG FIXES
+    FALCON-1551 Implement setWorkingDir Method in JailedFileSystem(Pavan Kolamuri via Pallavi Rao)
+
     FALCON-1541 Bundle deploy.properties while packaging falcon (Pragya Mittal via Pallavi Rao)
 
     FALCON-1530 SLAMonitoring API is not honouring delete feature(Ajay Yadava).

http://git-wip-us.apache.org/repos/asf/falcon/blob/a3e2320f/hadoop-dependencies/src/main/java/org/apache/falcon/hadoop/JailedFileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-dependencies/src/main/java/org/apache/falcon/hadoop/JailedFileSystem.java b/hadoop-dependencies/src/main/java/org/apache/falcon/hadoop/JailedFileSystem.java
index d5b2eb3..27b5a9e 100644
--- a/hadoop-dependencies/src/main/java/org/apache/falcon/hadoop/JailedFileSystem.java
+++ b/hadoop-dependencies/src/main/java/org/apache/falcon/hadoop/JailedFileSystem.java
@@ -43,9 +43,11 @@ public class JailedFileSystem extends FileSystem {
     private URI uri;
     private String basePath;
     private LocalFileSystem localFS;
+    private Path workingDir;
 
     public JailedFileSystem() {
         localFS = new LocalFileSystem();
+        this.workingDir = new Path("/user", System.getProperty("user.name"));
     }
 
     @Override
@@ -128,12 +130,21 @@ public class JailedFileSystem extends FileSystem {
 
     @Override
     public void setWorkingDirectory(Path newDir) {
-        throw new UnsupportedOperationException();
+        if (newDir != null) {
+            workingDir = makeAbsolute(newDir);
+        }
+    }
+
+    private Path makeAbsolute(Path path) {
+        if (path.isAbsolute()) {
+            return path;
+        }
+        return new Path(workingDir, path);
     }
 
     @Override
     public Path getWorkingDirectory() {
-        return new Path("/user/" + System.getProperty("user.name"));
+        return workingDir;
     }
 
     @Override