コード例 #1
0
ファイル: HSAdmin.cs プロジェクト: orf53975/hadoop.net
        /// <exception cref="System.IO.IOException"/>
        private int GetGroups(string[] usernames)
        {
            // Get groups users belongs to
            if (usernames.Length == 0)
            {
                usernames = new string[] { UserGroupInformation.GetCurrentUser().GetUserName() };
            }
            // Get the current configuration
            Configuration conf    = GetConf();
            IPEndPoint    address = conf.GetSocketAddr(JHAdminConfig.JhsAdminAddress, JHAdminConfig
                                                       .DefaultJhsAdminAddress, JHAdminConfig.DefaultJhsAdminPort);
            GetUserMappingsProtocol getUserMappingProtocol = HSProxies.CreateProxy <GetUserMappingsProtocol
                                                                                    >(conf, address, UserGroupInformation.GetCurrentUser());

            foreach (string username in usernames)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append(username + " :");
                foreach (string group in getUserMappingProtocol.GetGroupsForUser(username))
                {
                    sb.Append(" ");
                    sb.Append(group);
                }
                System.Console.Out.WriteLine(sb);
            }
            return(0);
        }
 public GetUserMappingsProtocolServerSideTranslatorPB(GetUserMappingsProtocol impl
                                                      )
 {
     this.impl = impl;
 }