예제 #1
0
 /// <summary>Add the node to the children list at the given insertion point.</summary>
 /// <remarks>
 /// Add the node to the children list at the given insertion point.
 /// The basic add method which actually calls children.add(..).
 /// </remarks>
 private void AddChild(INode node, int insertionPoint)
 {
     if (children == null)
     {
         children = new AList <INode>(DefaultFilesPerDirectory);
     }
     node.SetParent(this);
     children.Add(-insertionPoint - 1, node);
     if (node.GetGroupName() == null)
     {
         node.SetGroup(GetGroupName());
     }
 }
예제 #2
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());
            }
        }