/// <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); }
/// <exception cref="System.IO.IOException"/> private int RefreshLogRetentionSettings() { // Refresh log retention settings Configuration conf = GetConf(); IPEndPoint address = conf.GetSocketAddr(JHAdminConfig.JhsAdminAddress, JHAdminConfig .DefaultJhsAdminAddress, JHAdminConfig.DefaultJhsAdminPort); HSAdminRefreshProtocol refreshProtocol = HSProxies.CreateProxy <HSAdminRefreshProtocol >(conf, address, UserGroupInformation.GetCurrentUser()); refreshProtocol.RefreshLogRetentionSettings(); return(0); }
/// <exception cref="System.IO.IOException"/> private int RefreshLoadedJobCache() { // Refresh the loaded job cache Configuration conf = GetConf(); IPEndPoint address = conf.GetSocketAddr(JHAdminConfig.JhsAdminAddress, JHAdminConfig .DefaultJhsAdminAddress, JHAdminConfig.DefaultJhsAdminPort); HSAdminRefreshProtocol refreshProtocol = HSProxies.CreateProxy <HSAdminRefreshProtocol >(conf, address, UserGroupInformation.GetCurrentUser()); refreshProtocol.RefreshLoadedJobCache(); return(0); }
/// <exception cref="System.IO.IOException"/> private int RefreshSuperUserGroupsConfiguration() { // Refresh the super-user groups Configuration conf = GetConf(); IPEndPoint address = conf.GetSocketAddr(JHAdminConfig.JhsAdminAddress, JHAdminConfig .DefaultJhsAdminAddress, JHAdminConfig.DefaultJhsAdminPort); RefreshUserMappingsProtocol refreshProtocol = HSProxies.CreateProxy <RefreshUserMappingsProtocol >(conf, address, UserGroupInformation.GetCurrentUser()); // Refresh the super-user group mappings refreshProtocol.RefreshSuperUserGroupsConfiguration(); return(0); }