private int refreshUserToGroupsMappings() throws IOException { // Get the current configuration Configuration conf = getConf(); InetSocketAddress address = conf.getSocketAddr( JHAdminConfig.JHS_ADMIN_ADDRESS, JHAdminConfig.DEFAULT_JHS_ADMIN_ADDRESS, JHAdminConfig.DEFAULT_JHS_ADMIN_PORT); RefreshUserMappingsProtocol refreshProtocol = HSProxies.createProxy(conf, address, RefreshUserMappingsProtocol.class, UserGroupInformation.getCurrentUser()); // Refresh the user-to-groups mappings refreshProtocol.refreshUserToGroupsMappings(); return 0; }
private int refreshSuperUserGroupsConfiguration() throws IOException { // Refresh the super-user groups Configuration conf = getConf(); InetSocketAddress address = conf.getSocketAddr( JHAdminConfig.JHS_ADMIN_ADDRESS, JHAdminConfig.DEFAULT_JHS_ADMIN_ADDRESS, JHAdminConfig.DEFAULT_JHS_ADMIN_PORT); RefreshUserMappingsProtocol refreshProtocol = HSProxies.createProxy(conf, address, RefreshUserMappingsProtocol.class, UserGroupInformation.getCurrentUser()); // Refresh the super-user group mappings refreshProtocol.refreshSuperUserGroupsConfiguration(); return 0; }
private int getGroups(String[] usernames) throws IOException { // Get groups users belongs to if (usernames.length == 0) { usernames = new String[] { UserGroupInformation.getCurrentUser() .getUserName() }; } // Get the current configuration Configuration conf = getConf(); InetSocketAddress address = conf.getSocketAddr( JHAdminConfig.JHS_ADMIN_ADDRESS, JHAdminConfig.DEFAULT_JHS_ADMIN_ADDRESS, JHAdminConfig.DEFAULT_JHS_ADMIN_PORT); GetUserMappingsProtocol getUserMappingProtocol = HSProxies.createProxy( conf, address, GetUserMappingsProtocol.class, UserGroupInformation.getCurrentUser()); for (String username : usernames) { StringBuilder sb = new StringBuilder(); sb.append(username + " :"); for (String group : getUserMappingProtocol.getGroupsForUser(username)) { sb.append(" "); sb.append(group); } System.out.println(sb); } return 0; }
private int refreshAdminAcls() throws IOException { // Refresh the admin acls Configuration conf = getConf(); InetSocketAddress address = conf.getSocketAddr( JHAdminConfig.JHS_ADMIN_ADDRESS, JHAdminConfig.DEFAULT_JHS_ADMIN_ADDRESS, JHAdminConfig.DEFAULT_JHS_ADMIN_PORT); HSAdminRefreshProtocol refreshProtocol = HSProxies.createProxy(conf, address, HSAdminRefreshProtocol.class, UserGroupInformation.getCurrentUser()); refreshProtocol.refreshAdminAcls(); return 0; }
private int refreshLoadedJobCache() throws IOException { // Refresh the loaded job cache Configuration conf = getConf(); InetSocketAddress address = conf.getSocketAddr( JHAdminConfig.JHS_ADMIN_ADDRESS, JHAdminConfig.DEFAULT_JHS_ADMIN_ADDRESS, JHAdminConfig.DEFAULT_JHS_ADMIN_PORT); HSAdminRefreshProtocol refreshProtocol = HSProxies.createProxy(conf, address, HSAdminRefreshProtocol.class, UserGroupInformation.getCurrentUser()); refreshProtocol.refreshLoadedJobCache(); return 0; }
private int refreshJobRetentionSettings() throws IOException { // Refresh job retention settings Configuration conf = getConf(); InetSocketAddress address = conf.getSocketAddr( JHAdminConfig.JHS_ADMIN_ADDRESS, JHAdminConfig.DEFAULT_JHS_ADMIN_ADDRESS, JHAdminConfig.DEFAULT_JHS_ADMIN_PORT); HSAdminRefreshProtocol refreshProtocol = HSProxies.createProxy(conf, address, HSAdminRefreshProtocol.class, UserGroupInformation.getCurrentUser()); refreshProtocol.refreshJobRetentionSettings(); return 0; }
private int refreshLogRetentionSettings() throws IOException { // Refresh log retention settings Configuration conf = getConf(); InetSocketAddress address = conf.getSocketAddr( JHAdminConfig.JHS_ADMIN_ADDRESS, JHAdminConfig.DEFAULT_JHS_ADMIN_ADDRESS, JHAdminConfig.DEFAULT_JHS_ADMIN_PORT); HSAdminRefreshProtocol refreshProtocol = HSProxies.createProxy(conf, address, HSAdminRefreshProtocol.class, UserGroupInformation.getCurrentUser()); refreshProtocol.refreshLogRetentionSettings(); return 0; }