congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
RolePrincipalGrant
Code IndexAdd Tabnine to your IDE (free)

How to use
RolePrincipalGrant
in
org.apache.hadoop.hive.metastore.api

Best Java code snippets using org.apache.hadoop.hive.metastore.api.RolePrincipalGrant (Showing top 20 results out of 315)

origin: apache/hive

public HiveRoleGrant(RolePrincipalGrant thriftRoleGrant) {
 this.roleName = thriftRoleGrant.getRoleName();
 this.principalName = thriftRoleGrant.getPrincipalName();
 this.principalType = thriftRoleGrant.getPrincipalType().name();
 this.grantOption = thriftRoleGrant.isGrantOption();
 this.grantTime = thriftRoleGrant.getGrantTime();
 this.grantor = thriftRoleGrant.getGrantorName();
 this.grantorType = thriftRoleGrant.getGrantorPrincipalType() == null ? null :
  thriftRoleGrant.getGrantorPrincipalType().name();
}
origin: apache/hive

 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, GetRoleGrantsForPrincipalResponse struct) throws org.apache.thrift.TException {
  TTupleProtocol iprot = (TTupleProtocol) prot;
  {
   org.apache.thrift.protocol.TList _list91 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
   struct.principalGrants = new ArrayList<RolePrincipalGrant>(_list91.size);
   RolePrincipalGrant _elem92;
   for (int _i93 = 0; _i93 < _list91.size; ++_i93)
   {
    _elem92 = new RolePrincipalGrant();
    _elem92.read(iprot);
    struct.principalGrants.add(_elem92);
   }
  }
  struct.setPrincipalGrantsIsSet(true);
 }
}
origin: apache/hive

@Override
public boolean equals(Object that) {
 if (that == null)
  return false;
 if (that instanceof RolePrincipalGrant)
  return this.equals((RolePrincipalGrant)that);
 return false;
}
origin: apache/hive

/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
 if (field == null) {
  throw new IllegalArgumentException();
 }
 switch (field) {
 case ROLE_NAME:
  return isSetRoleName();
 case PRINCIPAL_NAME:
  return isSetPrincipalName();
 case PRINCIPAL_TYPE:
  return isSetPrincipalType();
 case GRANT_OPTION:
  return isSetGrantOption();
 case GRANT_TIME:
  return isSetGrantTime();
 case GRANTOR_NAME:
  return isSetGrantorName();
 case GRANTOR_PRINCIPAL_TYPE:
  return isSetGrantorPrincipalType();
 }
 throw new IllegalStateException();
}
origin: apache/hive

static String writeRoleGrantsInfo(List<RolePrincipalGrant> roleGrants, boolean testMode) {
 if (roleGrants == null || roleGrants.isEmpty()) {
  return "";
 }
 StringBuilder builder = new StringBuilder();
 //sort the list to get sorted (deterministic) output (for ease of testing)
 Collections.sort(roleGrants);
 for (RolePrincipalGrant roleGrant : roleGrants) {
  appendNonNull(builder, roleGrant.getRoleName(), true);
  appendNonNull(builder, roleGrant.isGrantOption());
  appendNonNull(builder, testMode ? -1 : roleGrant.getGrantTime() * 1000L);
  appendNonNull(builder, roleGrant.getGrantorName());
 }
 return builder.toString();
}
origin: prestosql/presto

public static RoleGrant fromRolePrincipalGrant(RolePrincipalGrant grant)
{
  return new RoleGrant(
      new PrestoPrincipal(fromMetastoreApiPrincipalType(grant.getPrincipalType()), grant.getPrincipalName()),
      grant.getRoleName(),
      grant.isGrantOption());
}
origin: prestosql/presto

@Override
public void grantRole(String role, String granteeName, PrincipalType granteeType, String grantorName, PrincipalType grantorType, boolean grantOption)
    throws TException
{
  List<RolePrincipalGrant> grants = listRoleGrants(granteeName, granteeType);
  for (RolePrincipalGrant grant : grants) {
    if (grant.getRoleName().equals(role)) {
      if (grant.isGrantOption() == grantOption) {
        return;
      }
      if (!grant.isGrantOption() && grantOption) {
        revokeRole(role, granteeName, granteeType, false);
        break;
      }
    }
  }
  createGrant(role, granteeName, granteeType, grantorName, grantorType, grantOption);
}
origin: apache/hive

public RolePrincipalGrant deepCopy() {
 return new RolePrincipalGrant(this);
}
origin: apache/hive

/**
 * Add role names of parentRoles and its parents to processedRolesMap
 *
 * @param processedRolesMap
 * @param roleGrants
 * @throws TException
 * @throws HiveAuthzPluginException
 * @throws MetaException
 */
