Index: lib/hadoop-core-test-0.21.0-dev.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: lib/hadoop-core-0.21.0-dev.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: src/test/hdfs/org/apache/hadoop/fs/TestHDFSFileContextMainOperations.java
===================================================================
--- src/test/hdfs/org/apache/hadoop/fs/TestHDFSFileContextMainOperations.java	(revision 0)
+++ src/test/hdfs/org/apache/hadoop/fs/TestHDFSFileContextMainOperations.java	(revision 0)
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.fs;
+
+import java.io.IOException;
+
+import javax.security.auth.login.LoginException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hdfs.MiniDFSCluster;
+import org.apache.hadoop.security.UnixUserGroupInformation;
+import org.junit.*;
+
+
+
+public class TestHDFSFileContextMainOperations extends FileContextMainOperationsBaseTest {
+  
+  private static MiniDFSCluster cluster;
+  private static Path defaultWorkingDirectory;
+
+
+  @BeforeClass
+  public static void clusterSetupAtBegining() throws IOException, LoginException  {
+    cluster = new MiniDFSCluster(new Configuration(), 2, true, null);
+    fc = FileContext.getFileContext(cluster.getFileSystem());
+    defaultWorkingDirectory = fc.makeQualified( new Path("/user/" + 
+        UnixUserGroupInformation.login().getUserName()));
+
+  }
+
+      
+  @AfterClass
+  public static void ClusterShutdownAtEnd() throws Exception {
+    cluster.shutdown();
+    
+  }
+  
+  @Before
+  public void setUp() throws Exception {
+  }
+  
+  @Override
+  @After
+  public void tearDown() throws Exception {
+    super.tearDown();
+  }
+
+  @Override
+  protected Path getDefaultWorkingDirectory() {
+    return defaultWorkingDirectory;
+  } 
+  
+  @Override
+  @Test
+  public void testRenameFileAsExistingFile() throws Exception {
+    // ignore base class test till hadoop-6240 is fixed
+  }
+}

Property changes on: src/test/hdfs/org/apache/hadoop/fs/TestHDFSFileContextMainOperations.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
===================================================================
--- src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java	(revision 812655)
+++ src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java	(working copy)
@@ -177,7 +177,14 @@
     }
     return dfs.getBlockLocations(getPathName(file.getPath()), start, len);
   }
+  
+  @Override
+  public BlockLocation[] getFileBlockLocations(Path p, 
+      long start, long len) throws IOException {
+    return dfs.getBlockLocations(getPathName(p), start, len);
 
+  }
+
   @Override
   public void setVerifyChecksum(boolean verifyChecksum) {
     this.verifyChecksum = verifyChecksum;
@@ -208,6 +215,17 @@
                    flag, replication, blockSize, progress, bufferSize),
         statistics);
   }
+  
+  @Override
+  protected FSDataOutputStream createAbsPerm(Path f,
+      FsPermission absolutePermission, EnumSet<CreateFlag> flag, int bufferSize,
+      short replication, long blockSize, Progressable progress, int bytesPerChecksum) throws IOException {
+    return new FSDataOutputStream
+    (dfs.createAbs(getPathName(f), absolutePermission,
+                flag, replication, blockSize, progress, bufferSize, bytesPerChecksum),
+     statistics);
+   }
+  
 
   @Override
   public boolean setReplication(Path src, 
@@ -272,7 +290,18 @@
   public boolean mkdirs(Path f, FsPermission permission) throws IOException {
     return dfs.mkdirs(getPathName(f), permission);
   }
+  
 
+
+  @Override
+  protected boolean mkdirsAbsPerm(Path f, FsPermission absolutePermission
+      ) throws IOException {
+    return dfs.mkdirsAbs(getPathName(f), absolutePermission);
+    
+  }
+
+
+
   /** {@inheritDoc} */
   @Override
   public void close() throws IOException {
@@ -530,6 +559,4 @@
       ) throws IOException {
     dfs.setTimes(getPathName(p), mtime, atime);
   }
-  
-  
 }
Index: src/java/org/apache/hadoop/hdfs/DFSClient.java
===================================================================
--- src/java/org/apache/hadoop/hdfs/DFSClient.java	(revision 812655)
+++ src/java/org/apache/hadoop/hdfs/DFSClient.java	(working copy)
@@ -379,6 +379,9 @@
    */
   public BlockLocation[] getBlockLocations(String src, long start, 
     long length) throws IOException {
+
+    if ( (start<0) || (length < 0) )
+      throw new IllegalArgumentException("Invalid start or len parameter");
     LocatedBlocks blocks = callGetBlockLocations(namenode, src, start, length);
     if (blocks == null) {
       return new BlockLocation[0];
@@ -547,10 +550,33 @@
       permission = FsPermission.getDefault();
     }
     FsPermission masked = permission.applyUMask(FsPermission.getUMask(conf));
-    LOG.debug(src + ": masked=" + masked);
-    OutputStream result = new DFSOutputStream(src, masked,
+    return createAbs(src, masked, flag, replication,
+         blockSize, progress, buffersize, conf.getInt("io.bytes.per.checksum", 512));
+  }
+  
+  /**
+   * Same as {{@link #create(String, FsPermission, EnumSet, short, long,
+   *  Progressable, int)}   except that the permission
+   *   is absolute (ie has already been masked with umask.
+   * 
+   */
+  public OutputStream createAbs(String src, 
+                             FsPermission absPermission,
+                             EnumSet<CreateFlag> flag, 
+                             short replication,
+                             long blockSize,
+                             Progressable progress,
+                             int buffersize,
+                             int bytesPerChecksum
+                             ) throws IOException {
+    checkOpen();
+    if (absPermission == null) {
+      absPermission = FsPermission.getDefault().applyUMask(FsPermission.getUMask(conf));
+    } 
+    LOG.debug(src + ": masked=" + absPermission);
+    OutputStream result = new DFSOutputStream(src, absPermission,
         flag, replication, blockSize, progress, buffersize,
-        conf.getInt("io.bytes.per.checksum", 512));
+        bytesPerChecksum);
     leasechecker.put(src, result);
     return result;
   }
@@ -969,9 +995,23 @@
       permission = FsPermission.getDefault();
     }
     FsPermission masked = permission.applyUMask(FsPermission.getUMask(conf));
-    LOG.debug(src + ": masked=" + masked);
+    return mkdirsAbs(src, masked);
+  }
+  
+  
+  /**
+   * Same {{@link #mkdirs(String, FsPermission)} except that thr permissions
+   * has already been masked against umask
+   */
+  public boolean mkdirsAbs(String src, FsPermission absPermission)throws IOException{
+    checkOpen();
+    if (absPermission == null) {
+      absPermission = FsPermission.getDefault().applyUMask(FsPermission.getUMask(conf));
+    } 
+
+    LOG.debug(src + ": masked=" + absPermission);
     try {
-      return namenode.mkdirs(src, masked);
+      return namenode.mkdirs(src, absPermission);
     } catch(RemoteException re) {
       throw re.unwrapRemoteException(AccessControlException.class,
                                      NSQuotaExceededException.class,
