Example usage for org.apache.hadoop.security Groups getUserToGroupsMappingService

List of usage examples for org.apache.hadoop.security Groups getUserToGroupsMappingService

Introduction

In this page you can find the example usage for org.apache.hadoop.security Groups getUserToGroupsMappingService.

Prototype

public static synchronized Groups getUserToGroupsMappingService(Configuration conf) 

Source Link

Document

Get the groups being used to map user-to-groups.

Usage

From source file:common.NameNode.java

License:Apache License

@Override
public void refreshUserToGroupsMappings(Configuration conf) throws IOException {
    LOG.info("Refreshing all user-to-groups mappings. Requested by user: "
            + UserGroupInformation.getCurrentUser().getShortUserName());
    Groups.getUserToGroupsMappingService(conf).refresh();
}

From source file:org.apache.sentry.core.common.service.HadoopGroupMappingService.java

License:Apache License

public HadoopGroupMappingService(Configuration conf, String resource) {
    if (hadoopConf == null) {
        synchronized (HadoopGroupMappingService.class) {
            if (hadoopConf == null) {
                // clone the current config and add resource path
                hadoopConf = new Configuration();
                hadoopConf.addResource(conf);
                if (!StringUtils.isEmpty(resource)) {
                    hadoopConf.addResource(resource);
                }//from   w ww . j  a v  a  2s .c o  m
            }
        }
    }
    this.groups = Groups.getUserToGroupsMappingService(hadoopConf);
}

From source file:org.apache.sentry.provider.common.HadoopGroupMappingService.java

License:Apache License

public HadoopGroupMappingService(Configuration conf, String resource) {
    if (hadoopConf == null) {
        synchronized (HadoopGroupMappingService.class) {
            if (hadoopConf == null) {
                // clone the current config and add resource path
                hadoopConf = new Configuration();
                hadoopConf.addResource(conf);
                if (!StringUtils.isEmpty(resource)) {
                    hadoopConf.addResource(resource, true);
                }//from   ww w  .ja v a  2 s. c om
            }
        }
    }
    this.groups = Groups.getUserToGroupsMappingService(hadoopConf);
}

From source file:org.apache.sentry.provider.common.HadoopGroupResourceAuthorizationProvider.java

License:Apache License

private static Groups getGroups(Configuration conf) {
    if (conf.getBoolean(USE_NEW_GROUPS, false)) {
        return new Groups(conf);
    } else {/* ww w  .  j a  va  2  s  .  c  o  m*/
        return Groups.getUserToGroupsMappingService(conf);
    }
}

From source file:org.apache.sentry.provider.file.HadoopGroupResourceAuthorizationProvider.java

License:Apache License

public HadoopGroupResourceAuthorizationProvider(String resource, String serverName) throws IOException {
    this(new SimplePolicyEngine(resource, serverName),
            new HadoopGroupMappingService(Groups.getUserToGroupsMappingService(new Configuration())));
}

From source file:skewtune.mapreduce.STJobTracker.java

License:Apache License

@Override
public void refreshUserToGroupsMappings(Configuration conf) throws IOException {
    LOG.info("Refreshing all user-to-groups mappings. Requested by user: "
            + UserGroupInformation.getCurrentUser().getShortUserName());

    Groups.getUserToGroupsMappingService(conf).refresh();
}