Example usage for org.apache.hadoop.util ZKUtil removeSpecificPerms

List of usage examples for org.apache.hadoop.util ZKUtil removeSpecificPerms

Introduction

In this page you can find the example usage for org.apache.hadoop.util ZKUtil removeSpecificPerms.

Prototype

public static int removeSpecificPerms(int perms, int remove) 

Source Link

Document

Helper method to remove a subset of permissions (remove) from a given set (perms).

Usage

From source file:com.cloudera.llama.am.LlamaHAFencer.java

License:Apache License

private List<ACL> createAclsForExclusiveReadAccess() throws LlamaException {
    List<ACL> acls = new ArrayList<ACL>();
    for (ACL acl : conf.getZkAcls()) {
        acls.add(new ACL(ZKUtil.removeSpecificPerms(acl.getPerms(), ZooDefs.Perms.READ), acl.getId()));
    }//  ww  w . ja  va  2 s . co m
    Id llamaId;
    try {
        llamaId = new Id(authScheme,
                DigestAuthenticationProvider.generateDigest(fencingUsername + ":" + fencingPassword));
    } catch (NoSuchAlgorithmException e) {
        throw new LlamaException(ErrorCode.INTERNAL_ERROR, "Unable to create username:password digest for ZK");
    }
    acls.add(new ACL(ZooDefs.Perms.READ, llamaId));
    return acls;
}