15 package com.cloudera.impala.catalog;
 
   17 import java.util.List;
 
   19 import java.util.concurrent.atomic.AtomicInteger;
 
   21 import com.cloudera.impala.thrift.TCatalogObjectType;
 
   22 import com.cloudera.impala.thrift.TRole;
 
   23 import com.google.common.base.Preconditions;
 
   24 import com.google.common.collect.Lists;
 
   25 import com.google.common.collect.Sets;
 
   33   private static AtomicInteger 
roleId_ = 
new AtomicInteger(0);
 
   37       new CatalogObjectCache<RolePrivilege>();
 
   39   public Role(String roleName, Set<String> grantGroups) {
 
   41     role_.setRole_name(roleName);
 
   42     role_.setRole_id(roleId_.incrementAndGet());
 
   43     role_.setGrant_groups(Lists.newArrayList(grantGroups));
 
   55     return rolePrivileges_.add(privilege);
 
   63     return Lists.newArrayList(rolePrivileges_.getValues());
 
   71     return Sets.newHashSet(rolePrivileges_.keySet());
 
   79     return rolePrivileges_.get(privilegeName);
 
   87     return rolePrivileges_.remove(privilegeName);
 
   94     if (
role_.getGrant_groups().contains(groupName)) 
return;
 
   95     role_.addToGrant_groups(groupName);
 
  102     role_.getGrant_groups().
remove(groupName);
 
  104     Preconditions.checkState(!role_.getGrant_groups().contains(groupName));
 
  118     return new Role(thriftRole);
 
  126     return Sets.newHashSet(role_.getGrant_groups());
 
  131   public String 
getName() { 
return role_.getRole_name(); }
 
  132   public int getId() { 
return role_.getRole_id(); }
 
List< RolePrivilege > getPrivileges()
Role(String roleName, Set< String > grantGroups)
synchronized void addGrantGroup(String groupName)
boolean addPrivilege(RolePrivilege privilege)
final CatalogObjectCache< RolePrivilege > rolePrivileges_
static final long INITIAL_CATALOG_VERSION
synchronized long getCatalogVersion()
static Role fromThrift(TRole thriftRole)
static AtomicInteger roleId_
Set< String > getPrivilegeNames()
Set< String > getGrantGroups()
RolePrivilege getPrivilege(String privilegeName)
synchronized void removeGrantGroup(String groupName)
TCatalogObjectType getCatalogObjectType()
RolePrivilege removePrivilege(String privilegeName)
synchronized void setCatalogVersion(long newVersion)