public Object getFieldValue(_Fields field) { switch (field) { case VALUE: return getValue(); case MESSAGE: return getMessage(); case STACK: return getStack(); } throw new IllegalStateException(); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TSentryResponseStatus) return this.equals((TSentryResponseStatus)that); return false; }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsResponse struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(); struct.status.read(iprot); struct.setStatusIsSet(true); } }
private static String serverErrorToString(TSentryResponseStatus thriftStatus) { String msg = thriftStatus.getMessage(); String stack = thriftStatus.getStack(); if (stack == null) { return msg; } return msg + ". Server Stacktrace: " + stack; } }
/** * Performs a deep copy on <i>other</i>. */ public TSentryResponseStatus(TSentryResponseStatus other) { __isset_bitfield = other.__isset_bitfield; this.value = other.value; if (other.isSetMessage()) { this.message = other.message; } if (other.isSetStack()) { this.stack = other.stack; } }
private Status fromTSentryStatus(TSentryResponseStatus status) { return Status.fromCode(status.getValue()); }
public void setFieldValue(_Fields field, Object value) { switch (field) { case VALUE: if (value == null) { unsetValue(); } else { setValue((Integer)value); } break; case MESSAGE: if (value == null) { unsetMessage(); } else { setMessage((String)value); } break; case STACK: if (value == null) { unsetStack(); } else { setStack((String)value); } break; } }
public static void throwIfNotOk(TSentryResponseStatus thriftStatus) throws SentryUserException { Status status = Status.fromCode(thriftStatus.getValue()); switch(status) { case OK: break; case ALREADY_EXISTS: throw new SentryAlreadyExistsException(serverErrorToString(thriftStatus), thriftStatus.getMessage()); case NO_SUCH_OBJECT: throw new SentryNoSuchObjectException(serverErrorToString(thriftStatus), thriftStatus.getMessage()); case RUNTIME_ERROR: throw new RuntimeException(serverErrorToString(thriftStatus)); case INVALID_INPUT: throw new SentryInvalidInputException(serverErrorToString(thriftStatus), thriftStatus.getMessage()); case ACCESS_DENIED: throw new SentryAccessDeniedException(serverErrorToString(thriftStatus), thriftStatus.getMessage()); case THRIFT_VERSION_MISMATCH: throw new SentryThriftAPIMismatchException(serverErrorToString(thriftStatus), thriftStatus.getMessage()); case UNKNOWN: throw new AssertionError(serverErrorToString(thriftStatus)); default: throw new AssertionError("Unknown status code: " + status + ". Msg: " + serverErrorToString(thriftStatus)); } }
/** 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 VALUE: return isSetValue(); case MESSAGE: return isSetMessage(); case STACK: return isSetStack(); } throw new IllegalStateException(); }
public static TSentryResponseStatus Create(Status value, String message, @Nullable Throwable t) { TSentryResponseStatus status = new TSentryResponseStatus(); status.setValue(value.getCode()); status.setMessage(message); if (t != null) { StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); t.printStackTrace(printWriter); printWriter.close(); status.setStack(stringWriter.toString()); } return status; } public static void throwIfNotOk(TSentryResponseStatus thriftStatus)
public void validate() throws org.apache.thrift.TException { // check for required fields if (!isSetValue()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'value' is unset! Struct:" + toString()); } if (!isSetMessage()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'message' is unset! Struct:" + toString()); } // check for sub-struct validity }
public void write(org.apache.thrift.protocol.TProtocol oprot, TSentryResponseStatus struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(VALUE_FIELD_DESC); oprot.writeI32(struct.value); oprot.writeFieldEnd(); if (struct.message != null) { oprot.writeFieldBegin(MESSAGE_FIELD_DESC); oprot.writeString(struct.message); oprot.writeFieldEnd(); } if (struct.stack != null) { if (struct.isSetStack()) { oprot.writeFieldBegin(STACK_FIELD_DESC); oprot.writeString(struct.stack); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
/** * Performs a deep copy on <i>other</i>. */ public TDropSentryRoleResponse(TDropSentryRoleResponse other) { if (other.isSetStatus()) { this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status); } }
@Override public String toString() { StringBuilder sb = new StringBuilder("TSentryResponseStatus("); boolean first = true; sb.append("value:"); sb.append(this.value); first = false; if (!first) sb.append(", "); sb.append("message:"); if (this.message == null) { sb.append("null"); } else { sb.append(this.message); } first = false; if (isSetStack()) { if (!first) sb.append(", "); sb.append("stack:"); if (this.stack == null) { sb.append("null"); } else { sb.append(this.stack); } first = false; } sb.append(")"); return sb.toString(); }
private Status fromTSentryStatus(TSentryResponseStatus status) { return Status.fromCode(status.getValue()); }
public void setFieldValue(_Fields field, Object value) { switch (field) { case VALUE: if (value == null) { unsetValue(); } else { setValue((Integer)value); } break; case MESSAGE: if (value == null) { unsetMessage(); } else { setMessage((String)value); } break; case STACK: if (value == null) { unsetStack(); } else { setStack((String)value); } break; } }
public static void throwIfNotOk(TSentryResponseStatus thriftStatus) throws SentryUserException { Status status = Status.fromCode(thriftStatus.getValue()); switch(status) { case OK: break; case ALREADY_EXISTS: throw new SentryAlreadyExistsException(serverErrorToString(thriftStatus), thriftStatus.getMessage()); case NO_SUCH_OBJECT: throw new SentryNoSuchObjectException(serverErrorToString(thriftStatus), thriftStatus.getMessage()); case RUNTIME_ERROR: throw new RuntimeException(serverErrorToString(thriftStatus)); case INVALID_INPUT: throw new SentryInvalidInputException(serverErrorToString(thriftStatus), thriftStatus.getMessage()); case ACCESS_DENIED: throw new SentryAccessDeniedException(serverErrorToString(thriftStatus), thriftStatus.getMessage()); case THRIFT_VERSION_MISMATCH: throw new SentryThriftAPIMismatchException(serverErrorToString(thriftStatus), thriftStatus.getMessage()); case UNKNOWN: throw new AssertionError(serverErrorToString(thriftStatus)); default: throw new AssertionError("Unknown status code: " + status + ". Msg: " + serverErrorToString(thriftStatus)); } }
/** 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 VALUE: return isSetValue(); case MESSAGE: return isSetMessage(); case STACK: return isSetStack(); } throw new IllegalStateException(); }
private static String serverErrorToString(TSentryResponseStatus thriftStatus) { String msg = thriftStatus.getMessage(); String stack = thriftStatus.getStack(); if (stack == null) { return msg; } return msg + ". Server Stacktrace: " + stack; } }
public static TSentryResponseStatus Create(Status value, String message, @Nullable Throwable t) { TSentryResponseStatus status = new TSentryResponseStatus(); status.setValue(value.getCode()); status.setMessage(message); if (t != null) { StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); t.printStackTrace(printWriter); printWriter.close(); status.setStack(stringWriter.toString()); } return status; } public static void throwIfNotOk(TSentryResponseStatus thriftStatus)