Java Code Examples for org.apache.hadoop.hive.metastore.api.LockRequest#getComponent()

The following examples show how to use org.apache.hadoop.hive.metastore.api.LockRequest#getComponent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DatabaseMappingImpl.java    From waggle-dance with Apache License 2.0 5 votes vote down vote up
@Override
public LockRequest transformInboundLockRequest(LockRequest request) {
  if (request.isSetComponent()) {
    for (LockComponent component : request.getComponent()) {
      component.setDbname(metaStoreMapping.transformInboundDatabaseName(component.getDbname()));
    }
  }
  return request;
}
 
Example 2
Source File: FederatedHMSHandler.java    From waggle-dance with Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public LockResponse lock(LockRequest rqst) throws NoSuchTxnException, TxnAbortedException, TException {
  DatabaseMapping mapping = databaseMappingService.primaryDatabaseMapping();
  List<LockComponent> components = rqst.getComponent();
  for (LockComponent component : components) {
    mapping.checkWritePermissions(component.getDbname());
  }
  return mapping.getClient().lock(mapping.transformInboundLockRequest(rqst));
}
 
Example 3
Source File: DatabaseMappingImplTest.java    From waggle-dance with Apache License 2.0 5 votes vote down vote up
@Test
public void transformInboundLockRequest() throws Exception {
  LockRequest lockRequest = new LockRequest();
  LockComponent lockComponent = new LockComponent();
  lockComponent.setDbname(DB_NAME);
  List<LockComponent> components = Lists.newArrayList(lockComponent);
  lockRequest.setComponent(components);
  LockRequest result = databaseMapping.transformInboundLockRequest(lockRequest);
  assertThat(result, is(sameInstance(lockRequest)));
  List<LockComponent> resultComponents = result.getComponent();
  assertThat(resultComponents, is(sameInstance(components)));
  LockComponent resultComponent = resultComponents.get(0);
  assertThat(resultComponent, is(sameInstance(lockComponent)));
  assertThat(resultComponent.getDbname(), is(IN_DB_NAME));
}