Package org.apache.hadoop.hive.metastore.api

Examples of org.apache.hadoop.hive.metastore.api.Role


      Boolean ret = null;
      try {
        ret = executeWithRetry(new Command<Boolean>() {
          @Override
          public Boolean run(RawStore ms) throws Exception {
            Role role = ms.getRole(roleName);
            return ms.grantRole(role, userName, principalType, grantor, grantorType, grantOption);
          }
        });
      } catch (MetaException e) {
        throw e;
View Full Code Here


            List<Role> result = new ArrayList<Role>();
            List<MRoleMap> roleMap = ms.listRoles(principalName, principalType);
            if (roleMap!=null) {
              for (MRoleMap role : roleMap) {
                MRole r = role.getRole();
                result.add(new Role(r.getRoleName(), r
                    .getCreateTime(), r.getOwnerName()));
              }
            }
            return result;
          }
View Full Code Here

      Boolean ret = null;
      try {
        ret = executeWithRetry(new Command<Boolean>() {
          @Override
          public Boolean run(RawStore ms) throws Exception {
            Role mRole = ms.getRole(roleName);
            return ms.revokeRole(mRole, userName, principalType);
          }
        });
      } catch (MetaException e) {
        throw e;
View Full Code Here

  }

  public void createRole(String roleName, String ownerName)
      throws HiveException {
    try {
      getMSC().create_role(new Role(roleName, -1, ownerName));
    } catch (Exception e) {
      throw new HiveException(e);
    }
  }
View Full Code Here

  public Role getRole(String roleName) throws NoSuchObjectException {
    MRole mRole = this.getMRole(roleName);
    if (mRole == null) {
      throw new NoSuchObjectException(roleName + " role can not be found.");
    }
    Role ret = new Role(mRole.getRoleName(), mRole.getCreateTime(), mRole
        .getOwnerName());
    return ret;
  }
View Full Code Here

  }

  public void createRole(String roleName, String ownerName)
      throws HiveException {
    try {
      getMSC().create_role(new Role(roleName, -1, ownerName));
    } catch (Exception e) {
      throw new HiveException(e);
    }
  }
View Full Code Here

  public Role getRole(String roleName) throws NoSuchObjectException {
    MRole mRole = this.getMRole(roleName);
    if (mRole == null) {
      throw new NoSuchObjectException(roleName + " role can not be found.");
    }
    Role ret = new Role(mRole.getRoleName(), mRole.getCreateTime(), mRole
        .getOwnerName());
    return ret;
  }
View Full Code Here

      if (!users.hasNext()) {
        LOG.info("No user is added in admin role, since config value "+ userStr +
          " is in incorrect format. We accept comma seprated list of users.");
        return;
      }
      Role adminRole;
      RawStore ms = getMS();
      try {
        adminRole = ms.getRole(ADMIN);
      } catch (NoSuchObjectException e) {
        LOG.error("Failed to retrieve just added admin role",e);
View Full Code Here

        + " belong to " + PUBLIC + " role.");
      }
      Boolean ret = null;
      try {
        RawStore ms = getMS();
        Role role = ms.getRole(roleName);
        if(principalType == PrincipalType.ROLE){
          //check if this grant statement will end up creating a cycle
          if(isNewRoleAParent(principalName, roleName)){
            throw new MetaException("Cannot grant role " + principalName + " to " + roleName +
                " as " + roleName + " already belongs to the role " + principalName +
View Full Code Here

      try {
        List<MRoleMap> roleMaps = getMS().listRoles(principalName, principalType);
        if (roleMaps != null) {
          for (MRoleMap roleMap : roleMaps) {
            MRole mrole = roleMap.getRole();
            Role role = new Role(mrole.getRoleName(), mrole.getCreateTime(), mrole.getOwnerName());
            result.add(role);
          }
        }
        // all users by default belongs to public role
        result.add(new Role(PUBLIC,0,PUBLIC));
        return result;
      } catch (MetaException e) {
        throw e;
      } catch (Exception e) {
        throw new RuntimeException(e);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.metastore.api.Role

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.