当前位置: 首页>>代码示例>>Java>>正文


Java NetgroupCache类代码示例

本文整理汇总了Java中org.apache.hadoop.security.NetgroupCache的典型用法代码示例。如果您正苦于以下问题:Java NetgroupCache类的具体用法?Java NetgroupCache怎么用?Java NetgroupCache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NetgroupCache类属于org.apache.hadoop.security包,在下文中一共展示了NetgroupCache类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: cacheGroupsRefresh

import org.apache.hadoop.security.NetgroupCache; //导入依赖的package包/类
/**
 * Refresh the netgroup cache
 */
@Override
public void cacheGroupsRefresh() throws IOException {
  List<String> groups = NetgroupCache.getNetgroupNames();
  NetgroupCache.clear();
  cacheGroupsAdd(groups);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:10,代码来源:JniBasedUnixGroupsNetgroupMapping.java

示例2: cacheGroupsAdd

import org.apache.hadoop.security.NetgroupCache; //导入依赖的package包/类
/**
 * Add a group to cache, only netgroups are cached
 *
 * @param groups list of group names to add to cache
 */
@Override
public void cacheGroupsAdd(List<String> groups) throws IOException {
  for(String group: groups) {
    if(group.length() == 0) {
      // better safe than sorry (should never happen)
    } else if(group.charAt(0) == '@') {
      if(!NetgroupCache.isCached(group)) {
        NetgroupCache.add(group, getUsersForNetgroup(group));
      }
    } else {
      // unix group, not caching
    }
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:20,代码来源:JniBasedUnixGroupsNetgroupMapping.java

示例3: getGroups

import org.apache.hadoop.security.NetgroupCache; //导入依赖的package包/类
/**
 * Get unix groups (parent) and netgroups for given user
 *
 * @param user get groups and netgroups for this user
 * @return groups and netgroups for user
 */
@Override
public List<String> getGroups(String user) throws IOException {
  // parent get unix groups
  List<String> groups = new LinkedList<String>(super.getGroups(user));
  NetgroupCache.getNetgroups(user, groups);
  return groups;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:14,代码来源:ShellBasedUnixGroupsNetgroupMapping.java


注:本文中的org.apache.hadoop.security.NetgroupCache类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。