SENTRY-2243: Extend the thrift definition for policy service to learn owner information (Kalyan Kumar kalvagadda, reviewed-by Na Li, Sergio Pena)
Project: http://git-wip-us.apache.org/repos/asf/sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/f4621490 Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/f4621490 Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/f4621490 Branch: refs/heads/master Commit: f462149080a77ca96c752be578062073e632e93f Parents: e6703a5 Author: Kalyan Kumar Kalvagadda <kkal...@cloudera.com> Authored: Thu May 31 14:02:03 2018 -0500 Committer: Kalyan Kumar Kalvagadda <kkal...@cloudera.com> Committed: Thu May 31 14:02:03 2018 -0500 ---------------------------------------------------------------------- .../api/service/thrift/SentryPolicyService.java | 858 ++++++++++++++++++ .../thrift/TSentryHmsEventNotification.java | 905 +++++++++++++++++++ .../TSentryHmsEventNotificationResponse.java | 493 ++++++++++ .../service/thrift/TSentryObjectOwnerType.java | 45 + .../main/resources/sentry_policy_service.thrift | 32 + .../thrift/SentryPolicyStoreProcessor.java | 9 + 6 files changed, 2342 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sentry/blob/f4621490/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/SentryPolicyService.java ---------------------------------------------------------------------- diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/SentryPolicyService.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/SentryPolicyService.java index fbbd725..cc9a682 100644 --- a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/SentryPolicyService.java +++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/SentryPolicyService.java @@ -77,6 +77,8 @@ public class SentryPolicyService { public TSentrySyncIDResponse sentry_sync_notifications(TSentrySyncIDRequest request) throws org.apache.thrift.TException; + public TSentryHmsEventNotificationResponse sentry_notify_hms_event(TSentryHmsEventNotification request) throws org.apache.thrift.TException; + } public interface AsyncIface { @@ -119,6 +121,8 @@ public class SentryPolicyService { public void sentry_sync_notifications(TSentrySyncIDRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void sentry_notify_hms_event(TSentryHmsEventNotification request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + } public static class Client extends org.apache.thrift.TServiceClient implements Iface { @@ -578,6 +582,29 @@ public class SentryPolicyService { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "sentry_sync_notifications failed: unknown result"); } + public TSentryHmsEventNotificationResponse sentry_notify_hms_event(TSentryHmsEventNotification request) throws org.apache.thrift.TException + { + send_sentry_notify_hms_event(request); + return recv_sentry_notify_hms_event(); + } + + public void send_sentry_notify_hms_event(TSentryHmsEventNotification request) throws org.apache.thrift.TException + { + sentry_notify_hms_event_args args = new sentry_notify_hms_event_args(); + args.setRequest(request); + sendBase("sentry_notify_hms_event", args); + } + + public TSentryHmsEventNotificationResponse recv_sentry_notify_hms_event() throws org.apache.thrift.TException + { + sentry_notify_hms_event_result result = new sentry_notify_hms_event_result(); + receiveBase(result, "sentry_notify_hms_event"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "sentry_notify_hms_event failed: unknown result"); + } + } public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> { @@ -1204,6 +1231,38 @@ public class SentryPolicyService { } } + public void sentry_notify_hms_event(TSentryHmsEventNotification request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + sentry_notify_hms_event_call method_call = new sentry_notify_hms_event_call(request, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sentry_notify_hms_event_call extends org.apache.thrift.async.TAsyncMethodCall { + private TSentryHmsEventNotification request; + public sentry_notify_hms_event_call(TSentryHmsEventNotification request, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.request = request; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("sentry_notify_hms_event", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sentry_notify_hms_event_args args = new sentry_notify_hms_event_args(); + args.setRequest(request); + args.write(prot); + prot.writeMessageEnd(); + } + + public TSentryHmsEventNotificationResponse getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sentry_notify_hms_event(); + } + } + } public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor { @@ -1236,6 +1295,7 @@ public class SentryPolicyService { processMap.put("export_sentry_mapping_data", new export_sentry_mapping_data()); processMap.put("import_sentry_mapping_data", new import_sentry_mapping_data()); processMap.put("sentry_sync_notifications", new sentry_sync_notifications()); + processMap.put("sentry_notify_hms_event", new sentry_notify_hms_event()); return processMap; } @@ -1619,6 +1679,26 @@ public class SentryPolicyService { } } + public static class sentry_notify_hms_event<I extends Iface> extends org.apache.thrift.ProcessFunction<I, sentry_notify_hms_event_args> { + public sentry_notify_hms_event() { + super("sentry_notify_hms_event"); + } + + public sentry_notify_hms_event_args getEmptyArgsInstance() { + return new sentry_notify_hms_event_args(); + } + + protected boolean isOneway() { + return false; + } + + public sentry_notify_hms_event_result getResult(I iface, sentry_notify_hms_event_args args) throws org.apache.thrift.TException { + sentry_notify_hms_event_result result = new sentry_notify_hms_event_result(); + result.success = iface.sentry_notify_hms_event(args.request); + return result; + } + } + } public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> { @@ -1651,6 +1731,7 @@ public class SentryPolicyService { processMap.put("export_sentry_mapping_data", new export_sentry_mapping_data()); processMap.put("import_sentry_mapping_data", new import_sentry_mapping_data()); processMap.put("sentry_sync_notifications", new sentry_sync_notifications()); + processMap.put("sentry_notify_hms_event", new sentry_notify_hms_event()); return processMap; } @@ -2623,6 +2704,57 @@ public class SentryPolicyService { } } + public static class sentry_notify_hms_event<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, sentry_notify_hms_event_args, TSentryHmsEventNotificationResponse> { + public sentry_notify_hms_event() { + super("sentry_notify_hms_event"); + } + + public sentry_notify_hms_event_args getEmptyArgsInstance() { + return new sentry_notify_hms_event_args(); + } + + public AsyncMethodCallback<TSentryHmsEventNotificationResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<TSentryHmsEventNotificationResponse>() { + public void onComplete(TSentryHmsEventNotificationResponse o) { + sentry_notify_hms_event_result result = new sentry_notify_hms_event_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + sentry_notify_hms_event_result result = new sentry_notify_hms_event_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, sentry_notify_hms_event_args args, org.apache.thrift.async.AsyncMethodCallback<TSentryHmsEventNotificationResponse> resultHandler) throws TException { + iface.sentry_notify_hms_event(args.request,resultHandler); + } + } + } public static class create_sentry_role_args implements org.apache.thrift.TBase<create_sentry_role_args, create_sentry_role_args._Fields>, java.io.Serializable, Cloneable, Comparable<create_sentry_role_args> { @@ -16419,4 +16551,730 @@ public class SentryPolicyService { } + public static class sentry_notify_hms_event_args implements org.apache.thrift.TBase<sentry_notify_hms_event_args, sentry_notify_hms_event_args._Fields>, java.io.Serializable, Cloneable, Comparable<sentry_notify_hms_event_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sentry_notify_hms_event_args"); + + private static final org.apache.thrift.protocol.TField REQUEST_FIELD_DESC = new org.apache.thrift.protocol.TField("request", org.apache.thrift.protocol.TType.STRUCT, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new sentry_notify_hms_event_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sentry_notify_hms_event_argsTupleSchemeFactory()); + } + + private TSentryHmsEventNotification request; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + REQUEST((short)1, "request"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // REQUEST + return REQUEST; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.REQUEST, new org.apache.thrift.meta_data.FieldMetaData("request", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryHmsEventNotification.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sentry_notify_hms_event_args.class, metaDataMap); + } + + public sentry_notify_hms_event_args() { + } + + public sentry_notify_hms_event_args( + TSentryHmsEventNotification request) + { + this(); + this.request = request; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public sentry_notify_hms_event_args(sentry_notify_hms_event_args other) { + if (other.isSetRequest()) { + this.request = new TSentryHmsEventNotification(other.request); + } + } + + public sentry_notify_hms_event_args deepCopy() { + return new sentry_notify_hms_event_args(this); + } + + @Override + public void clear() { + this.request = null; + } + + public TSentryHmsEventNotification getRequest() { + return this.request; + } + + public void setRequest(TSentryHmsEventNotification request) { + this.request = request; + } + + public void unsetRequest() { + this.request = null; + } + + /** Returns true if field request is set (has been assigned a value) and false otherwise */ + public boolean isSetRequest() { + return this.request != null; + } + + public void setRequestIsSet(boolean value) { + if (!value) { + this.request = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case REQUEST: + if (value == null) { + unsetRequest(); + } else { + setRequest((TSentryHmsEventNotification)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case REQUEST: + return getRequest(); + + } + throw new IllegalStateException(); + } + + /** 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 REQUEST: + return isSetRequest(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof sentry_notify_hms_event_args) + return this.equals((sentry_notify_hms_event_args)that); + return false; + } + + public boolean equals(sentry_notify_hms_event_args that) { + if (that == null) + return false; + + boolean this_present_request = true && this.isSetRequest(); + boolean that_present_request = true && that.isSetRequest(); + if (this_present_request || that_present_request) { + if (!(this_present_request && that_present_request)) + return false; + if (!this.request.equals(that.request)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_request = true && (isSetRequest()); + list.add(present_request); + if (present_request) + list.add(request); + + return list.hashCode(); + } + + @Override + public int compareTo(sentry_notify_hms_event_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetRequest()).compareTo(other.isSetRequest()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetRequest()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.request, other.request); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sentry_notify_hms_event_args("); + boolean first = true; + + sb.append("request:"); + if (this.request == null) { + sb.append("null"); + } else { + sb.append(this.request); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (request != null) { + request.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sentry_notify_hms_event_argsStandardSchemeFactory implements SchemeFactory { + public sentry_notify_hms_event_argsStandardScheme getScheme() { + return new sentry_notify_hms_event_argsStandardScheme(); + } + } + + private static class sentry_notify_hms_event_argsStandardScheme extends StandardScheme<sentry_notify_hms_event_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sentry_notify_hms_event_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // REQUEST + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.request = new TSentryHmsEventNotification(); + struct.request.read(iprot); + struct.setRequestIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sentry_notify_hms_event_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.request != null) { + oprot.writeFieldBegin(REQUEST_FIELD_DESC); + struct.request.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class sentry_notify_hms_event_argsTupleSchemeFactory implements SchemeFactory { + public sentry_notify_hms_event_argsTupleScheme getScheme() { + return new sentry_notify_hms_event_argsTupleScheme(); + } + } + + private static class sentry_notify_hms_event_argsTupleScheme extends TupleScheme<sentry_notify_hms_event_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sentry_notify_hms_event_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetRequest()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetRequest()) { + struct.request.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sentry_notify_hms_event_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.request = new TSentryHmsEventNotification(); + struct.request.read(iprot); + struct.setRequestIsSet(true); + } + } + } + + } + + public static class sentry_notify_hms_event_result implements org.apache.thrift.TBase<sentry_notify_hms_event_result, sentry_notify_hms_event_result._Fields>, java.io.Serializable, Cloneable, Comparable<sentry_notify_hms_event_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sentry_notify_hms_event_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new sentry_notify_hms_event_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sentry_notify_hms_event_resultTupleSchemeFactory()); + } + + private TSentryHmsEventNotificationResponse success; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short)0, "success"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryHmsEventNotificationResponse.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sentry_notify_hms_event_result.class, metaDataMap); + } + + public sentry_notify_hms_event_result() { + } + + public sentry_notify_hms_event_result( + TSentryHmsEventNotificationResponse success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public sentry_notify_hms_event_result(sentry_notify_hms_event_result other) { + if (other.isSetSuccess()) { + this.success = new TSentryHmsEventNotificationResponse(other.success); + } + } + + public sentry_notify_hms_event_result deepCopy() { + return new sentry_notify_hms_event_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public TSentryHmsEventNotificationResponse getSuccess() { + return this.success; + } + + public void setSuccess(TSentryHmsEventNotificationResponse success) { + this.success = success; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((TSentryHmsEventNotificationResponse)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + throw new IllegalStateException(); + } + + /** 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 SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof sentry_notify_hms_event_result) + return this.equals((sentry_notify_hms_event_result)that); + return false; + } + + public boolean equals(sentry_notify_hms_event_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) + list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(sentry_notify_hms_event_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sentry_notify_hms_event_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sentry_notify_hms_event_resultStandardSchemeFactory implements SchemeFactory { + public sentry_notify_hms_event_resultStandardScheme getScheme() { + return new sentry_notify_hms_event_resultStandardScheme(); + } + } + + private static class sentry_notify_hms_event_resultStandardScheme extends StandardScheme<sentry_notify_hms_event_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sentry_notify_hms_event_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new TSentryHmsEventNotificationResponse(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sentry_notify_hms_event_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class sentry_notify_hms_event_resultTupleSchemeFactory implements SchemeFactory { + public sentry_notify_hms_event_resultTupleScheme getScheme() { + return new sentry_notify_hms_event_resultTupleScheme(); + } + } + + private static class sentry_notify_hms_event_resultTupleScheme extends TupleScheme<sentry_notify_hms_event_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sentry_notify_hms_event_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sentry_notify_hms_event_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new TSentryHmsEventNotificationResponse(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + } + } http://git-wip-us.apache.org/repos/asf/sentry/blob/f4621490/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TSentryHmsEventNotification.java ---------------------------------------------------------------------- diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TSentryHmsEventNotification.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TSentryHmsEventNotification.java new file mode 100644 index 0000000..75b2799 --- /dev/null +++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TSentryHmsEventNotification.java @@ -0,0 +1,905 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.sentry.api.service.thrift; + +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import javax.annotation.Generated; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)") +public class TSentryHmsEventNotification implements org.apache.thrift.TBase<TSentryHmsEventNotification, TSentryHmsEventNotification._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryHmsEventNotification> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryHmsEventNotification"); + + private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1); + private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)2); + private static final org.apache.thrift.protocol.TField EVENT_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("eventType", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField OWNER_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("ownerType", org.apache.thrift.protocol.TType.I32, (short)4); + private static final org.apache.thrift.protocol.TField OWNER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("ownerName", org.apache.thrift.protocol.TType.STRING, (short)5); + private static final org.apache.thrift.protocol.TField AUTHORIZABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizable", org.apache.thrift.protocol.TType.STRUCT, (short)6); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TSentryHmsEventNotificationStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TSentryHmsEventNotificationTupleSchemeFactory()); + } + + private int protocol_version; // required + private long id; // required + private String eventType; // required + private TSentryObjectOwnerType ownerType; // required + private String ownerName; // required + private TSentryAuthorizable authorizable; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + PROTOCOL_VERSION((short)1, "protocol_version"), + ID((short)2, "id"), + EVENT_TYPE((short)3, "eventType"), + /** + * + * @see TSentryObjectOwnerType + */ + OWNER_TYPE((short)4, "ownerType"), + OWNER_NAME((short)5, "ownerName"), + AUTHORIZABLE((short)6, "authorizable"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // PROTOCOL_VERSION + return PROTOCOL_VERSION; + case 2: // ID + return ID; + case 3: // EVENT_TYPE + return EVENT_TYPE; + case 4: // OWNER_TYPE + return OWNER_TYPE; + case 5: // OWNER_NAME + return OWNER_NAME; + case 6: // AUTHORIZABLE + return AUTHORIZABLE; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __PROTOCOL_VERSION_ISSET_ID = 0; + private static final int __ID_ISSET_ID = 1; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.EVENT_TYPE, new org.apache.thrift.meta_data.FieldMetaData("eventType", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.OWNER_TYPE, new org.apache.thrift.meta_data.FieldMetaData("ownerType", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TSentryObjectOwnerType.class))); + tmpMap.put(_Fields.OWNER_NAME, new org.apache.thrift.meta_data.FieldMetaData("ownerName", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.AUTHORIZABLE, new org.apache.thrift.meta_data.FieldMetaData("authorizable", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryHmsEventNotification.class, metaDataMap); + } + + public TSentryHmsEventNotification() { + this.protocol_version = 2; + + } + + public TSentryHmsEventNotification( + int protocol_version, + long id, + String eventType, + TSentryObjectOwnerType ownerType, + String ownerName, + TSentryAuthorizable authorizable) + { + this(); + this.protocol_version = protocol_version; + setProtocol_versionIsSet(true); + this.id = id; + setIdIsSet(true); + this.eventType = eventType; + this.ownerType = ownerType; + this.ownerName = ownerName; + this.authorizable = authorizable; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public TSentryHmsEventNotification(TSentryHmsEventNotification other) { + __isset_bitfield = other.__isset_bitfield; + this.protocol_version = other.protocol_version; + this.id = other.id; + if (other.isSetEventType()) { + this.eventType = other.eventType; + } + if (other.isSetOwnerType()) { + this.ownerType = other.ownerType; + } + if (other.isSetOwnerName()) { + this.ownerName = other.ownerName; + } + if (other.isSetAuthorizable()) { + this.authorizable = new TSentryAuthorizable(other.authorizable); + } + } + + public TSentryHmsEventNotification deepCopy() { + return new TSentryHmsEventNotification(this); + } + + @Override + public void clear() { + this.protocol_version = 2; + + setIdIsSet(false); + this.id = 0; + this.eventType = null; + this.ownerType = null; + this.ownerName = null; + this.authorizable = null; + } + + public int getProtocol_version() { + return this.protocol_version; + } + + public void setProtocol_version(int protocol_version) { + this.protocol_version = protocol_version; + setProtocol_versionIsSet(true); + } + + public void unsetProtocol_version() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID); + } + + /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */ + public boolean isSetProtocol_version() { + return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID); + } + + public void setProtocol_versionIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value); + } + + public long getId() { + return this.id; + } + + public void setId(long id) { + this.id = id; + setIdIsSet(true); + } + + public void unsetId() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ID_ISSET_ID); + } + + /** Returns true if field id is set (has been assigned a value) and false otherwise */ + public boolean isSetId() { + return EncodingUtils.testBit(__isset_bitfield, __ID_ISSET_ID); + } + + public void setIdIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value); + } + + public String getEventType() { + return this.eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + public void unsetEventType() { + this.eventType = null; + } + + /** Returns true if field eventType is set (has been assigned a value) and false otherwise */ + public boolean isSetEventType() { + return this.eventType != null; + } + + public void setEventTypeIsSet(boolean value) { + if (!value) { + this.eventType = null; + } + } + + /** + * + * @see TSentryObjectOwnerType + */ + public TSentryObjectOwnerType getOwnerType() { + return this.ownerType; + } + + /** + * + * @see TSentryObjectOwnerType + */ + public void setOwnerType(TSentryObjectOwnerType ownerType) { + this.ownerType = ownerType; + } + + public void unsetOwnerType() { + this.ownerType = null; + } + + /** Returns true if field ownerType is set (has been assigned a value) and false otherwise */ + public boolean isSetOwnerType() { + return this.ownerType != null; + } + + public void setOwnerTypeIsSet(boolean value) { + if (!value) { + this.ownerType = null; + } + } + + public String getOwnerName() { + return this.ownerName; + } + + public void setOwnerName(String ownerName) { + this.ownerName = ownerName; + } + + public void unsetOwnerName() { + this.ownerName = null; + } + + /** Returns true if field ownerName is set (has been assigned a value) and false otherwise */ + public boolean isSetOwnerName() { + return this.ownerName != null; + } + + public void setOwnerNameIsSet(boolean value) { + if (!value) { + this.ownerName = null; + } + } + + public TSentryAuthorizable getAuthorizable() { + return this.authorizable; + } + + public void setAuthorizable(TSentryAuthorizable authorizable) { + this.authorizable = authorizable; + } + + public void unsetAuthorizable() { + this.authorizable = null; + } + + /** Returns true if field authorizable is set (has been assigned a value) and false otherwise */ + public boolean isSetAuthorizable() { + return this.authorizable != null; + } + + public void setAuthorizableIsSet(boolean value) { + if (!value) { + this.authorizable = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case PROTOCOL_VERSION: + if (value == null) { + unsetProtocol_version(); + } else { + setProtocol_version((Integer)value); + } + break; + + case ID: + if (value == null) { + unsetId(); + } else { + setId((Long)value); + } + break; + + case EVENT_TYPE: + if (value == null) { + unsetEventType(); + } else { + setEventType((String)value); + } + break; + + case OWNER_TYPE: + if (value == null) { + unsetOwnerType(); + } else { + setOwnerType((TSentryObjectOwnerType)value); + } + break; + + case OWNER_NAME: + if (value == null) { + unsetOwnerName(); + } else { + setOwnerName((String)value); + } + break; + + case AUTHORIZABLE: + if (value == null) { + unsetAuthorizable(); + } else { + setAuthorizable((TSentryAuthorizable)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case PROTOCOL_VERSION: + return getProtocol_version(); + + case ID: + return getId(); + + case EVENT_TYPE: + return getEventType(); + + case OWNER_TYPE: + return getOwnerType(); + + case OWNER_NAME: + return getOwnerName(); + + case AUTHORIZABLE: + return getAuthorizable(); + + } + throw new IllegalStateException(); + } + + /** 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 PROTOCOL_VERSION: + return isSetProtocol_version(); + case ID: + return isSetId(); + case EVENT_TYPE: + return isSetEventType(); + case OWNER_TYPE: + return isSetOwnerType(); + case OWNER_NAME: + return isSetOwnerName(); + case AUTHORIZABLE: + return isSetAuthorizable(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TSentryHmsEventNotification) + return this.equals((TSentryHmsEventNotification)that); + return false; + } + + public boolean equals(TSentryHmsEventNotification that) { + if (that == null) + return false; + + boolean this_present_protocol_version = true; + boolean that_present_protocol_version = true; + if (this_present_protocol_version || that_present_protocol_version) { + if (!(this_present_protocol_version && that_present_protocol_version)) + return false; + if (this.protocol_version != that.protocol_version) + return false; + } + + boolean this_present_id = true; + boolean that_present_id = true; + if (this_present_id || that_present_id) { + if (!(this_present_id && that_present_id)) + return false; + if (this.id != that.id) + return false; + } + + boolean this_present_eventType = true && this.isSetEventType(); + boolean that_present_eventType = true && that.isSetEventType(); + if (this_present_eventType || that_present_eventType) { + if (!(this_present_eventType && that_present_eventType)) + return false; + if (!this.eventType.equals(that.eventType)) + return false; + } + + boolean this_present_ownerType = true && this.isSetOwnerType(); + boolean that_present_ownerType = true && that.isSetOwnerType(); + if (this_present_ownerType || that_present_ownerType) { + if (!(this_present_ownerType && that_present_ownerType)) + return false; + if (!this.ownerType.equals(that.ownerType)) + return false; + } + + boolean this_present_ownerName = true && this.isSetOwnerName(); + boolean that_present_ownerName = true && that.isSetOwnerName(); + if (this_present_ownerName || that_present_ownerName) { + if (!(this_present_ownerName && that_present_ownerName)) + return false; + if (!this.ownerName.equals(that.ownerName)) + return false; + } + + boolean this_present_authorizable = true && this.isSetAuthorizable(); + boolean that_present_authorizable = true && that.isSetAuthorizable(); + if (this_present_authorizable || that_present_authorizable) { + if (!(this_present_authorizable && that_present_authorizable)) + return false; + if (!this.authorizable.equals(that.authorizable)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_protocol_version = true; + list.add(present_protocol_version); + if (present_protocol_version) + list.add(protocol_version); + + boolean present_id = true; + list.add(present_id); + if (present_id) + list.add(id); + + boolean present_eventType = true && (isSetEventType()); + list.add(present_eventType); + if (present_eventType) + list.add(eventType); + + boolean present_ownerType = true && (isSetOwnerType()); + list.add(present_ownerType); + if (present_ownerType) + list.add(ownerType.getValue()); + + boolean present_ownerName = true && (isSetOwnerName()); + list.add(present_ownerName); + if (present_ownerName) + list.add(ownerName); + + boolean present_authorizable = true && (isSetAuthorizable()); + list.add(present_authorizable); + if (present_authorizable) + list.add(authorizable); + + return list.hashCode(); + } + + @Override + public int compareTo(TSentryHmsEventNotification other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(other.isSetProtocol_version()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetProtocol_version()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, other.protocol_version); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetEventType()).compareTo(other.isSetEventType()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetEventType()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.eventType, other.eventType); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetOwnerType()).compareTo(other.isSetOwnerType()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetOwnerType()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ownerType, other.ownerType); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetOwnerName()).compareTo(other.isSetOwnerName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetOwnerName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ownerName, other.ownerName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAuthorizable()).compareTo(other.isSetAuthorizable()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAuthorizable()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizable, other.authorizable); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TSentryHmsEventNotification("); + boolean first = true; + + sb.append("protocol_version:"); + sb.append(this.protocol_version); + first = false; + if (!first) sb.append(", "); + sb.append("id:"); + sb.append(this.id); + first = false; + if (!first) sb.append(", "); + sb.append("eventType:"); + if (this.eventType == null) { + sb.append("null"); + } else { + sb.append(this.eventType); + } + first = false; + if (!first) sb.append(", "); + sb.append("ownerType:"); + if (this.ownerType == null) { + sb.append("null"); + } else { + sb.append(this.ownerType); + } + first = false; + if (!first) sb.append(", "); + sb.append("ownerName:"); + if (this.ownerName == null) { + sb.append("null"); + } else { + sb.append(this.ownerName); + } + first = false; + if (!first) sb.append(", "); + sb.append("authorizable:"); + if (this.authorizable == null) { + sb.append("null"); + } else { + sb.append(this.authorizable); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetProtocol_version()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString()); + } + + if (!isSetId()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'id' is unset! Struct:" + toString()); + } + + if (!isSetEventType()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'eventType' is unset! Struct:" + toString()); + } + + if (!isSetOwnerType()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'ownerType' is unset! Struct:" + toString()); + } + + if (!isSetOwnerName()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'ownerName' is unset! Struct:" + toString()); + } + + if (!isSetAuthorizable()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'authorizable' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + if (authorizable != null) { + authorizable.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class TSentryHmsEventNotificationStandardSchemeFactory implements SchemeFactory { + public TSentryHmsEventNotificationStandardScheme getScheme() { + return new TSentryHmsEventNotificationStandardScheme(); + } + } + + private static class TSentryHmsEventNotificationStandardScheme extends StandardScheme<TSentryHmsEventNotification> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryHmsEventNotification struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // PROTOCOL_VERSION + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.protocol_version = iprot.readI32(); + struct.setProtocol_versionIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ID + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.id = iprot.readI64(); + struct.setIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // EVENT_TYPE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.eventType = iprot.readString(); + struct.setEventTypeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // OWNER_TYPE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.ownerType = org.apache.sentry.api.service.thrift.TSentryObjectOwnerType.findByValue(iprot.readI32()); + struct.setOwnerTypeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // OWNER_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.ownerName = iprot.readString(); + struct.setOwnerNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 6: // AUTHORIZABLE + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.authorizable = new TSentryAuthorizable(); + struct.authorizable.read(iprot); + struct.setAuthorizableIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, TSentryHmsEventNotification struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC); + oprot.writeI32(struct.protocol_version); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(ID_FIELD_DESC); + oprot.writeI64(struct.id); + oprot.writeFieldEnd(); + if (struct.eventType != null) { + oprot.writeFieldBegin(EVENT_TYPE_FIELD_DESC); + oprot.writeString(struct.eventType); + oprot.writeFieldEnd(); + } + if (struct.ownerType != null) { + oprot.writeFieldBegin(OWNER_TYPE_FIELD_DESC); + oprot.writeI32(struct.ownerType.getValue()); + oprot.writeFieldEnd(); + } + if (struct.ownerName != null) { + oprot.writeFieldBegin(OWNER_NAME_FIELD_DESC); + oprot.writeString(struct.ownerName); + oprot.writeFieldEnd(); + } + if (struct.authorizable != null) { + oprot.writeFieldBegin(AUTHORIZABLE_FIELD_DESC); + struct.authorizable.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TSentryHmsEventNotificationTupleSchemeFactory implements SchemeFactory { + public TSentryHmsEventNotificationTupleScheme getScheme() { + return new TSentryHmsEventNotificationTupleScheme(); + } + } + + private static class TSentryHmsEventNotificationTupleScheme extends TupleScheme<TSentryHmsEventNotification> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TSentryHmsEventNotification struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeI32(struct.protocol_version); + oprot.writeI64(struct.id); + oprot.writeString(struct.eventType); + oprot.writeI32(struct.ownerType.getValue()); + oprot.writeString(struct.ownerName); + struct.authorizable.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TSentryHmsEventNotification struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.protocol_version = iprot.readI32(); + struct.setProtocol_versionIsSet(true); + struct.id = iprot.readI64(); + struct.setIdIsSet(true); + struct.eventType = iprot.readString(); + struct.setEventTypeIsSet(true); + struct.ownerType = org.apache.sentry.api.service.thrift.TSentryObjectOwnerType.findByValue(iprot.readI32()); + struct.setOwnerTypeIsSet(true); + struct.ownerName = iprot.readString(); + struct.setOwnerNameIsSet(true); + struct.authorizable = new TSentryAuthorizable(); + struct.authorizable.read(iprot); + struct.setAuthorizableIsSet(true); + } + } + +} + http://git-wip-us.apache.org/repos/asf/sentry/blob/f4621490/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TSentryHmsEventNotificationResponse.java ---------------------------------------------------------------------- diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TSentryHmsEventNotificationResponse.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TSentryHmsEventNotificationResponse.java new file mode 100644 index 0000000..c405388 --- /dev/null +++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TSentryHmsEventNotificationResponse.java @@ -0,0 +1,493 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.sentry.api.service.thrift; + +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import javax.annotation.Generated; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)") +public class TSentryHmsEventNotificationResponse implements org.apache.thrift.TBase<TSentryHmsEventNotificationResponse, TSentryHmsEventNotificationResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryHmsEventNotificationResponse> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryHmsEventNotificationResponse"); + + private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TSentryHmsEventNotificationResponseStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TSentryHmsEventNotificationResponseTupleSchemeFactory()); + } + + private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required + private long id; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + STATUS((short)1, "status"), + ID((short)2, "id"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // STATUS + return STATUS; + case 2: // ID + return ID; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __ID_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class))); + tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryHmsEventNotificationResponse.class, metaDataMap); + } + + public TSentryHmsEventNotificationResponse() { + } + + public TSentryHmsEventNotificationResponse( + org.apache.sentry.service.thrift.TSentryResponseStatus status, + long id) + { + this(); + this.status = status; + this.id = id; + setIdIsSet(true); + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public TSentryHmsEventNotificationResponse(TSentryHmsEventNotificationResponse other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetStatus()) { + this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status); + } + this.id = other.id; + } + + public TSentryHmsEventNotificationResponse deepCopy() { + return new TSentryHmsEventNotificationResponse(this); + } + + @Override + public void clear() { + this.status = null; + setIdIsSet(false); + this.id = 0; + } + + public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() { + return this.status; + } + + public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) { + this.status = status; + } + + public void unsetStatus() { + this.status = null; + } + + /** Returns true if field status is set (has been assigned a value) and false otherwise */ + public boolean isSetStatus() { + return this.status != null; + } + + public void setStatusIsSet(boolean value) { + if (!value) { + this.status = null; + } + } + + public long getId() { + return this.id; + } + + public void setId(long id) { + this.id = id; + setIdIsSet(true); + } + + public void unsetId() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ID_ISSET_ID); + } + + /** Returns true if field id is set (has been assigned a value) and false otherwise */ + public boolean isSetId() { + return EncodingUtils.testBit(__isset_bitfield, __ID_ISSET_ID); + } + + public void setIdIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case STATUS: + if (value == null) { + unsetStatus(); + } else { + setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value); + } + break; + + case ID: + if (value == null) { + unsetId(); + } else { + setId((Long)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case STATUS: + return getStatus(); + + case ID: + return getId(); + + } + throw new IllegalStateException(); + } + + /** 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 STATUS: + return isSetStatus(); + case ID: + return isSetId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TSentryHmsEventNotificationResponse) + return this.equals((TSentryHmsEventNotificationResponse)that); + return false; + } + + public boolean equals(TSentryHmsEventNotificationResponse that) { + if (that == null) + return false; + + boolean this_present_status = true && this.isSetStatus(); + boolean that_present_status = true && that.isSetStatus(); + if (this_present_status || that_present_status) { + if (!(this_present_status && that_present_status)) + return false; + if (!this.status.equals(that.status)) + return false; + } + + boolean this_present_id = true; + boolean that_present_id = true; + if (this_present_id || that_present_id) { + if (!(this_present_id && that_present_id)) + return false; + if (this.id != that.id) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_status = true && (isSetStatus()); + list.add(present_status); + if (present_status) + list.add(status); + + boolean present_id = true; + list.add(present_id); + if (present_id) + list.add(id); + + return list.hashCode(); + } + + @Override + public int compareTo(TSentryHmsEventNotificationResponse other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetStatus()).compareTo(other.isSetStatus()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetStatus()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, other.status); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TSentryHmsEventNotificationResponse("); + boolean first = true; + + sb.append("status:"); + if (this.status == null) { + sb.append("null"); + } else { + sb.append(this.status); + } + first = false; + if (!first) sb.append(", "); + sb.append("id:"); + sb.append(this.id); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetStatus()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString()); + } + + if (!isSetId()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'id' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + if (status != null) { + status.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class TSentryHmsEventNotificationResponseStandardSchemeFactory implements SchemeFactory { + public TSentryHmsEventNotificationResponseStandardScheme getScheme() { + return new TSentryHmsEventNotificationResponseStandardScheme(); + } + } + + private static class TSentryHmsEventNotificationResponseStandardScheme extends StandardScheme<TSentryHmsEventNotificationResponse> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryHmsEventNotificationResponse struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // STATUS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(); + struct.status.read(iprot); + struct.setStatusIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ID + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.id = iprot.readI64(); + struct.setIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, TSentryHmsEventNotificationResponse struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.status != null) { + oprot.writeFieldBegin(STATUS_FIELD_DESC); + struct.status.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(ID_FIELD_DESC); + oprot.writeI64(struct.id); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TSentryHmsEventNotificationResponseTupleSchemeFactory implements SchemeFactory { + public TSentryHmsEventNotificationResponseTupleScheme getScheme() { + return new TSentryHmsEventNotificationResponseTupleScheme(); + } + } + + private static class TSentryHmsEventNotificationResponseTupleScheme extends TupleScheme<TSentryHmsEventNotificationResponse> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TSentryHmsEventNotificationResponse struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + struct.status.write(oprot); + oprot.writeI64(struct.id); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TSentryHmsEventNotificationResponse 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); + struct.id = iprot.readI64(); + struct.setIdIsSet(true); + } + } + +} + http://git-wip-us.apache.org/repos/asf/sentry/blob/f4621490/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TSentryObjectOwnerType.java ---------------------------------------------------------------------- diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TSentryObjectOwnerType.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TSentryObjectOwnerType.java new file mode 100644 index 0000000..6b540b8 --- /dev/null +++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TSentryObjectOwnerType.java @@ -0,0 +1,45 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.sentry.api.service.thrift; + + +import java.util.Map; +import java.util.HashMap; +import org.apache.thrift.TEnum; + +public enum TSentryObjectOwnerType implements org.apache.thrift.TEnum { + ROLE(1), + USER(2); + + private final int value; + + private TSentryObjectOwnerType(int value) { + this.value = value; + } + + /** + * Get the integer value of this enum value, as defined in the Thrift IDL. + */ + public int getValue() { + return value; + } + + /** + * Find a the enum type by its integer value, as defined in the Thrift IDL. + * @return null if the value is not found. + */ + public static TSentryObjectOwnerType findByValue(int value) { + switch (value) { + case 1: + return ROLE; + case 2: + return USER; + default: + return null; + } + } +} http://git-wip-us.apache.org/repos/asf/sentry/blob/f4621490/sentry-service/sentry-service-api/src/main/resources/sentry_policy_service.thrift ---------------------------------------------------------------------- diff --git a/sentry-service/sentry-service-api/src/main/resources/sentry_policy_service.thrift b/sentry-service/sentry-service-api/src/main/resources/sentry_policy_service.thrift index dcbd7e4..679ab56 100644 --- a/sentry-service/sentry-service-api/src/main/resources/sentry_policy_service.thrift +++ b/sentry-service/sentry-service-api/src/main/resources/sentry_policy_service.thrift @@ -38,6 +38,11 @@ enum TSentryGrantOption { UNSET = -1 } +enum TSentryObjectOwnerType { + ROLE = 1, + USER = 2 +} + # Represents a Privilege in transport from the client to the server struct TSentryPrivilege { 1: required string privilegeScope, # Valid values are SERVER, DATABASE, TABLE, COLUMN, URI @@ -323,6 +328,29 @@ struct TSentrySyncIDResponse { 2: required i64 id // Most recent processed ID } +/* + * This request is an extension to TSentrySyncIDRequest. Additionally this request + * is used to update the HMS events and the owner changes associated with events. + * To be backward compatible, TSentrySyncIDRequest is not updated. Instead new request + * is created extending it. +*/ + +struct TSentryHmsEventNotification { +1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, +2: required i64 id, # Requested ID +# Constructed from enum org.apache.hadoop.hive.metastore.messaging.EventMessage.EventType +3: required string eventType, # Type of the event which resulted in owner update request +4: required TSentryObjectOwnerType ownerType, # Type of the owner +5: required string ownerName, # owner name +6: required TSentryAuthorizable authorizable +} + +struct TSentryHmsEventNotificationResponse { +1: required sentry_common_service.TSentryResponseStatus status +2: required i64 id // Most recent processed ID +} + + service SentryPolicyService { TCreateSentryRoleResponse create_sentry_role(1:TCreateSentryRoleRequest request) @@ -361,4 +389,8 @@ service SentryPolicyService # Synchronize between HMS notifications and Sentry TSentrySyncIDResponse sentry_sync_notifications(1:TSentrySyncIDRequest request); + + # Notify Sentry about new events in HMS. Currently used to synchronize between HMS/Sentry + # and also update sentry with the owner information. + TSentryHmsEventNotificationResponse sentry_notify_hms_event(1:TSentryHmsEventNotification request); }