/** * Connects to HMS by creating HiveMetaStoreClient. * * @throws IOException if could not establish connection * @throws InterruptedException if connection was interrupted * @throws MetaException if other errors happened */ public void connect() throws IOException, InterruptedException, MetaException { if (client != null) { return; } client = hiveConnectionFactory.connect().getClient(); }
private static String serverErrorToString(TSentryResponseStatus thriftStatus) { String msg = thriftStatus.getMessage(); String stack = thriftStatus.getStack(); if (stack == null) { return msg; } return msg + ". Server Stacktrace: " + stack; } }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddUsersResponse struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; struct.status.write(oprot); }
@Override public void close() { if (client != null) { // Close any outstanding connections to HMS try { client.disconnect(); SentryStateBank.disableState(HMSFollowerState.COMPONENT,HMSFollowerState.CONNECTED); } catch (Exception failure) { LOGGER.error("Failed to close the Sentry Hms Client", failure); } } notificationFetcher.close(); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TSentryResponseStatus) return this.equals((TSentryResponseStatus)that); return false; }
/** * Fetch new HMS notifications appeared since a specified event ID. The returned list may * include notifications with the same specified ID if they were not seen by Sentry. * * @param lastEventId The event ID to use to request notifications. * @return A list of newer notifications unseen by Sentry. * @throws Exception If an error occurs on the HMS communication. */ public List<NotificationEvent> fetchNotifications(long lastEventId) throws Exception { return fetchNotifications(lastEventId, Integer.MAX_VALUE); }
protected void runTestAsSubject(final TestOperation test) throws Exception { /*if (false) { clientUgi.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { test.runTestAsSubject(); return null; }}); } else { */ test.runTestAsSubject(); //} }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesResponse struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; struct.status.write(oprot); }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsResponse struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; struct.status.write(oprot); }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleResponse struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; struct.status.write(oprot); }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeResponse struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; struct.status.write(oprot); }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleResponse struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; struct.status.write(oprot); }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleResponse struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; struct.status.write(oprot); }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteUsersResponse struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; struct.status.write(oprot); }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesResponse struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; struct.status.write(oprot); }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesResponse struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; struct.status.write(oprot); }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsResponse struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; struct.status.write(oprot); }