private void getAllRoleAncestors(Map<String, HiveRoleGrant> processedRolesMap, List<RolePrincipalGrant> roleGrants)
  throws MetaException, HiveAuthzPluginException, TException {
 for (RolePrincipalGrant parentRoleGrant : roleGrants) {
  String parentRoleName = parentRoleGrant.getRoleName();
  if (processedRolesMap.get(parentRoleName) == null) {
   // unprocessed role: get its parents, add it to processed, and call this
   // function recursively
   List<RolePrincipalGrant> nextParentRoles = getRoleGrants(parentRoleName, PrincipalType.ROLE);
   processedRolesMap.put(parentRoleName, new HiveRoleGrant(parentRoleGrant));
   getAllRoleAncestors(processedRolesMap, nextParentRoles);
  }
 }
}
origin: apache/hive

lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
if (lastComparison != 0) {
 return lastComparison;
if (isSetRoleName()) {
 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
 if (lastComparison != 0) {
lastComparison = Boolean.valueOf(isSetPrincipalName()).compareTo(other.isSetPrincipalName());
if (lastComparison != 0) {
 return lastComparison;
if (isSetPrincipalName()) {
 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.principalName, other.principalName);
 if (lastComparison != 0) {
lastComparison = Boolean.valueOf(isSetPrincipalType()).compareTo(other.isSetPrincipalType());
if (lastComparison != 0) {
 return lastComparison;
if (isSetPrincipalType()) {
 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.principalType, other.principalType);
 if (lastComparison != 0) {
lastComparison = Boolean.valueOf(isSetGrantOption()).compareTo(other.isSetGrantOption());
if (lastComparison != 0) {
 return lastComparison;
if (isSetGrantOption()) {
origin: apache/drill

static String writeRoleGrantsInfo(List<RolePrincipalGrant> roleGrants, boolean testMode) {
 if (roleGrants == null || roleGrants.isEmpty()) {
  return "";
 }
 StringBuilder builder = new StringBuilder();
 //sort the list to get sorted (deterministic) output (for ease of testing)
 Collections.sort(roleGrants);
 for (RolePrincipalGrant roleGrant : roleGrants) {
  appendNonNull(builder, roleGrant.getRoleName(), true);
  appendNonNull(builder, roleGrant.isGrantOption());
  appendNonNull(builder, testMode ? -1 : roleGrant.getGrantTime() * 1000L);
  appendNonNull(builder, roleGrant.getGrantorName());
 }
 return builder.toString();
}
origin: prestosql/presto

@Override
public void revokeRole(String role, String granteeName, PrincipalType granteeType, boolean grantOption)
    throws TException
{
  List<RolePrincipalGrant> grants = listRoleGrants(granteeName, granteeType);
  RolePrincipalGrant currentGrant = null;
  for (RolePrincipalGrant grant : grants) {
    if (grant.getRoleName().equals(role)) {
      currentGrant = grant;
      break;
    }
  }
  if (currentGrant == null) {
    return;
  }
  if (!currentGrant.isGrantOption() && grantOption) {
    return;
  }
  removeGrant(role, granteeName, granteeType, grantOption);
}
origin: apache/hive

/**
 * Performs a deep copy on <i>other</i>.
 */
public GetPrincipalsInRoleResponse(GetPrincipalsInRoleResponse other) {
 if (other.isSetPrincipalGrants()) {
  List<RolePrincipalGrant> __this__principalGrants = new ArrayList<RolePrincipalGrant>(other.principalGrants.size());
  for (RolePrincipalGrant other_element : other.principalGrants) {
   __this__principalGrants.add(new RolePrincipalGrant(other_element));
  }
  this.principalGrants = __this__principalGrants;
 }
}
origin: apache/drill

/**
 * Add role names of parentRoles and its parents to processedRolesMap
 *
 * @param processedRolesMap
 * @param roleGrants
 * @throws TException
 * @throws HiveAuthzPluginException
 * @throws MetaException
 */
private void getAllRoleAncestors(Map<String, HiveRoleGrant> processedRolesMap, List<RolePrincipalGrant> roleGrants)
  throws MetaException, HiveAuthzPluginException, TException {
 for (RolePrincipalGrant parentRoleGrant : roleGrants) {
  String parentRoleName = parentRoleGrant.getRoleName();
  if (processedRolesMap.get(parentRoleName) == null) {
   // unprocessed role: get its parents, add it to processed, and call this
   // function recursively
   List<RolePrincipalGrant> nextParentRoles = getRoleGrants(parentRoleName, PrincipalType.ROLE);
   processedRolesMap.put(parentRoleName, new HiveRoleGrant(parentRoleGrant));
   getAllRoleAncestors(processedRolesMap, nextParentRoles);
  }
 }
}
origin: apache/hive

public Object getFieldValue(_Fields field) {
 switch (field) {
 case ROLE_NAME:
  return getRoleName();
 case PRINCIPAL_NAME:
  return getPrincipalName();
 case PRINCIPAL_TYPE:
  return getPrincipalType();
 case GRANT_OPTION:
  return isGrantOption();
 case GRANT_TIME:
  return getGrantTime();
 case GRANTOR_NAME:
  return getGrantorName();
 case GRANTOR_PRINCIPAL_TYPE:
  return getGrantorPrincipalType();
 }
 throw new IllegalStateException();
}
origin: apache/hive

TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetRoleName()) {
 optionals.set(0);
if (struct.isSetPrincipalName()) {
 optionals.set(1);
if (struct.isSetPrincipalType()) {
 optionals.set(2);
if (struct.isSetGrantOption()) {
 optionals.set(3);
if (struct.isSetGrantTime()) {
 optionals.set(4);
if (struct.isSetGrantorName()) {
 optionals.set(5);
if (struct.isSetGrantorPrincipalType()) {
 optionals.set(6);
if (struct.isSetRoleName()) {
 oprot.writeString(struct.roleName);
if (struct.isSetPrincipalName()) {
 oprot.writeString(struct.principalName);
origin: com.facebook.presto.hive/hive-apache

static String writeRoleGrantsInfo(List<RolePrincipalGrant> roleGrants, boolean testMode) {
 if (roleGrants == null || roleGrants.isEmpty()) {
  return "";
 }
 StringBuilder builder = new StringBuilder();
 //sort the list to get sorted (deterministic) output (for ease of testing)
 Collections.sort(roleGrants);
 for (RolePrincipalGrant roleGrant : roleGrants) {
  appendNonNull(builder, roleGrant.getRoleName(), true);
  appendNonNull(builder, roleGrant.isGrantOption());
  appendNonNull(builder, testMode ? -1 : roleGrant.getGrantTime() * 1000L);
  appendNonNull(builder, roleGrant.getGrantorName());
 }
 return builder.toString();
}
origin: apache/hive

 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, GetPrincipalsInRoleResponse struct) throws org.apache.thrift.TException {
  TTupleProtocol iprot = (TTupleProtocol) prot;
  {
   org.apache.thrift.protocol.TList _list99 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
   struct.principalGrants = new ArrayList<RolePrincipalGrant>(_list99.size);
   RolePrincipalGrant _elem100;
   for (int _i101 = 0; _i101 < _list99.size; ++_i101)
   {
    _elem100 = new RolePrincipalGrant();
    _elem100.read(iprot);
    struct.principalGrants.add(_elem100);
   }
  }
  struct.setPrincipalGrantsIsSet(true);
 }
}
origin: apache/hive

/**
 * Performs a deep copy on <i>other</i>.
 */
public GetRoleGrantsForPrincipalResponse(GetRoleGrantsForPrincipalResponse other) {
 if (other.isSetPrincipalGrants()) {
  List<RolePrincipalGrant> __this__principalGrants = new ArrayList<RolePrincipalGrant>(other.principalGrants.size());
  for (RolePrincipalGrant other_element : other.principalGrants) {
   __this__principalGrants.add(new RolePrincipalGrant(other_element));
  }
  this.principalGrants = __this__principalGrants;
 }
}
origin: com.facebook.presto.hive/hive-apache

/**
 * Add role names of parentRoles and its parents to processedRolesMap
 *
 * @param processedRolesMap
 * @param roleGrants
 * @throws TException
 * @throws HiveAuthzPluginException
 * @throws MetaException
 */
private void getAllRoleAncestors(Map<String, HiveRoleGrant> processedRolesMap, List<RolePrincipalGrant> roleGrants)
  throws MetaException, HiveAuthzPluginException, TException {
 for (RolePrincipalGrant parentRoleGrant : roleGrants) {
  String parentRoleName = parentRoleGrant.getRoleName();
  if (processedRolesMap.get(parentRoleName) == null) {
   // unprocessed role: get its parents, add it to processed, and call this
   // function recursively
   List<RolePrincipalGrant> nextParentRoles = getRoleGrants(parentRoleName, PrincipalType.ROLE);
   processedRolesMap.put(parentRoleName, new HiveRoleGrant(parentRoleGrant));
   getAllRoleAncestors(processedRolesMap, nextParentRoles);
  }
 }
}
org.apache.hadoop.hive.metastore.apiRolePrincipalGrant

Most used methods

  • getPrincipalName
  • getPrincipalType
  • getRoleName
  • isGrantOption
  • getGrantTime
  • getGrantorName
  • getGrantorPrincipalType
  • <init>
    Performs a deep copy on other.
  • equals
  • isSetGrantOption
    Returns true if field grantOption is set (has been assigned a value) and false otherwise
  • isSetGrantTime
    Returns true if field grantTime is set (has been assigned a value) and false otherwise
  • isSetGrantorName
    Returns true if field grantorName is set (has been assigned a value) and false otherwise
  • isSetGrantTime,
  • isSetGrantorName,
  • isSetGrantorPrincipalType,
  • isSetPrincipalName,
  • isSetPrincipalType,
  • isSetRoleName,
  • read,
  • setGrantOption,
  • setGrantOptionIsSet,
  • setGrantTime

Popular in Java

  • Start an intent from android
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setContentView (Activity)
  • getSharedPreferences (Context)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Notification (javax.management)
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now