use of org.apache.hadoop.hive.metastore.api.PrincipalType in project hive by apache.
the class ObjectStore method convertTable.
private List<HiveObjectPrivilege> convertTable(List<MTablePrivilege> privs) {
List<HiveObjectPrivilege> result = new ArrayList<>();
for (MTablePrivilege priv : privs) {
String pname = priv.getPrincipalName();
String authorizer = priv.getAuthorizer();
PrincipalType ptype = PrincipalType.valueOf(priv.getPrincipalType());
String table = priv.getTable().getTableName();
String database = priv.getTable().getDatabase().getName();
HiveObjectRef objectRef = new HiveObjectRef(HiveObjectType.TABLE, database, table, null, null);
objectRef.setCatName(priv.getTable().getDatabase().getCatalogName());
PrivilegeGrantInfo grantor = new PrivilegeGrantInfo(priv.getPrivilege(), priv.getCreateTime(), priv.getGrantor(), PrincipalType.valueOf(priv.getGrantorType()), priv.getGrantOption());
result.add(new HiveObjectPrivilege(objectRef, pname, ptype, grantor, authorizer));
}
return result;
}
use of org.apache.hadoop.hive.metastore.api.PrincipalType in project hive by apache.
the class ObjectStore method convertDB.
private List<HiveObjectPrivilege> convertDB(List<MDBPrivilege> privs) {
List<HiveObjectPrivilege> result = new ArrayList<>();
for (MDBPrivilege priv : privs) {
String pname = priv.getPrincipalName();
String authorizer = priv.getAuthorizer();
PrincipalType ptype = PrincipalType.valueOf(priv.getPrincipalType());
String database = priv.getDatabase().getName();
HiveObjectRef objectRef = new HiveObjectRef(HiveObjectType.DATABASE, database, null, null, null);
objectRef.setCatName(priv.getDatabase().getCatalogName());
PrivilegeGrantInfo grantor = new PrivilegeGrantInfo(priv.getPrivilege(), priv.getCreateTime(), priv.getGrantor(), PrincipalType.valueOf(priv.getGrantorType()), priv.getGrantOption());
result.add(new HiveObjectPrivilege(objectRef, pname, ptype, grantor, authorizer));
}
return result;
}
use of org.apache.hadoop.hive.metastore.api.PrincipalType in project hive by apache.
the class ObjectStore method getDataConnector.
@Override
public DataConnector getDataConnector(String name) throws NoSuchObjectException {
MDataConnector mdc = null;
boolean commited = false;
try {
openTransaction();
mdc = getMDataConnector(name);
commited = commitTransaction();
} catch (NoSuchObjectException no) {
throw new NoSuchObjectException("Dataconnector named " + name + " does not exist:" + no.getCause());
} finally {
if (!commited) {
rollbackTransaction();
}
}
DataConnector connector = new DataConnector();
connector.setName(mdc.getName());
connector.setType(mdc.getType());
connector.setUrl(mdc.getUrl());
connector.setDescription(mdc.getDescription());
connector.setParameters(convertMap(mdc.getParameters()));
connector.setOwnerName(mdc.getOwnerName());
String type = org.apache.commons.lang3.StringUtils.defaultIfBlank(mdc.getOwnerType(), null);
PrincipalType principalType = (type == null) ? null : PrincipalType.valueOf(type);
connector.setOwnerType(principalType);
connector.setCreateTime(mdc.getCreateTime());
return connector;
}
use of org.apache.hadoop.hive.metastore.api.PrincipalType in project hive by apache.
the class ObjectStore method convertDC.
private List<HiveObjectPrivilege> convertDC(List<MDCPrivilege> privs) {
List<HiveObjectPrivilege> result = new ArrayList<>();
for (MDCPrivilege priv : privs) {
String pname = priv.getPrincipalName();
String authorizer = priv.getAuthorizer();
PrincipalType ptype = PrincipalType.valueOf(priv.getPrincipalType());
String dataConnectorName = priv.getDataConnector().getName();
HiveObjectRef objectRef = new HiveObjectRef(HiveObjectType.DATACONNECTOR, null, dataConnectorName, null, null);
PrivilegeGrantInfo grantor = new PrivilegeGrantInfo(priv.getPrivilege(), priv.getCreateTime(), priv.getGrantor(), PrincipalType.valueOf(priv.getGrantorType()), priv.getGrantOption());
result.add(new HiveObjectPrivilege(objectRef, pname, ptype, grantor, authorizer));
}
return result;
}
Aggregations