Beispiel #1
0
        /// <exception cref="System.IO.FileNotFoundException"/>
        /// <exception cref="Org.Apache.Hadoop.FS.UnresolvedLinkException"/>
        /// <exception cref="Org.Apache.Hadoop.Hdfs.Protocol.QuotaExceededException"/>
        /// <exception cref="Org.Apache.Hadoop.Hdfs.Protocol.SnapshotAccessControlException"/
        ///     >
        internal static void UnprotectedSetOwner(FSDirectory fsd, string src, string username
                                                 , string groupname)
        {
            System.Diagnostics.Debug.Assert(fsd.HasWriteLock());
            INodesInPath inodesInPath = fsd.GetINodesInPath4Write(src, true);
            INode        inode        = inodesInPath.GetLastINode();

            if (inode == null)
            {
                throw new FileNotFoundException("File does not exist: " + src);
            }
            if (username != null)
            {
                inode = inode.SetUser(username, inodesInPath.GetLatestSnapshotId());
            }
            if (groupname != null)
            {
                inode.SetGroup(groupname, inodesInPath.GetLatestSnapshotId());
            }
        }