You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by sp...@apache.org on 2018/05/10 00:14:10 UTC
[01/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Repository: sentry
Updated Branches:
refs/heads/master b23146826 -> af8ea0ac1
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TSentryPrivilege.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TSentryPrivilege.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TSentryPrivilege.java
new file mode 100644
index 0000000..2a822da
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TSentryPrivilege.java
@@ -0,0 +1,1080 @@
+/**
+ * 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.generic.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 TSentryPrivilege implements org.apache.thrift.TBase<TSentryPrivilege, TSentryPrivilege._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryPrivilege> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryPrivilege");
+
+ private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField SERVICE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("serviceName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField AUTHORIZABLES_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizables", org.apache.thrift.protocol.TType.LIST, (short)3);
+ private static final org.apache.thrift.protocol.TField ACTION_FIELD_DESC = new org.apache.thrift.protocol.TField("action", org.apache.thrift.protocol.TType.STRING, (short)4);
+ private static final org.apache.thrift.protocol.TField CREATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("createTime", org.apache.thrift.protocol.TType.I64, (short)5);
+ private static final org.apache.thrift.protocol.TField GRANTOR_PRINCIPAL_FIELD_DESC = new org.apache.thrift.protocol.TField("grantorPrincipal", org.apache.thrift.protocol.TType.STRING, (short)6);
+ private static final org.apache.thrift.protocol.TField GRANT_OPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("grantOption", org.apache.thrift.protocol.TType.I32, (short)7);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TSentryPrivilegeStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TSentryPrivilegeTupleSchemeFactory());
+ }
+
+ private String component; // required
+ private String serviceName; // required
+ private List<TAuthorizable> authorizables; // required
+ private String action; // required
+ private long createTime; // optional
+ private String grantorPrincipal; // optional
+ private TSentryGrantOption grantOption; // optional
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ COMPONENT((short)1, "component"),
+ SERVICE_NAME((short)2, "serviceName"),
+ AUTHORIZABLES((short)3, "authorizables"),
+ ACTION((short)4, "action"),
+ CREATE_TIME((short)5, "createTime"),
+ GRANTOR_PRINCIPAL((short)6, "grantorPrincipal"),
+ /**
+ *
+ * @see TSentryGrantOption
+ */
+ GRANT_OPTION((short)7, "grantOption");
+
+ 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: // COMPONENT
+ return COMPONENT;
+ case 2: // SERVICE_NAME
+ return SERVICE_NAME;
+ case 3: // AUTHORIZABLES
+ return AUTHORIZABLES;
+ case 4: // ACTION
+ return ACTION;
+ case 5: // CREATE_TIME
+ return CREATE_TIME;
+ case 6: // GRANTOR_PRINCIPAL
+ return GRANTOR_PRINCIPAL;
+ case 7: // GRANT_OPTION
+ return GRANT_OPTION;
+ 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 __CREATETIME_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ private static final _Fields optionals[] = {_Fields.CREATE_TIME,_Fields.GRANTOR_PRINCIPAL,_Fields.GRANT_OPTION};
+ 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.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.SERVICE_NAME, new org.apache.thrift.meta_data.FieldMetaData("serviceName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.AUTHORIZABLES, new org.apache.thrift.meta_data.FieldMetaData("authorizables", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAuthorizable.class))));
+ tmpMap.put(_Fields.ACTION, new org.apache.thrift.meta_data.FieldMetaData("action", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.CREATE_TIME, new org.apache.thrift.meta_data.FieldMetaData("createTime", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.GRANTOR_PRINCIPAL, new org.apache.thrift.meta_data.FieldMetaData("grantorPrincipal", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.GRANT_OPTION, new org.apache.thrift.meta_data.FieldMetaData("grantOption", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TSentryGrantOption.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryPrivilege.class, metaDataMap);
+ }
+
+ public TSentryPrivilege() {
+ this.grantOption = org.apache.sentry.api.generic.thrift.TSentryGrantOption.FALSE;
+
+ }
+
+ public TSentryPrivilege(
+ String component,
+ String serviceName,
+ List<TAuthorizable> authorizables,
+ String action)
+ {
+ this();
+ this.component = component;
+ this.serviceName = serviceName;
+ this.authorizables = authorizables;
+ this.action = action;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TSentryPrivilege(TSentryPrivilege other) {
+ __isset_bitfield = other.__isset_bitfield;
+ if (other.isSetComponent()) {
+ this.component = other.component;
+ }
+ if (other.isSetServiceName()) {
+ this.serviceName = other.serviceName;
+ }
+ if (other.isSetAuthorizables()) {
+ List<TAuthorizable> __this__authorizables = new ArrayList<TAuthorizable>(other.authorizables.size());
+ for (TAuthorizable other_element : other.authorizables) {
+ __this__authorizables.add(new TAuthorizable(other_element));
+ }
+ this.authorizables = __this__authorizables;
+ }
+ if (other.isSetAction()) {
+ this.action = other.action;
+ }
+ this.createTime = other.createTime;
+ if (other.isSetGrantorPrincipal()) {
+ this.grantorPrincipal = other.grantorPrincipal;
+ }
+ if (other.isSetGrantOption()) {
+ this.grantOption = other.grantOption;
+ }
+ }
+
+ public TSentryPrivilege deepCopy() {
+ return new TSentryPrivilege(this);
+ }
+
+ @Override
+ public void clear() {
+ this.component = null;
+ this.serviceName = null;
+ this.authorizables = null;
+ this.action = null;
+ setCreateTimeIsSet(false);
+ this.createTime = 0;
+ this.grantorPrincipal = null;
+ this.grantOption = org.apache.sentry.api.generic.thrift.TSentryGrantOption.FALSE;
+
+ }
+
+ public String getComponent() {
+ return this.component;
+ }
+
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ public void unsetComponent() {
+ this.component = null;
+ }
+
+ /** Returns true if field component is set (has been assigned a value) and false otherwise */
+ public boolean isSetComponent() {
+ return this.component != null;
+ }
+
+ public void setComponentIsSet(boolean value) {
+ if (!value) {
+ this.component = null;
+ }
+ }
+
+ public String getServiceName() {
+ return this.serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public void unsetServiceName() {
+ this.serviceName = null;
+ }
+
+ /** Returns true if field serviceName is set (has been assigned a value) and false otherwise */
+ public boolean isSetServiceName() {
+ return this.serviceName != null;
+ }
+
+ public void setServiceNameIsSet(boolean value) {
+ if (!value) {
+ this.serviceName = null;
+ }
+ }
+
+ public int getAuthorizablesSize() {
+ return (this.authorizables == null) ? 0 : this.authorizables.size();
+ }
+
+ public java.util.Iterator<TAuthorizable> getAuthorizablesIterator() {
+ return (this.authorizables == null) ? null : this.authorizables.iterator();
+ }
+
+ public void addToAuthorizables(TAuthorizable elem) {
+ if (this.authorizables == null) {
+ this.authorizables = new ArrayList<TAuthorizable>();
+ }
+ this.authorizables.add(elem);
+ }
+
+ public List<TAuthorizable> getAuthorizables() {
+ return this.authorizables;
+ }
+
+ public void setAuthorizables(List<TAuthorizable> authorizables) {
+ this.authorizables = authorizables;
+ }
+
+ public void unsetAuthorizables() {
+ this.authorizables = null;
+ }
+
+ /** Returns true if field authorizables is set (has been assigned a value) and false otherwise */
+ public boolean isSetAuthorizables() {
+ return this.authorizables != null;
+ }
+
+ public void setAuthorizablesIsSet(boolean value) {
+ if (!value) {
+ this.authorizables = null;
+ }
+ }
+
+ public String getAction() {
+ return this.action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public void unsetAction() {
+ this.action = null;
+ }
+
+ /** Returns true if field action is set (has been assigned a value) and false otherwise */
+ public boolean isSetAction() {
+ return this.action != null;
+ }
+
+ public void setActionIsSet(boolean value) {
+ if (!value) {
+ this.action = null;
+ }
+ }
+
+ public long getCreateTime() {
+ return this.createTime;
+ }
+
+ public void setCreateTime(long createTime) {
+ this.createTime = createTime;
+ setCreateTimeIsSet(true);
+ }
+
+ public void unsetCreateTime() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CREATETIME_ISSET_ID);
+ }
+
+ /** Returns true if field createTime is set (has been assigned a value) and false otherwise */
+ public boolean isSetCreateTime() {
+ return EncodingUtils.testBit(__isset_bitfield, __CREATETIME_ISSET_ID);
+ }
+
+ public void setCreateTimeIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CREATETIME_ISSET_ID, value);
+ }
+
+ public String getGrantorPrincipal() {
+ return this.grantorPrincipal;
+ }
+
+ public void setGrantorPrincipal(String grantorPrincipal) {
+ this.grantorPrincipal = grantorPrincipal;
+ }
+
+ public void unsetGrantorPrincipal() {
+ this.grantorPrincipal = null;
+ }
+
+ /** Returns true if field grantorPrincipal is set (has been assigned a value) and false otherwise */
+ public boolean isSetGrantorPrincipal() {
+ return this.grantorPrincipal != null;
+ }
+
+ public void setGrantorPrincipalIsSet(boolean value) {
+ if (!value) {
+ this.grantorPrincipal = null;
+ }
+ }
+
+ /**
+ *
+ * @see TSentryGrantOption
+ */
+ public TSentryGrantOption getGrantOption() {
+ return this.grantOption;
+ }
+
+ /**
+ *
+ * @see TSentryGrantOption
+ */
+ public void setGrantOption(TSentryGrantOption grantOption) {
+ this.grantOption = grantOption;
+ }
+
+ public void unsetGrantOption() {
+ this.grantOption = null;
+ }
+
+ /** Returns true if field grantOption is set (has been assigned a value) and false otherwise */
+ public boolean isSetGrantOption() {
+ return this.grantOption != null;
+ }
+
+ public void setGrantOptionIsSet(boolean value) {
+ if (!value) {
+ this.grantOption = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case COMPONENT:
+ if (value == null) {
+ unsetComponent();
+ } else {
+ setComponent((String)value);
+ }
+ break;
+
+ case SERVICE_NAME:
+ if (value == null) {
+ unsetServiceName();
+ } else {
+ setServiceName((String)value);
+ }
+ break;
+
+ case AUTHORIZABLES:
+ if (value == null) {
+ unsetAuthorizables();
+ } else {
+ setAuthorizables((List<TAuthorizable>)value);
+ }
+ break;
+
+ case ACTION:
+ if (value == null) {
+ unsetAction();
+ } else {
+ setAction((String)value);
+ }
+ break;
+
+ case CREATE_TIME:
+ if (value == null) {
+ unsetCreateTime();
+ } else {
+ setCreateTime((Long)value);
+ }
+ break;
+
+ case GRANTOR_PRINCIPAL:
+ if (value == null) {
+ unsetGrantorPrincipal();
+ } else {
+ setGrantorPrincipal((String)value);
+ }
+ break;
+
+ case GRANT_OPTION:
+ if (value == null) {
+ unsetGrantOption();
+ } else {
+ setGrantOption((TSentryGrantOption)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case COMPONENT:
+ return getComponent();
+
+ case SERVICE_NAME:
+ return getServiceName();
+
+ case AUTHORIZABLES:
+ return getAuthorizables();
+
+ case ACTION:
+ return getAction();
+
+ case CREATE_TIME:
+ return getCreateTime();
+
+ case GRANTOR_PRINCIPAL:
+ return getGrantorPrincipal();
+
+ case GRANT_OPTION:
+ return getGrantOption();
+
+ }
+ 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 COMPONENT:
+ return isSetComponent();
+ case SERVICE_NAME:
+ return isSetServiceName();
+ case AUTHORIZABLES:
+ return isSetAuthorizables();
+ case ACTION:
+ return isSetAction();
+ case CREATE_TIME:
+ return isSetCreateTime();
+ case GRANTOR_PRINCIPAL:
+ return isSetGrantorPrincipal();
+ case GRANT_OPTION:
+ return isSetGrantOption();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TSentryPrivilege)
+ return this.equals((TSentryPrivilege)that);
+ return false;
+ }
+
+ public boolean equals(TSentryPrivilege that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_component = true && this.isSetComponent();
+ boolean that_present_component = true && that.isSetComponent();
+ if (this_present_component || that_present_component) {
+ if (!(this_present_component && that_present_component))
+ return false;
+ if (!this.component.equals(that.component))
+ return false;
+ }
+
+ boolean this_present_serviceName = true && this.isSetServiceName();
+ boolean that_present_serviceName = true && that.isSetServiceName();
+ if (this_present_serviceName || that_present_serviceName) {
+ if (!(this_present_serviceName && that_present_serviceName))
+ return false;
+ if (!this.serviceName.equals(that.serviceName))
+ return false;
+ }
+
+ boolean this_present_authorizables = true && this.isSetAuthorizables();
+ boolean that_present_authorizables = true && that.isSetAuthorizables();
+ if (this_present_authorizables || that_present_authorizables) {
+ if (!(this_present_authorizables && that_present_authorizables))
+ return false;
+ if (!this.authorizables.equals(that.authorizables))
+ return false;
+ }
+
+ boolean this_present_action = true && this.isSetAction();
+ boolean that_present_action = true && that.isSetAction();
+ if (this_present_action || that_present_action) {
+ if (!(this_present_action && that_present_action))
+ return false;
+ if (!this.action.equals(that.action))
+ return false;
+ }
+
+ boolean this_present_createTime = true && this.isSetCreateTime();
+ boolean that_present_createTime = true && that.isSetCreateTime();
+ if (this_present_createTime || that_present_createTime) {
+ if (!(this_present_createTime && that_present_createTime))
+ return false;
+ if (this.createTime != that.createTime)
+ return false;
+ }
+
+ boolean this_present_grantorPrincipal = true && this.isSetGrantorPrincipal();
+ boolean that_present_grantorPrincipal = true && that.isSetGrantorPrincipal();
+ if (this_present_grantorPrincipal || that_present_grantorPrincipal) {
+ if (!(this_present_grantorPrincipal && that_present_grantorPrincipal))
+ return false;
+ if (!this.grantorPrincipal.equals(that.grantorPrincipal))
+ return false;
+ }
+
+ boolean this_present_grantOption = true && this.isSetGrantOption();
+ boolean that_present_grantOption = true && that.isSetGrantOption();
+ if (this_present_grantOption || that_present_grantOption) {
+ if (!(this_present_grantOption && that_present_grantOption))
+ return false;
+ if (!this.grantOption.equals(that.grantOption))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ List<Object> list = new ArrayList<Object>();
+
+ boolean present_component = true && (isSetComponent());
+ list.add(present_component);
+ if (present_component)
+ list.add(component);
+
+ boolean present_serviceName = true && (isSetServiceName());
+ list.add(present_serviceName);
+ if (present_serviceName)
+ list.add(serviceName);
+
+ boolean present_authorizables = true && (isSetAuthorizables());
+ list.add(present_authorizables);
+ if (present_authorizables)
+ list.add(authorizables);
+
+ boolean present_action = true && (isSetAction());
+ list.add(present_action);
+ if (present_action)
+ list.add(action);
+
+ boolean present_createTime = true && (isSetCreateTime());
+ list.add(present_createTime);
+ if (present_createTime)
+ list.add(createTime);
+
+ boolean present_grantorPrincipal = true && (isSetGrantorPrincipal());
+ list.add(present_grantorPrincipal);
+ if (present_grantorPrincipal)
+ list.add(grantorPrincipal);
+
+ boolean present_grantOption = true && (isSetGrantOption());
+ list.add(present_grantOption);
+ if (present_grantOption)
+ list.add(grantOption.getValue());
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TSentryPrivilege other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetComponent()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetServiceName()).compareTo(other.isSetServiceName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetServiceName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serviceName, other.serviceName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetAuthorizables()).compareTo(other.isSetAuthorizables());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAuthorizables()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizables, other.authorizables);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetAction()).compareTo(other.isSetAction());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAction()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.action, other.action);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetCreateTime()).compareTo(other.isSetCreateTime());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetCreateTime()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.createTime, other.createTime);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGrantorPrincipal()).compareTo(other.isSetGrantorPrincipal());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGrantorPrincipal()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.grantorPrincipal, other.grantorPrincipal);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGrantOption()).compareTo(other.isSetGrantOption());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGrantOption()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.grantOption, other.grantOption);
+ 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("TSentryPrivilege(");
+ boolean first = true;
+
+ sb.append("component:");
+ if (this.component == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.component);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("serviceName:");
+ if (this.serviceName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.serviceName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("authorizables:");
+ if (this.authorizables == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.authorizables);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("action:");
+ if (this.action == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.action);
+ }
+ first = false;
+ if (isSetCreateTime()) {
+ if (!first) sb.append(", ");
+ sb.append("createTime:");
+ sb.append(this.createTime);
+ first = false;
+ }
+ if (isSetGrantorPrincipal()) {
+ if (!first) sb.append(", ");
+ sb.append("grantorPrincipal:");
+ if (this.grantorPrincipal == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.grantorPrincipal);
+ }
+ first = false;
+ }
+ if (isSetGrantOption()) {
+ if (!first) sb.append(", ");
+ sb.append("grantOption:");
+ if (this.grantOption == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.grantOption);
+ }
+ first = false;
+ }
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetComponent()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
+ }
+
+ if (!isSetServiceName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'serviceName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetAuthorizables()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'authorizables' is unset! Struct:" + toString());
+ }
+
+ if (!isSetAction()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'action' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TSentryPrivilegeStandardSchemeFactory implements SchemeFactory {
+ public TSentryPrivilegeStandardScheme getScheme() {
+ return new TSentryPrivilegeStandardScheme();
+ }
+ }
+
+ private static class TSentryPrivilegeStandardScheme extends StandardScheme<TSentryPrivilege> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryPrivilege 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: // COMPONENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // SERVICE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.serviceName = iprot.readString();
+ struct.setServiceNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // AUTHORIZABLES
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
+ struct.authorizables = new ArrayList<TAuthorizable>(_list0.size);
+ TAuthorizable _elem1;
+ for (int _i2 = 0; _i2 < _list0.size; ++_i2)
+ {
+ _elem1 = new TAuthorizable();
+ _elem1.read(iprot);
+ struct.authorizables.add(_elem1);
+ }
+ iprot.readListEnd();
+ }
+ struct.setAuthorizablesIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // ACTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.action = iprot.readString();
+ struct.setActionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 5: // CREATE_TIME
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.createTime = iprot.readI64();
+ struct.setCreateTimeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 6: // GRANTOR_PRINCIPAL
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.grantorPrincipal = iprot.readString();
+ struct.setGrantorPrincipalIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 7: // GRANT_OPTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.grantOption = org.apache.sentry.api.generic.thrift.TSentryGrantOption.findByValue(iprot.readI32());
+ struct.setGrantOptionIsSet(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, TSentryPrivilege struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.component != null) {
+ oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
+ oprot.writeString(struct.component);
+ oprot.writeFieldEnd();
+ }
+ if (struct.serviceName != null) {
+ oprot.writeFieldBegin(SERVICE_NAME_FIELD_DESC);
+ oprot.writeString(struct.serviceName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.authorizables != null) {
+ oprot.writeFieldBegin(AUTHORIZABLES_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.authorizables.size()));
+ for (TAuthorizable _iter3 : struct.authorizables)
+ {
+ _iter3.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.action != null) {
+ oprot.writeFieldBegin(ACTION_FIELD_DESC);
+ oprot.writeString(struct.action);
+ oprot.writeFieldEnd();
+ }
+ if (struct.isSetCreateTime()) {
+ oprot.writeFieldBegin(CREATE_TIME_FIELD_DESC);
+ oprot.writeI64(struct.createTime);
+ oprot.writeFieldEnd();
+ }
+ if (struct.grantorPrincipal != null) {
+ if (struct.isSetGrantorPrincipal()) {
+ oprot.writeFieldBegin(GRANTOR_PRINCIPAL_FIELD_DESC);
+ oprot.writeString(struct.grantorPrincipal);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.grantOption != null) {
+ if (struct.isSetGrantOption()) {
+ oprot.writeFieldBegin(GRANT_OPTION_FIELD_DESC);
+ oprot.writeI32(struct.grantOption.getValue());
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TSentryPrivilegeTupleSchemeFactory implements SchemeFactory {
+ public TSentryPrivilegeTupleScheme getScheme() {
+ return new TSentryPrivilegeTupleScheme();
+ }
+ }
+
+ private static class TSentryPrivilegeTupleScheme extends TupleScheme<TSentryPrivilege> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TSentryPrivilege struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeString(struct.component);
+ oprot.writeString(struct.serviceName);
+ {
+ oprot.writeI32(struct.authorizables.size());
+ for (TAuthorizable _iter4 : struct.authorizables)
+ {
+ _iter4.write(oprot);
+ }
+ }
+ oprot.writeString(struct.action);
+ BitSet optionals = new BitSet();
+ if (struct.isSetCreateTime()) {
+ optionals.set(0);
+ }
+ if (struct.isSetGrantorPrincipal()) {
+ optionals.set(1);
+ }
+ if (struct.isSetGrantOption()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetCreateTime()) {
+ oprot.writeI64(struct.createTime);
+ }
+ if (struct.isSetGrantorPrincipal()) {
+ oprot.writeString(struct.grantorPrincipal);
+ }
+ if (struct.isSetGrantOption()) {
+ oprot.writeI32(struct.grantOption.getValue());
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TSentryPrivilege struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ struct.serviceName = iprot.readString();
+ struct.setServiceNameIsSet(true);
+ {
+ org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.authorizables = new ArrayList<TAuthorizable>(_list5.size);
+ TAuthorizable _elem6;
+ for (int _i7 = 0; _i7 < _list5.size; ++_i7)
+ {
+ _elem6 = new TAuthorizable();
+ _elem6.read(iprot);
+ struct.authorizables.add(_elem6);
+ }
+ }
+ struct.setAuthorizablesIsSet(true);
+ struct.action = iprot.readString();
+ struct.setActionIsSet(true);
+ BitSet incoming = iprot.readBitSet(3);
+ if (incoming.get(0)) {
+ struct.createTime = iprot.readI64();
+ struct.setCreateTimeIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.grantorPrincipal = iprot.readString();
+ struct.setGrantorPrincipalIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.grantOption = org.apache.sentry.api.generic.thrift.TSentryGrantOption.findByValue(iprot.readI32());
+ struct.setGrantOptionIsSet(true);
+ }
+ }
+ }
+
+}
+
[50/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-core/sentry-core-common/src/main/java/org/apache/sentry/service/common/ServiceConstants.java
----------------------------------------------------------------------
diff --git a/sentry-core/sentry-core-common/src/main/java/org/apache/sentry/service/common/ServiceConstants.java b/sentry-core/sentry-core-common/src/main/java/org/apache/sentry/service/common/ServiceConstants.java
new file mode 100644
index 0000000..71e9585
--- /dev/null
+++ b/sentry-core/sentry-core-common/src/main/java/org/apache/sentry/service/common/ServiceConstants.java
@@ -0,0 +1,251 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.service.common;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.security.sasl.Sasl;
+
+import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableMap;
+
+public class ServiceConstants {
+
+ private static final ImmutableMap<String, String> SASL_PROPERTIES;
+
+ static {
+ Map<String, String> saslProps = new HashMap<String, String>();
+ saslProps.put(Sasl.SERVER_AUTH, "true");
+ saslProps.put(Sasl.QOP, "auth-conf");
+ SASL_PROPERTIES = ImmutableMap.copyOf(saslProps);
+ }
+
+ public static class ConfUtilties {
+ public static final Splitter CLASS_SPLITTER = Splitter.onPattern("[\\s,]")
+ .trimResults().omitEmptyStrings();
+ }
+ public static class ServiceArgs {
+ public static final String CONFIG_FILE_SHORT = "c";
+ public static final String CONFIG_FILE_LONG = "conffile";
+ }
+
+ public static class ServerConfig {
+ public static final ImmutableMap<String, String> SASL_PROPERTIES = ServiceConstants.SASL_PROPERTIES;
+ /**
+ * This configuration parameter is only meant to be used for testing purposes.
+ */
+ public static final String SECURITY_MODE = "sentry.service.security.mode";
+ public static final String SECURITY_MODE_KERBEROS = "kerberos";
+ public static final String SECURITY_MODE_NONE = "none";
+ public static final String SECURITY_USE_UGI_TRANSPORT = "sentry.service.security.use.ugi";
+ public static final String ADMIN_GROUPS = "sentry.service.admin.group";
+ public static final String PRINCIPAL = "sentry.service.server.principal";
+ public static final String KEY_TAB = "sentry.service.server.keytab";
+ public static final String RPC_PORT = "sentry.service.server.rpc-port";
+ public static final int RPC_PORT_DEFAULT = 8038;
+ public static final String RPC_ADDRESS = "sentry.service.server.rpc-address";
+ public static final String RPC_ADDRESS_DEFAULT = "0.0.0.0"; //NOPMD
+ public static final String RPC_MAX_THREADS = "sentry.service.server-max-threads";
+ public static final int RPC_MAX_THREADS_DEFAULT = 500;
+ public static final String RPC_MIN_THREADS = "sentry.service.server-min-threads";
+ public static final int RPC_MIN_THREADS_DEFAULT = 10;
+ public static final String ALLOW_CONNECT = "sentry.service.allow.connect";
+
+ public static final String SENTRY_POLICY_STORE_PLUGINS = "sentry.policy.store.plugins";
+ public static final String SENTRY_POLICY_STORE_PLUGINS_DEFAULT = "";
+
+ public static final String SENTRY_METASTORE_PLUGINS = "sentry.metastore.plugins";
+ public static final String SENTRY_METASTORE_PLUGINS_DEFAULT = "";
+
+ public static final String PROCESSOR_FACTORIES = "sentry.service.processor.factories";
+ public static final String PROCESSOR_FACTORIES_DEFAULT =
+ "org.apache.sentry.api.service.thrift.SentryPolicyStoreProcessorFactory" +
+ ",org.apache.sentry.api.generic.thrift.SentryGenericPolicyProcessorFactory";
+ public static final String SENTRY_STORE_JDBC_URL = "sentry.store.jdbc.url";
+ public static final String SENTRY_STORE_JDBC_USER = "sentry.store.jdbc.user";
+ public static final String SENTRY_STORE_JDBC_USER_DEFAULT = "Sentry";
+ public static final String SENTRY_STORE_JDBC_PASS = "sentry.store.jdbc.password";
+ public static final String SENTRY_STORE_JDBC_DRIVER = "sentry.store.jdbc.driver";
+ public static final String SENTRY_STORE_JDBC_DRIVER_DEFAULT = "org.apache.derby.jdbc.EmbeddedDriver";
+ // The configuration for the maximum number of retries per db transaction,
+ // the default value is 3 times
+ public static final String SENTRY_STORE_TRANSACTION_RETRY = "sentry.store.transaction.retry";
+ public static final int SENTRY_STORE_TRANSACTION_RETRY_DEFAULT = 10;
+ // The configuration for the delay (in milliseconds) between retries,
+ // the default value is 500 ms
+ public static final String SENTRY_STORE_TRANSACTION_RETRY_WAIT_TIME_MILLIS =
+ "sentry.store.transaction.retry.wait.time.millis";
+ public static final int SENTRY_STORE_TRANSACTION_RETRY_WAIT_TIME_MILLIS_DEFAULT = 250;
+
+ public static final String JAVAX_JDO_URL = "javax.jdo.option.ConnectionURL";
+ public static final String JAVAX_JDO_USER = "javax.jdo.option.ConnectionUserName";
+ public static final String JAVAX_JDO_PASS = "javax.jdo.option.ConnectionPassword";
+ public static final String JAVAX_JDO_DRIVER_NAME = "javax.jdo.option.ConnectionDriverName";
+
+ public static final String DATANUCLEUS_ISOLATION_LEVEL = "datanucleus.transactionIsolation";
+ public static final String DATANUCLEUS_REPEATABLE_READ = "repeatable-read";
+
+ public static final String SENTRY_DB_PROPERTY_PREFIX = "sentry.";
+ public static final String SENTRY_JAVAX_JDO_PROPERTY_PREFIX = SENTRY_DB_PROPERTY_PREFIX + "javax.jdo";
+ public static final String SENTRY_DATANUCLEUS_PROPERTY_PREFIX = SENTRY_DB_PROPERTY_PREFIX + "datanucleus";
+
+ public static final String SENTRY_VERIFY_SCHEM_VERSION = "sentry.verify.schema.version";
+ public static final String SENTRY_VERIFY_SCHEM_VERSION_DEFAULT = "true";
+
+ public static final String SENTRY_SERVICE_NAME = "sentry.service.name";
+ public static final String SENTRY_SERVICE_NAME_DEFAULT = "Sentry-Service";
+
+ public static final String SENTRY_STORE_GROUP_MAPPING = "sentry.store.group.mapping";
+ public static final String SENTRY_STORE_GROUP_MAPPING_RESOURCE = "sentry.store.group.mapping.resource";
+ public static final String SENTRY_STORE_HADOOP_GROUP_MAPPING = "org.apache.sentry.provider.common.HadoopGroupMappingService";
+ public static final String SENTRY_STORE_LOCAL_GROUP_MAPPING = "org.apache.sentry.provider.file.LocalGroupMappingService";
+ public static final String SENTRY_STORE_GROUP_MAPPING_DEFAULT = SENTRY_STORE_HADOOP_GROUP_MAPPING;
+
+ public static final String SENTRY_STORE_ORPHANED_PRIVILEGE_REMOVAL = "sentry.store.orphaned.privilege.removal";
+ public static final String SENTRY_STORE_ORPHANED_PRIVILEGE_REMOVAL_DEFAULT = "false";
+ public static final String SENTRY_STORE_CLEAN_PERIOD_SECONDS =
+ "sentry.store.clean.period.seconds";
+ public static final long SENTRY_STORE_CLEAN_PERIOD_SECONDS_DEFAULT = 43200; // 12 hours.
+ public static final String SENTRY_HA_ZK_PROPERTY_PREFIX = "sentry.ha.zookeeper.";
+ public static final String SENTRY_HA_ZOOKEEPER_SECURITY = SENTRY_HA_ZK_PROPERTY_PREFIX + "security";
+ public static final boolean SENTRY_HA_ZOOKEEPER_SECURITY_DEFAULT = false;
+ public static final String SENTRY_HA_ZOOKEEPER_QUORUM = SENTRY_HA_ZK_PROPERTY_PREFIX + "quorum";
+ public static final String SENTRY_HA_ZOOKEEPER_RETRIES_MAX_COUNT = SENTRY_HA_ZK_PROPERTY_PREFIX + "session.retries.max.count";
+ public static final int SENTRY_HA_ZOOKEEPER_RETRIES_MAX_COUNT_DEFAULT = 3;
+ public static final String SENTRY_HA_ZOOKEEPER_SLEEP_BETWEEN_RETRIES_MS = SENTRY_HA_ZK_PROPERTY_PREFIX + "session.sleep.between.retries.ms";
+ public static final int SENTRY_HA_ZOOKEEPER_SLEEP_BETWEEN_RETRIES_MS_DEFAULT = 100;
+ public static final String SENTRY_HA_ZOOKEEPER_NAMESPACE = SENTRY_HA_ZK_PROPERTY_PREFIX + "namespace";
+ public static final String SENTRY_HA_ZOOKEEPER_NAMESPACE_DEFAULT = "sentry";
+ // principal and keytab for client to be able to connect to secure ZK. Needed for Sentry HA with secure ZK
+ public static final String SERVER_HA_ZOOKEEPER_CLIENT_PRINCIPAL = "sentry.zookeeper.client.principal";
+ public static final String SERVER_HA_ZOOKEEPER_CLIENT_KEYTAB = "sentry.zookeeper.client.keytab";
+ public static final String SERVER_HA_ZOOKEEPER_CLIENT_TICKET_CACHE = "sentry.zookeeper.client.ticketcache";
+ public static final String SERVER_HA_ZOOKEEPER_CLIENT_TICKET_CACHE_DEFAULT = "false";
+ public static final String SERVER_HA_STANDBY_SIG = "sentry.ha.standby.signal";
+
+ // Timeout value in seconds for HMS notificationID synchronization
+ // Should match the value for RPC timeout in HMS client config
+ public static final String SENTRY_NOTIFICATION_SYNC_TIMEOUT_MS = "sentry.notification.sync.timeout.ms";
+ public static final int SENTRY_NOTIFICATION_SYNC_TIMEOUT_DEFAULT = 200000;
+
+ public static final ImmutableMap<String, String> SENTRY_STORE_DEFAULTS =
+ ImmutableMap.<String, String>builder()
+ .put("datanucleus.connectionPoolingType", "BoneCP")
+ .put("datanucleus.schema.validateTables", "false")
+ .put("datanucleus.schema.validateColumns", "false")
+ .put("datanucleus.schema.validateConstraints", "false")
+ .put("datanucleus.storeManagerType", "rdbms")
+ .put("datanucleus.schema.autoCreateAll", "false")
+ .put("datanucleus.autoStartMechanismMode", "checked")
+ .put(DATANUCLEUS_ISOLATION_LEVEL, DATANUCLEUS_REPEATABLE_READ)
+ .put("datanucleus.cache.level2", "false")
+ .put("datanucleus.cache.level2.type", "none")
+ .put("datanucleus.query.sql.allowAll", "true")
+ .put("datanucleus.identifierFactory", "datanucleus1")
+ .put("datanucleus.rdbms.useLegacyNativeValueStrategy", "true")
+ .put("datanucleus.plugin.pluginRegistryBundleCheck", "LOG")
+ .put("javax.jdo.PersistenceManagerFactoryClass",
+ "org.datanucleus.api.jdo.JDOPersistenceManagerFactory")
+ .put("javax.jdo.option.DetachAllOnCommit", "true")
+ .put("javax.jdo.option.NonTransactionalRead", "false")
+ .put("javax.jdo.option.NonTransactionalWrite", "false")
+ .put("javax.jdo.option.Multithreaded", "true")
+ .build();
+
+ // InitialDelay and period time for HMSFollower thread.
+ public static final String SENTRY_HMSFOLLOWER_INIT_DELAY_MILLS = "sentry.hmsfollower.init.delay.mills";
+ public static final long SENTRY_HMSFOLLOWER_INIT_DELAY_MILLS_DEFAULT = 0;
+ public static final String SENTRY_HMSFOLLOWER_INTERVAL_MILLS = "sentry.hmsfollower.interval.mills";
+ public static final long SENTRY_HMSFOLLOWER_INTERVAL_MILLS_DEFAULT = 500;
+
+ public static final String SENTRY_WEB_ENABLE = "sentry.service.web.enable";
+ public static final Boolean SENTRY_WEB_ENABLE_DEFAULT = false;
+ public static final String SENTRY_WEB_PORT = "sentry.service.web.port";
+ public static final int SENTRY_WEB_PORT_DEFAULT = 29000;
+ // Reporter is either "console", "log" or "jmx"
+ public static final String SENTRY_REPORTER = "sentry.service.reporter";
+// SENTRY-2206, doesn't look like either 2 are being used.
+// public static final String SENTRY_REPORTER_JMX = SentryMetrics.Reporting.JMX.name(); //case insensitive
+// public static final String SENTRY_REPORTER_CONSOLE = SentryMetrics.Reporting.CONSOLE.name();//case insensitive
+
+ // for console reporter, reporting interval in seconds
+ public static final String SENTRY_REPORTER_INTERVAL_SEC =
+ "sentry.service.reporter.interval.sec";
+ public static final String SENTRY_JSON_REPORTER_FILE = "sentry.service.reporter.file";
+ public static final String SENTRY_JSON_REPORTER_FILE_DEFAULT = "/tmp/sentry-metrics.json";
+
+ // Report every 5 minutes by default
+ public static final int SENTRY_REPORTER_INTERVAL_DEFAULT = 300;
+
+ // Web SSL
+ public static final String SENTRY_WEB_USE_SSL = "sentry.web.use.ssl";
+ public static final String SENTRY_WEB_SSL_KEYSTORE_PATH = "sentry.web.ssl.keystore.path";
+ public static final String SENTRY_WEB_SSL_KEYSTORE_PASSWORD = "sentry.web.ssl.keystore.password";
+ public static final String SENTRY_SSL_PROTOCOL_BLACKLIST = "sentry.ssl.protocol.blacklist";
+ // Blacklist SSL protocols that are not secure (e.g., POODLE vulnerability)
+ public static final String[] SENTRY_SSL_PROTOCOL_BLACKLIST_DEFAULT = {"SSLv2", "SSLv2Hello", "SSLv3"};
+
+ // Web Security
+ public static final String SENTRY_WEB_SECURITY_PREFIX = "sentry.service.web.authentication";
+ public static final String SENTRY_WEB_SECURITY_TYPE = SENTRY_WEB_SECURITY_PREFIX + ".type";
+ public static final String SENTRY_WEB_SECURITY_TYPE_NONE = "NONE";
+ public static final String SENTRY_WEB_SECURITY_TYPE_KERBEROS = "KERBEROS";
+ public static final String SENTRY_WEB_SECURITY_PRINCIPAL = SENTRY_WEB_SECURITY_PREFIX + ".kerberos.principal";
+ public static final String SENTRY_WEB_SECURITY_KEYTAB = SENTRY_WEB_SECURITY_PREFIX + ".kerberos.keytab";
+ public static final String SENTRY_WEB_SECURITY_ALLOW_CONNECT_USERS = SENTRY_WEB_SECURITY_PREFIX + ".allow.connect.users";
+
+ // Flag to enable admin servlet
+ public static final String SENTRY_WEB_ADMIN_SERVLET_ENABLED = "sentry.web.admin.servlet.enabled";
+ public static final boolean SENTRY_WEB_ADMIN_SERVLET_ENABLED_DEFAULT = false;
+
+ public static final String SENTRY_WEB_PUBSUB_SERVLET_ENABLED = "sentry.web.pubsub.servlet.enabled";
+ public static final boolean SENTRY_WEB_PUBSUB_SERVLET_ENABLED_DEFAULT = false;
+
+ // max message size for thrift messages
+ public static final String SENTRY_POLICY_SERVER_THRIFT_MAX_MESSAGE_SIZE = "sentry.policy.server.thrift.max.message.size";
+ public static final long SENTRY_POLICY_SERVER_THRIFT_MAX_MESSAGE_SIZE_DEFAULT = 100 * 1024 * 1024;
+
+ // action factories for external components
+ public static final String SENTRY_COMPONENT_ACTION_FACTORY_FORMAT = "sentry.%s.action.factory";
+
+ // Sentry is never a client to other Kerberos Services, it should not be required to renew the TGT
+ @Deprecated
+ public static final String SENTRY_KERBEROS_TGT_AUTORENEW = "sentry.service.kerberos.tgt.autorenew";
+ @Deprecated
+ public static final Boolean SENTRY_KERBEROS_TGT_AUTORENEW_DEFAULT = false;
+
+ /**
+ * Number of path/priv deltas to keep around during cleaning
+ * The value which is too small may cause unnecessary full snapshots sent to the Name Node
+ * A value which is too large may cause slowdown due to too many deltas lying around in the DB.
+ */
+ public static final String SENTRY_DELTA_KEEP_COUNT = "sentry.server.delta.keep.count";
+ public static final int SENTRY_DELTA_KEEP_COUNT_DEFAULT = 200;
+
+ /**
+ * Number of notification id's to keep around during cleaning
+ */
+ public static final String SENTRY_HMS_NOTIFICATION_ID_KEEP_COUNT = "sentry.server.delta.keep.count";
+ public static final int SENTRY_HMS_NOTIFICATION_ID_KEEP_COUNT_DEFAULT = 100;
+ }
+
+ public static final String SENTRY_ZK_JAAS_NAME = "Sentry";
+ public static final String CURRENT_INCARNATION_ID_KEY = "current.incarnation.key";
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-dist/src/license/THIRD-PARTY.properties
----------------------------------------------------------------------
diff --git a/sentry-dist/src/license/THIRD-PARTY.properties b/sentry-dist/src/license/THIRD-PARTY.properties
index 2f9f0b0..b39e1b6 100644
--- a/sentry-dist/src/license/THIRD-PARTY.properties
+++ b/sentry-dist/src/license/THIRD-PARTY.properties
@@ -19,6 +19,7 @@
# - MIT License
# - Mozilla Public License Version 1.1
# - Public Domain
+# - Revised BSD
# - The Apache License, Version 2.0
# - The Apache Software License, Version 1.1
# - The Apache Software License, Version 2.0
@@ -28,7 +29,7 @@
# Please fill the missing licenses for dependencies :
#
#
-#Wed Mar 28 16:37:41 IST 2018
+#Mon Apr 30 16:44:05 CDT 2018
ant--ant--1.5=The Apache Software License, Version 2.0
asm--asm--3.1=BSD
dom4j--dom4j--1.6.1=BSD
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHdfsMetricsUtil.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHdfsMetricsUtil.java b/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHdfsMetricsUtil.java
index 932a5c0..03ccb44 100644
--- a/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHdfsMetricsUtil.java
+++ b/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHdfsMetricsUtil.java
@@ -22,7 +22,7 @@ import com.codahale.metrics.Counter;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Timer;
-import org.apache.sentry.provider.db.service.thrift.SentryMetrics;
+import org.apache.sentry.api.service.thrift.SentryMetrics;
/**
* Util class to support metrics.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java b/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
index fa83589..ba7be8a 100644
--- a/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
+++ b/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
@@ -23,6 +23,7 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.hadoop.conf.Configuration;
+import org.apache.sentry.api.common.ApiConstants.PrivilegeScope;
import org.apache.sentry.core.common.exception.SentryInvalidInputException;
import org.apache.sentry.core.common.utils.PubSub;
import org.apache.sentry.core.common.utils.SigUtils;
@@ -33,19 +34,18 @@ import org.apache.sentry.hdfs.service.thrift.TPrivilegeEntityType;
import org.apache.sentry.hdfs.service.thrift.TRoleChanges;
import org.apache.sentry.provider.db.SentryPolicyStorePlugin;
import org.apache.sentry.provider.db.service.persistent.SentryStore;
-import org.apache.sentry.service.thrift.SentryServiceUtil;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleAddGroupsRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleDeleteGroupsRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleGrantPrivilegeRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleRevokePrivilegeRequest;
-import org.apache.sentry.provider.db.service.thrift.TDropPrivilegesRequest;
-import org.apache.sentry.provider.db.service.thrift.TDropSentryRoleRequest;
-import org.apache.sentry.provider.db.service.thrift.TRenamePrivilegesRequest;
-import org.apache.sentry.provider.db.service.thrift.TSentryGroup;
-import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege;
+import org.apache.sentry.api.common.SentryServiceUtil;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleAddGroupsRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleDeleteGroupsRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleGrantPrivilegeRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleRevokePrivilegeRequest;
+import org.apache.sentry.api.service.thrift.TDropPrivilegesRequest;
+import org.apache.sentry.api.service.thrift.TDropSentryRoleRequest;
+import org.apache.sentry.api.service.thrift.TRenamePrivilegesRequest;
+import org.apache.sentry.api.service.thrift.TSentryGroup;
+import org.apache.sentry.api.service.thrift.TSentryPrivilege;
import org.apache.sentry.provider.db.service.persistent.HMSFollower;
import com.google.common.base.Preconditions;
-import org.apache.sentry.service.thrift.ServiceConstants.PrivilegeScope;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/pom.xml
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/pom.xml b/sentry-provider/sentry-provider-db/pom.xml
index 369e262..48a187a 100644
--- a/sentry-provider/sentry-provider-db/pom.xml
+++ b/sentry-provider/sentry-provider-db/pom.xml
@@ -149,6 +149,11 @@ limitations under the License.
<artifactId>sentry-hdfs-common</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-service-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-shims</artifactId>
<scope>provided</scope>
@@ -305,24 +310,6 @@ limitations under the License.
</configuration>
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>src/gen/thrift/gen-javabean</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-maven-plugin</artifactId>
<version>${datanucleus.maven.plugin.version}</version>
@@ -412,82 +399,5 @@ limitations under the License.
</executions>
</plugin>
</plugins>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <sourcepath>${project.build.sourceDirectory}:${basedir}/src/gen/thrift/gen-javabean</sourcepath>
- <sourceFileExcludes>
- <exclude>${project.build.sourceDirectory}:${basedir}/src/gen/thrift/gen-javabean</exclude>
- </sourceFileExcludes>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
</build>
- <profiles>
- <profile>
- <id>thriftif</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-thrift-sources</id>
- <phase>generate-sources</phase>
- <configuration>
- <target>
- <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask"
- classpathref="maven.plugin.classpath" />
- <property name="thrift.args" value="-I ${thrift.home} --gen java:beans,hashcode,generated_annotations=undated"/>
- <property name="thrift.gen.dir" value="${basedir}/src/gen/thrift"/>
- <delete dir="${thrift.gen.dir}"/>
- <mkdir dir="${thrift.gen.dir}"/>
- <for param="thrift.file">
- <path>
- <fileset dir="${basedir}/src/main/resources/" includes="**/*.thrift" />
- </path>
- <sequential>
- <echo message="Generating Thrift code for @{thrift.file}"/>
- <exec executable="${thrift.home}/bin/thrift" failonerror="true" dir=".">
- <arg line="${thrift.args} -I ${basedir}/src/main/resources/ -o ${thrift.gen.dir} @{thrift.file} " />
- </exec>
- </sequential>
- </for>
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <executions>
- <execution>
- <id>enforce-property</id>
- <goals>
- <goal>enforce</goal>
- </goals>
- <configuration>
- <rules>
- <requireProperty>
- <property>thrift.home</property>
- </requireProperty>
- </rules>
- <fail>true</fail>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
</project>
[48/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleAddGroupsRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleAddGroupsRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleAddGroupsRequest.java
deleted file mode 100644
index 2465a88..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleAddGroupsRequest.java
+++ /dev/null
@@ -1,842 +0,0 @@
-/**
- * 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.provider.db.generic.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 TAlterSentryRoleAddGroupsRequest implements org.apache.thrift.TBase<TAlterSentryRoleAddGroupsRequest, TAlterSentryRoleAddGroupsRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleAddGroupsRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleAddGroupsRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
- private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)5);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleAddGroupsRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleAddGroupsRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private String component; // required
- private Set<String> groups; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName"),
- COMPONENT((short)4, "component"),
- GROUPS((short)5, "groups");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- case 4: // COMPONENT
- return COMPONENT;
- case 5: // GROUPS
- return GROUPS;
- 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleAddGroupsRequest.class, metaDataMap);
- }
-
- public TAlterSentryRoleAddGroupsRequest() {
- this.protocol_version = 2;
-
- }
-
- public TAlterSentryRoleAddGroupsRequest(
- int protocol_version,
- String requestorUserName,
- String roleName,
- String component,
- Set<String> groups)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- this.component = component;
- this.groups = groups;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleAddGroupsRequest(TAlterSentryRoleAddGroupsRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetComponent()) {
- this.component = other.component;
- }
- if (other.isSetGroups()) {
- Set<String> __this__groups = new HashSet<String>(other.groups);
- this.groups = __this__groups;
- }
- }
-
- public TAlterSentryRoleAddGroupsRequest deepCopy() {
- return new TAlterSentryRoleAddGroupsRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.component = null;
- this.groups = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public String getComponent() {
- return this.component;
- }
-
- public void setComponent(String component) {
- this.component = component;
- }
-
- public void unsetComponent() {
- this.component = null;
- }
-
- /** Returns true if field component is set (has been assigned a value) and false otherwise */
- public boolean isSetComponent() {
- return this.component != null;
- }
-
- public void setComponentIsSet(boolean value) {
- if (!value) {
- this.component = null;
- }
- }
-
- public int getGroupsSize() {
- return (this.groups == null) ? 0 : this.groups.size();
- }
-
- public java.util.Iterator<String> getGroupsIterator() {
- return (this.groups == null) ? null : this.groups.iterator();
- }
-
- public void addToGroups(String elem) {
- if (this.groups == null) {
- this.groups = new HashSet<String>();
- }
- this.groups.add(elem);
- }
-
- public Set<String> getGroups() {
- return this.groups;
- }
-
- public void setGroups(Set<String> groups) {
- this.groups = groups;
- }
-
- public void unsetGroups() {
- this.groups = null;
- }
-
- /** Returns true if field groups is set (has been assigned a value) and false otherwise */
- public boolean isSetGroups() {
- return this.groups != null;
- }
-
- public void setGroupsIsSet(boolean value) {
- if (!value) {
- this.groups = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case COMPONENT:
- if (value == null) {
- unsetComponent();
- } else {
- setComponent((String)value);
- }
- break;
-
- case GROUPS:
- if (value == null) {
- unsetGroups();
- } else {
- setGroups((Set<String>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case COMPONENT:
- return getComponent();
-
- case GROUPS:
- return getGroups();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case COMPONENT:
- return isSetComponent();
- case GROUPS:
- return isSetGroups();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleAddGroupsRequest)
- return this.equals((TAlterSentryRoleAddGroupsRequest)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleAddGroupsRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- boolean this_present_component = true && this.isSetComponent();
- boolean that_present_component = true && that.isSetComponent();
- if (this_present_component || that_present_component) {
- if (!(this_present_component && that_present_component))
- return false;
- if (!this.component.equals(that.component))
- return false;
- }
-
- boolean this_present_groups = true && this.isSetGroups();
- boolean that_present_groups = true && that.isSetGroups();
- if (this_present_groups || that_present_groups) {
- if (!(this_present_groups && that_present_groups))
- return false;
- if (!this.groups.equals(that.groups))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- boolean present_component = true && (isSetComponent());
- list.add(present_component);
- if (present_component)
- list.add(component);
-
- boolean present_groups = true && (isSetGroups());
- list.add(present_groups);
- if (present_groups)
- list.add(groups);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleAddGroupsRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetComponent()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGroups()).compareTo(other.isSetGroups());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroups()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, other.groups);
- 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("TAlterSentryRoleAddGroupsRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("component:");
- if (this.component == null) {
- sb.append("null");
- } else {
- sb.append(this.component);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("groups:");
- if (this.groups == null) {
- sb.append("null");
- } else {
- sb.append(this.groups);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- if (!isSetComponent()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
- }
-
- if (!isSetGroups()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'groups' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TAlterSentryRoleAddGroupsRequestStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleAddGroupsRequestStandardScheme getScheme() {
- return new TAlterSentryRoleAddGroupsRequestStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleAddGroupsRequestStandardScheme extends StandardScheme<TAlterSentryRoleAddGroupsRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleAddGroupsRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // COMPONENT
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // GROUPS
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set8 = iprot.readSetBegin();
- struct.groups = new HashSet<String>(2*_set8.size);
- String _elem9;
- for (int _i10 = 0; _i10 < _set8.size; ++_i10)
- {
- _elem9 = iprot.readString();
- struct.groups.add(_elem9);
- }
- iprot.readSetEnd();
- }
- struct.setGroupsIsSet(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, TAlterSentryRoleAddGroupsRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.component != null) {
- oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
- oprot.writeString(struct.component);
- oprot.writeFieldEnd();
- }
- if (struct.groups != null) {
- oprot.writeFieldBegin(GROUPS_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.groups.size()));
- for (String _iter11 : struct.groups)
- {
- oprot.writeString(_iter11);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleAddGroupsRequestTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleAddGroupsRequestTupleScheme getScheme() {
- return new TAlterSentryRoleAddGroupsRequestTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleAddGroupsRequestTupleScheme extends TupleScheme<TAlterSentryRoleAddGroupsRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- oprot.writeString(struct.component);
- {
- oprot.writeI32(struct.groups.size());
- for (String _iter12 : struct.groups)
- {
- oprot.writeString(_iter12);
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set13 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.groups = new HashSet<String>(2*_set13.size);
- String _elem14;
- for (int _i15 = 0; _i15 < _set13.size; ++_i15)
- {
- _elem14 = iprot.readString();
- struct.groups.add(_elem14);
- }
- }
- struct.setGroupsIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleAddGroupsResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleAddGroupsResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleAddGroupsResponse.java
deleted file mode 100644
index bb238ba..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleAddGroupsResponse.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/**
- * 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.provider.db.generic.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 TAlterSentryRoleAddGroupsResponse implements org.apache.thrift.TBase<TAlterSentryRoleAddGroupsResponse, TAlterSentryRoleAddGroupsResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleAddGroupsResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleAddGroupsResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleAddGroupsResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleAddGroupsResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleAddGroupsResponse.class, metaDataMap);
- }
-
- public TAlterSentryRoleAddGroupsResponse() {
- }
-
- public TAlterSentryRoleAddGroupsResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleAddGroupsResponse(TAlterSentryRoleAddGroupsResponse other) {
- if (other.isSetStatus()) {
- this.status = other.status;
- }
- }
-
- public TAlterSentryRoleAddGroupsResponse deepCopy() {
- return new TAlterSentryRoleAddGroupsResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleAddGroupsResponse)
- return this.equals((TAlterSentryRoleAddGroupsResponse)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleAddGroupsResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleAddGroupsResponse 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;
- }
- }
- 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("TAlterSentryRoleAddGroupsResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // check for sub-struct validity
- }
-
- 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 TAlterSentryRoleAddGroupsResponseStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleAddGroupsResponseStandardScheme getScheme() {
- return new TAlterSentryRoleAddGroupsResponseStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleAddGroupsResponseStandardScheme extends StandardScheme<TAlterSentryRoleAddGroupsResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleAddGroupsResponse 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;
- 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, TAlterSentryRoleAddGroupsResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleAddGroupsResponseTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleAddGroupsResponseTupleScheme getScheme() {
- return new TAlterSentryRoleAddGroupsResponseTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleAddGroupsResponseTupleScheme extends TupleScheme<TAlterSentryRoleAddGroupsResponse> {
-
- @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);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsResponse 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);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java
deleted file mode 100644
index ab8d9d1..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java
+++ /dev/null
@@ -1,842 +0,0 @@
-/**
- * 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.provider.db.generic.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 TAlterSentryRoleDeleteGroupsRequest implements org.apache.thrift.TBase<TAlterSentryRoleDeleteGroupsRequest, TAlterSentryRoleDeleteGroupsRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleDeleteGroupsRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleDeleteGroupsRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
- private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)5);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleDeleteGroupsRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleDeleteGroupsRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private String component; // required
- private Set<String> groups; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName"),
- COMPONENT((short)4, "component"),
- GROUPS((short)5, "groups");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- case 4: // COMPONENT
- return COMPONENT;
- case 5: // GROUPS
- return GROUPS;
- 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleDeleteGroupsRequest.class, metaDataMap);
- }
-
- public TAlterSentryRoleDeleteGroupsRequest() {
- this.protocol_version = 2;
-
- }
-
- public TAlterSentryRoleDeleteGroupsRequest(
- int protocol_version,
- String requestorUserName,
- String roleName,
- String component,
- Set<String> groups)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- this.component = component;
- this.groups = groups;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleDeleteGroupsRequest(TAlterSentryRoleDeleteGroupsRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetComponent()) {
- this.component = other.component;
- }
- if (other.isSetGroups()) {
- Set<String> __this__groups = new HashSet<String>(other.groups);
- this.groups = __this__groups;
- }
- }
-
- public TAlterSentryRoleDeleteGroupsRequest deepCopy() {
- return new TAlterSentryRoleDeleteGroupsRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.component = null;
- this.groups = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public String getComponent() {
- return this.component;
- }
-
- public void setComponent(String component) {
- this.component = component;
- }
-
- public void unsetComponent() {
- this.component = null;
- }
-
- /** Returns true if field component is set (has been assigned a value) and false otherwise */
- public boolean isSetComponent() {
- return this.component != null;
- }
-
- public void setComponentIsSet(boolean value) {
- if (!value) {
- this.component = null;
- }
- }
-
- public int getGroupsSize() {
- return (this.groups == null) ? 0 : this.groups.size();
- }
-
- public java.util.Iterator<String> getGroupsIterator() {
- return (this.groups == null) ? null : this.groups.iterator();
- }
-
- public void addToGroups(String elem) {
- if (this.groups == null) {
- this.groups = new HashSet<String>();
- }
- this.groups.add(elem);
- }
-
- public Set<String> getGroups() {
- return this.groups;
- }
-
- public void setGroups(Set<String> groups) {
- this.groups = groups;
- }
-
- public void unsetGroups() {
- this.groups = null;
- }
-
- /** Returns true if field groups is set (has been assigned a value) and false otherwise */
- public boolean isSetGroups() {
- return this.groups != null;
- }
-
- public void setGroupsIsSet(boolean value) {
- if (!value) {
- this.groups = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case COMPONENT:
- if (value == null) {
- unsetComponent();
- } else {
- setComponent((String)value);
- }
- break;
-
- case GROUPS:
- if (value == null) {
- unsetGroups();
- } else {
- setGroups((Set<String>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case COMPONENT:
- return getComponent();
-
- case GROUPS:
- return getGroups();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case COMPONENT:
- return isSetComponent();
- case GROUPS:
- return isSetGroups();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleDeleteGroupsRequest)
- return this.equals((TAlterSentryRoleDeleteGroupsRequest)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleDeleteGroupsRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- boolean this_present_component = true && this.isSetComponent();
- boolean that_present_component = true && that.isSetComponent();
- if (this_present_component || that_present_component) {
- if (!(this_present_component && that_present_component))
- return false;
- if (!this.component.equals(that.component))
- return false;
- }
-
- boolean this_present_groups = true && this.isSetGroups();
- boolean that_present_groups = true && that.isSetGroups();
- if (this_present_groups || that_present_groups) {
- if (!(this_present_groups && that_present_groups))
- return false;
- if (!this.groups.equals(that.groups))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- boolean present_component = true && (isSetComponent());
- list.add(present_component);
- if (present_component)
- list.add(component);
-
- boolean present_groups = true && (isSetGroups());
- list.add(present_groups);
- if (present_groups)
- list.add(groups);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleDeleteGroupsRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetComponent()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGroups()).compareTo(other.isSetGroups());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroups()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, other.groups);
- 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("TAlterSentryRoleDeleteGroupsRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("component:");
- if (this.component == null) {
- sb.append("null");
- } else {
- sb.append(this.component);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("groups:");
- if (this.groups == null) {
- sb.append("null");
- } else {
- sb.append(this.groups);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- if (!isSetComponent()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
- }
-
- if (!isSetGroups()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'groups' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TAlterSentryRoleDeleteGroupsRequestStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleDeleteGroupsRequestStandardScheme getScheme() {
- return new TAlterSentryRoleDeleteGroupsRequestStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleDeleteGroupsRequestStandardScheme extends StandardScheme<TAlterSentryRoleDeleteGroupsRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleDeleteGroupsRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // COMPONENT
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // GROUPS
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set16 = iprot.readSetBegin();
- struct.groups = new HashSet<String>(2*_set16.size);
- String _elem17;
- for (int _i18 = 0; _i18 < _set16.size; ++_i18)
- {
- _elem17 = iprot.readString();
- struct.groups.add(_elem17);
- }
- iprot.readSetEnd();
- }
- struct.setGroupsIsSet(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, TAlterSentryRoleDeleteGroupsRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.component != null) {
- oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
- oprot.writeString(struct.component);
- oprot.writeFieldEnd();
- }
- if (struct.groups != null) {
- oprot.writeFieldBegin(GROUPS_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.groups.size()));
- for (String _iter19 : struct.groups)
- {
- oprot.writeString(_iter19);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleDeleteGroupsRequestTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleDeleteGroupsRequestTupleScheme getScheme() {
- return new TAlterSentryRoleDeleteGroupsRequestTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleDeleteGroupsRequestTupleScheme extends TupleScheme<TAlterSentryRoleDeleteGroupsRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- oprot.writeString(struct.component);
- {
- oprot.writeI32(struct.groups.size());
- for (String _iter20 : struct.groups)
- {
- oprot.writeString(_iter20);
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set21 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.groups = new HashSet<String>(2*_set21.size);
- String _elem22;
- for (int _i23 = 0; _i23 < _set21.size; ++_i23)
- {
- _elem22 = iprot.readString();
- struct.groups.add(_elem22);
- }
- }
- struct.setGroupsIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleDeleteGroupsResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleDeleteGroupsResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleDeleteGroupsResponse.java
deleted file mode 100644
index 68c5cf1..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleDeleteGroupsResponse.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/**
- * 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.provider.db.generic.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 TAlterSentryRoleDeleteGroupsResponse implements org.apache.thrift.TBase<TAlterSentryRoleDeleteGroupsResponse, TAlterSentryRoleDeleteGroupsResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleDeleteGroupsResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleDeleteGroupsResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleDeleteGroupsResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleDeleteGroupsResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleDeleteGroupsResponse.class, metaDataMap);
- }
-
- public TAlterSentryRoleDeleteGroupsResponse() {
- }
-
- public TAlterSentryRoleDeleteGroupsResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleDeleteGroupsResponse(TAlterSentryRoleDeleteGroupsResponse other) {
- if (other.isSetStatus()) {
- this.status = other.status;
- }
- }
-
- public TAlterSentryRoleDeleteGroupsResponse deepCopy() {
- return new TAlterSentryRoleDeleteGroupsResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleDeleteGroupsResponse)
- return this.equals((TAlterSentryRoleDeleteGroupsResponse)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleDeleteGroupsResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleDeleteGroupsResponse 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;
- }
- }
- 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("TAlterSentryRoleDeleteGroupsResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // check for sub-struct validity
- }
-
- 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 TAlterSentryRoleDeleteGroupsResponseStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleDeleteGroupsResponseStandardScheme getScheme() {
- return new TAlterSentryRoleDeleteGroupsResponseStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleDeleteGroupsResponseStandardScheme extends StandardScheme<TAlterSentryRoleDeleteGroupsResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleDeleteGroupsResponse 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;
- 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, TAlterSentryRoleDeleteGroupsResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleDeleteGroupsResponseTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleDeleteGroupsResponseTupleScheme getScheme() {
- return new TAlterSentryRoleDeleteGroupsResponseTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleDeleteGroupsResponseTupleScheme extends TupleScheme<TAlterSentryRoleDeleteGroupsResponse> {
-
- @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 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);
- }
- }
-
-}
-
[05/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesByAuthRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesByAuthRequest.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesByAuthRequest.java
new file mode 100644
index 0000000..1d8e916
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesByAuthRequest.java
@@ -0,0 +1,1112 @@
+/**
+ * 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.generic.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 TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBase<TListSentryPrivilegesByAuthRequest, TListSentryPrivilegesByAuthRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesByAuthRequest> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesByAuthRequest");
+
+ 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField SERVICE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("serviceName", org.apache.thrift.protocol.TType.STRING, (short)4);
+ private static final org.apache.thrift.protocol.TField AUTHORIZABLES_SET_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizablesSet", org.apache.thrift.protocol.TType.SET, (short)5);
+ private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)6);
+ private static final org.apache.thrift.protocol.TField ROLE_SET_FIELD_DESC = new org.apache.thrift.protocol.TField("roleSet", org.apache.thrift.protocol.TType.STRUCT, (short)7);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TListSentryPrivilegesByAuthRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TListSentryPrivilegesByAuthRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String component; // required
+ private String serviceName; // required
+ private Set<String> authorizablesSet; // required
+ private Set<String> groups; // optional
+ private TSentryActiveRoleSet roleSet; // optional
+
+ /** 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"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ COMPONENT((short)3, "component"),
+ SERVICE_NAME((short)4, "serviceName"),
+ AUTHORIZABLES_SET((short)5, "authorizablesSet"),
+ GROUPS((short)6, "groups"),
+ ROLE_SET((short)7, "roleSet");
+
+ 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: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // COMPONENT
+ return COMPONENT;
+ case 4: // SERVICE_NAME
+ return SERVICE_NAME;
+ case 5: // AUTHORIZABLES_SET
+ return AUTHORIZABLES_SET;
+ case 6: // GROUPS
+ return GROUPS;
+ case 7: // ROLE_SET
+ return ROLE_SET;
+ 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 byte __isset_bitfield = 0;
+ private static final _Fields optionals[] = {_Fields.GROUPS,_Fields.ROLE_SET};
+ 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.SERVICE_NAME, new org.apache.thrift.meta_data.FieldMetaData("serviceName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.AUTHORIZABLES_SET, new org.apache.thrift.meta_data.FieldMetaData("authorizablesSet", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ tmpMap.put(_Fields.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ tmpMap.put(_Fields.ROLE_SET, new org.apache.thrift.meta_data.FieldMetaData("roleSet", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryActiveRoleSet.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesByAuthRequest.class, metaDataMap);
+ }
+
+ public TListSentryPrivilegesByAuthRequest() {
+ this.protocol_version = 2;
+
+ }
+
+ public TListSentryPrivilegesByAuthRequest(
+ int protocol_version,
+ String requestorUserName,
+ String component,
+ String serviceName,
+ Set<String> authorizablesSet)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.component = component;
+ this.serviceName = serviceName;
+ this.authorizablesSet = authorizablesSet;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TListSentryPrivilegesByAuthRequest(TListSentryPrivilegesByAuthRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetComponent()) {
+ this.component = other.component;
+ }
+ if (other.isSetServiceName()) {
+ this.serviceName = other.serviceName;
+ }
+ if (other.isSetAuthorizablesSet()) {
+ Set<String> __this__authorizablesSet = new HashSet<String>(other.authorizablesSet);
+ this.authorizablesSet = __this__authorizablesSet;
+ }
+ if (other.isSetGroups()) {
+ Set<String> __this__groups = new HashSet<String>(other.groups);
+ this.groups = __this__groups;
+ }
+ if (other.isSetRoleSet()) {
+ this.roleSet = new TSentryActiveRoleSet(other.roleSet);
+ }
+ }
+
+ public TListSentryPrivilegesByAuthRequest deepCopy() {
+ return new TListSentryPrivilegesByAuthRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 2;
+
+ this.requestorUserName = null;
+ this.component = null;
+ this.serviceName = null;
+ this.authorizablesSet = null;
+ this.groups = null;
+ this.roleSet = 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 String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public String getComponent() {
+ return this.component;
+ }
+
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ public void unsetComponent() {
+ this.component = null;
+ }
+
+ /** Returns true if field component is set (has been assigned a value) and false otherwise */
+ public boolean isSetComponent() {
+ return this.component != null;
+ }
+
+ public void setComponentIsSet(boolean value) {
+ if (!value) {
+ this.component = null;
+ }
+ }
+
+ public String getServiceName() {
+ return this.serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public void unsetServiceName() {
+ this.serviceName = null;
+ }
+
+ /** Returns true if field serviceName is set (has been assigned a value) and false otherwise */
+ public boolean isSetServiceName() {
+ return this.serviceName != null;
+ }
+
+ public void setServiceNameIsSet(boolean value) {
+ if (!value) {
+ this.serviceName = null;
+ }
+ }
+
+ public int getAuthorizablesSetSize() {
+ return (this.authorizablesSet == null) ? 0 : this.authorizablesSet.size();
+ }
+
+ public java.util.Iterator<String> getAuthorizablesSetIterator() {
+ return (this.authorizablesSet == null) ? null : this.authorizablesSet.iterator();
+ }
+
+ public void addToAuthorizablesSet(String elem) {
+ if (this.authorizablesSet == null) {
+ this.authorizablesSet = new HashSet<String>();
+ }
+ this.authorizablesSet.add(elem);
+ }
+
+ public Set<String> getAuthorizablesSet() {
+ return this.authorizablesSet;
+ }
+
+ public void setAuthorizablesSet(Set<String> authorizablesSet) {
+ this.authorizablesSet = authorizablesSet;
+ }
+
+ public void unsetAuthorizablesSet() {
+ this.authorizablesSet = null;
+ }
+
+ /** Returns true if field authorizablesSet is set (has been assigned a value) and false otherwise */
+ public boolean isSetAuthorizablesSet() {
+ return this.authorizablesSet != null;
+ }
+
+ public void setAuthorizablesSetIsSet(boolean value) {
+ if (!value) {
+ this.authorizablesSet = null;
+ }
+ }
+
+ public int getGroupsSize() {
+ return (this.groups == null) ? 0 : this.groups.size();
+ }
+
+ public java.util.Iterator<String> getGroupsIterator() {
+ return (this.groups == null) ? null : this.groups.iterator();
+ }
+
+ public void addToGroups(String elem) {
+ if (this.groups == null) {
+ this.groups = new HashSet<String>();
+ }
+ this.groups.add(elem);
+ }
+
+ public Set<String> getGroups() {
+ return this.groups;
+ }
+
+ public void setGroups(Set<String> groups) {
+ this.groups = groups;
+ }
+
+ public void unsetGroups() {
+ this.groups = null;
+ }
+
+ /** Returns true if field groups is set (has been assigned a value) and false otherwise */
+ public boolean isSetGroups() {
+ return this.groups != null;
+ }
+
+ public void setGroupsIsSet(boolean value) {
+ if (!value) {
+ this.groups = null;
+ }
+ }
+
+ public TSentryActiveRoleSet getRoleSet() {
+ return this.roleSet;
+ }
+
+ public void setRoleSet(TSentryActiveRoleSet roleSet) {
+ this.roleSet = roleSet;
+ }
+
+ public void unsetRoleSet() {
+ this.roleSet = null;
+ }
+
+ /** Returns true if field roleSet is set (has been assigned a value) and false otherwise */
+ public boolean isSetRoleSet() {
+ return this.roleSet != null;
+ }
+
+ public void setRoleSetIsSet(boolean value) {
+ if (!value) {
+ this.roleSet = 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 REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case COMPONENT:
+ if (value == null) {
+ unsetComponent();
+ } else {
+ setComponent((String)value);
+ }
+ break;
+
+ case SERVICE_NAME:
+ if (value == null) {
+ unsetServiceName();
+ } else {
+ setServiceName((String)value);
+ }
+ break;
+
+ case AUTHORIZABLES_SET:
+ if (value == null) {
+ unsetAuthorizablesSet();
+ } else {
+ setAuthorizablesSet((Set<String>)value);
+ }
+ break;
+
+ case GROUPS:
+ if (value == null) {
+ unsetGroups();
+ } else {
+ setGroups((Set<String>)value);
+ }
+ break;
+
+ case ROLE_SET:
+ if (value == null) {
+ unsetRoleSet();
+ } else {
+ setRoleSet((TSentryActiveRoleSet)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return getProtocol_version();
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case COMPONENT:
+ return getComponent();
+
+ case SERVICE_NAME:
+ return getServiceName();
+
+ case AUTHORIZABLES_SET:
+ return getAuthorizablesSet();
+
+ case GROUPS:
+ return getGroups();
+
+ case ROLE_SET:
+ return getRoleSet();
+
+ }
+ 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 REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case COMPONENT:
+ return isSetComponent();
+ case SERVICE_NAME:
+ return isSetServiceName();
+ case AUTHORIZABLES_SET:
+ return isSetAuthorizablesSet();
+ case GROUPS:
+ return isSetGroups();
+ case ROLE_SET:
+ return isSetRoleSet();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TListSentryPrivilegesByAuthRequest)
+ return this.equals((TListSentryPrivilegesByAuthRequest)that);
+ return false;
+ }
+
+ public boolean equals(TListSentryPrivilegesByAuthRequest 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_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_component = true && this.isSetComponent();
+ boolean that_present_component = true && that.isSetComponent();
+ if (this_present_component || that_present_component) {
+ if (!(this_present_component && that_present_component))
+ return false;
+ if (!this.component.equals(that.component))
+ return false;
+ }
+
+ boolean this_present_serviceName = true && this.isSetServiceName();
+ boolean that_present_serviceName = true && that.isSetServiceName();
+ if (this_present_serviceName || that_present_serviceName) {
+ if (!(this_present_serviceName && that_present_serviceName))
+ return false;
+ if (!this.serviceName.equals(that.serviceName))
+ return false;
+ }
+
+ boolean this_present_authorizablesSet = true && this.isSetAuthorizablesSet();
+ boolean that_present_authorizablesSet = true && that.isSetAuthorizablesSet();
+ if (this_present_authorizablesSet || that_present_authorizablesSet) {
+ if (!(this_present_authorizablesSet && that_present_authorizablesSet))
+ return false;
+ if (!this.authorizablesSet.equals(that.authorizablesSet))
+ return false;
+ }
+
+ boolean this_present_groups = true && this.isSetGroups();
+ boolean that_present_groups = true && that.isSetGroups();
+ if (this_present_groups || that_present_groups) {
+ if (!(this_present_groups && that_present_groups))
+ return false;
+ if (!this.groups.equals(that.groups))
+ return false;
+ }
+
+ boolean this_present_roleSet = true && this.isSetRoleSet();
+ boolean that_present_roleSet = true && that.isSetRoleSet();
+ if (this_present_roleSet || that_present_roleSet) {
+ if (!(this_present_roleSet && that_present_roleSet))
+ return false;
+ if (!this.roleSet.equals(that.roleSet))
+ 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_requestorUserName = true && (isSetRequestorUserName());
+ list.add(present_requestorUserName);
+ if (present_requestorUserName)
+ list.add(requestorUserName);
+
+ boolean present_component = true && (isSetComponent());
+ list.add(present_component);
+ if (present_component)
+ list.add(component);
+
+ boolean present_serviceName = true && (isSetServiceName());
+ list.add(present_serviceName);
+ if (present_serviceName)
+ list.add(serviceName);
+
+ boolean present_authorizablesSet = true && (isSetAuthorizablesSet());
+ list.add(present_authorizablesSet);
+ if (present_authorizablesSet)
+ list.add(authorizablesSet);
+
+ boolean present_groups = true && (isSetGroups());
+ list.add(present_groups);
+ if (present_groups)
+ list.add(groups);
+
+ boolean present_roleSet = true && (isSetRoleSet());
+ list.add(present_roleSet);
+ if (present_roleSet)
+ list.add(roleSet);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TListSentryPrivilegesByAuthRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetComponent()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetServiceName()).compareTo(other.isSetServiceName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetServiceName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serviceName, other.serviceName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetAuthorizablesSet()).compareTo(other.isSetAuthorizablesSet());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAuthorizablesSet()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizablesSet, other.authorizablesSet);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGroups()).compareTo(other.isSetGroups());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGroups()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, other.groups);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleSet()).compareTo(other.isSetRoleSet());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleSet()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleSet, other.roleSet);
+ 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("TListSentryPrivilegesByAuthRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("component:");
+ if (this.component == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.component);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("serviceName:");
+ if (this.serviceName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.serviceName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("authorizablesSet:");
+ if (this.authorizablesSet == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.authorizablesSet);
+ }
+ first = false;
+ if (isSetGroups()) {
+ if (!first) sb.append(", ");
+ sb.append("groups:");
+ if (this.groups == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.groups);
+ }
+ first = false;
+ }
+ if (isSetRoleSet()) {
+ if (!first) sb.append(", ");
+ sb.append("roleSet:");
+ if (this.roleSet == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roleSet);
+ }
+ 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 (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetComponent()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
+ }
+
+ if (!isSetServiceName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'serviceName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetAuthorizablesSet()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'authorizablesSet' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (roleSet != null) {
+ roleSet.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 TListSentryPrivilegesByAuthRequestStandardSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesByAuthRequestStandardScheme getScheme() {
+ return new TListSentryPrivilegesByAuthRequestStandardScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesByAuthRequestStandardScheme extends StandardScheme<TListSentryPrivilegesByAuthRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesByAuthRequest 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: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // COMPONENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // SERVICE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.serviceName = iprot.readString();
+ struct.setServiceNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 5: // AUTHORIZABLES_SET
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set122 = iprot.readSetBegin();
+ struct.authorizablesSet = new HashSet<String>(2*_set122.size);
+ String _elem123;
+ for (int _i124 = 0; _i124 < _set122.size; ++_i124)
+ {
+ _elem123 = iprot.readString();
+ struct.authorizablesSet.add(_elem123);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setAuthorizablesSetIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 6: // GROUPS
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set125 = iprot.readSetBegin();
+ struct.groups = new HashSet<String>(2*_set125.size);
+ String _elem126;
+ for (int _i127 = 0; _i127 < _set125.size; ++_i127)
+ {
+ _elem126 = iprot.readString();
+ struct.groups.add(_elem126);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setGroupsIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 7: // ROLE_SET
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.roleSet = new TSentryActiveRoleSet();
+ struct.roleSet.read(iprot);
+ struct.setRoleSetIsSet(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, TListSentryPrivilegesByAuthRequest 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();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.component != null) {
+ oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
+ oprot.writeString(struct.component);
+ oprot.writeFieldEnd();
+ }
+ if (struct.serviceName != null) {
+ oprot.writeFieldBegin(SERVICE_NAME_FIELD_DESC);
+ oprot.writeString(struct.serviceName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.authorizablesSet != null) {
+ oprot.writeFieldBegin(AUTHORIZABLES_SET_FIELD_DESC);
+ {
+ oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.authorizablesSet.size()));
+ for (String _iter128 : struct.authorizablesSet)
+ {
+ oprot.writeString(_iter128);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.groups != null) {
+ if (struct.isSetGroups()) {
+ oprot.writeFieldBegin(GROUPS_FIELD_DESC);
+ {
+ oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.groups.size()));
+ for (String _iter129 : struct.groups)
+ {
+ oprot.writeString(_iter129);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.roleSet != null) {
+ if (struct.isSetRoleSet()) {
+ oprot.writeFieldBegin(ROLE_SET_FIELD_DESC);
+ struct.roleSet.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TListSentryPrivilegesByAuthRequestTupleSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesByAuthRequestTupleScheme getScheme() {
+ return new TListSentryPrivilegesByAuthRequestTupleScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesByAuthRequestTupleScheme extends TupleScheme<TListSentryPrivilegesByAuthRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesByAuthRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeString(struct.component);
+ oprot.writeString(struct.serviceName);
+ {
+ oprot.writeI32(struct.authorizablesSet.size());
+ for (String _iter130 : struct.authorizablesSet)
+ {
+ oprot.writeString(_iter130);
+ }
+ }
+ BitSet optionals = new BitSet();
+ if (struct.isSetGroups()) {
+ optionals.set(0);
+ }
+ if (struct.isSetRoleSet()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetGroups()) {
+ {
+ oprot.writeI32(struct.groups.size());
+ for (String _iter131 : struct.groups)
+ {
+ oprot.writeString(_iter131);
+ }
+ }
+ }
+ if (struct.isSetRoleSet()) {
+ struct.roleSet.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesByAuthRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ struct.serviceName = iprot.readString();
+ struct.setServiceNameIsSet(true);
+ {
+ org.apache.thrift.protocol.TSet _set132 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.authorizablesSet = new HashSet<String>(2*_set132.size);
+ String _elem133;
+ for (int _i134 = 0; _i134 < _set132.size; ++_i134)
+ {
+ _elem133 = iprot.readString();
+ struct.authorizablesSet.add(_elem133);
+ }
+ }
+ struct.setAuthorizablesSetIsSet(true);
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TSet _set135 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.groups = new HashSet<String>(2*_set135.size);
+ String _elem136;
+ for (int _i137 = 0; _i137 < _set135.size; ++_i137)
+ {
+ _elem136 = iprot.readString();
+ struct.groups.add(_elem136);
+ }
+ }
+ struct.setGroupsIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.roleSet = new TSentryActiveRoleSet();
+ struct.roleSet.read(iprot);
+ struct.setRoleSetIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesByAuthResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesByAuthResponse.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesByAuthResponse.java
new file mode 100644
index 0000000..eb70eb1
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesByAuthResponse.java
@@ -0,0 +1,569 @@
+/**
+ * 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.generic.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 TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TBase<TListSentryPrivilegesByAuthResponse, TListSentryPrivilegesByAuthResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesByAuthResponse> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesByAuthResponse");
+
+ 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 PRIVILEGES_MAP_BY_AUTH_FIELD_DESC = new org.apache.thrift.protocol.TField("privilegesMapByAuth", org.apache.thrift.protocol.TType.MAP, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TListSentryPrivilegesByAuthResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TListSentryPrivilegesByAuthResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
+ private Map<String,TSentryPrivilegeMap> privilegesMapByAuth; // optional
+
+ /** 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"),
+ PRIVILEGES_MAP_BY_AUTH((short)2, "privilegesMapByAuth");
+
+ 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: // PRIVILEGES_MAP_BY_AUTH
+ return PRIVILEGES_MAP_BY_AUTH;
+ 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 _Fields optionals[] = {_Fields.PRIVILEGES_MAP_BY_AUTH};
+ 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.PRIVILEGES_MAP_BY_AUTH, new org.apache.thrift.meta_data.FieldMetaData("privilegesMapByAuth", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilegeMap.class))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesByAuthResponse.class, metaDataMap);
+ }
+
+ public TListSentryPrivilegesByAuthResponse() {
+ }
+
+ public TListSentryPrivilegesByAuthResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TListSentryPrivilegesByAuthResponse(TListSentryPrivilegesByAuthResponse other) {
+ if (other.isSetStatus()) {
+ this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
+ }
+ if (other.isSetPrivilegesMapByAuth()) {
+ Map<String,TSentryPrivilegeMap> __this__privilegesMapByAuth = new HashMap<String,TSentryPrivilegeMap>(other.privilegesMapByAuth.size());
+ for (Map.Entry<String, TSentryPrivilegeMap> other_element : other.privilegesMapByAuth.entrySet()) {
+
+ String other_element_key = other_element.getKey();
+ TSentryPrivilegeMap other_element_value = other_element.getValue();
+
+ String __this__privilegesMapByAuth_copy_key = other_element_key;
+
+ TSentryPrivilegeMap __this__privilegesMapByAuth_copy_value = new TSentryPrivilegeMap(other_element_value);
+
+ __this__privilegesMapByAuth.put(__this__privilegesMapByAuth_copy_key, __this__privilegesMapByAuth_copy_value);
+ }
+ this.privilegesMapByAuth = __this__privilegesMapByAuth;
+ }
+ }
+
+ public TListSentryPrivilegesByAuthResponse deepCopy() {
+ return new TListSentryPrivilegesByAuthResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ this.privilegesMapByAuth = null;
+ }
+
+ 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 int getPrivilegesMapByAuthSize() {
+ return (this.privilegesMapByAuth == null) ? 0 : this.privilegesMapByAuth.size();
+ }
+
+ public void putToPrivilegesMapByAuth(String key, TSentryPrivilegeMap val) {
+ if (this.privilegesMapByAuth == null) {
+ this.privilegesMapByAuth = new HashMap<String,TSentryPrivilegeMap>();
+ }
+ this.privilegesMapByAuth.put(key, val);
+ }
+
+ public Map<String,TSentryPrivilegeMap> getPrivilegesMapByAuth() {
+ return this.privilegesMapByAuth;
+ }
+
+ public void setPrivilegesMapByAuth(Map<String,TSentryPrivilegeMap> privilegesMapByAuth) {
+ this.privilegesMapByAuth = privilegesMapByAuth;
+ }
+
+ public void unsetPrivilegesMapByAuth() {
+ this.privilegesMapByAuth = null;
+ }
+
+ /** Returns true if field privilegesMapByAuth is set (has been assigned a value) and false otherwise */
+ public boolean isSetPrivilegesMapByAuth() {
+ return this.privilegesMapByAuth != null;
+ }
+
+ public void setPrivilegesMapByAuthIsSet(boolean value) {
+ if (!value) {
+ this.privilegesMapByAuth = null;
+ }
+ }
+
+ 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 PRIVILEGES_MAP_BY_AUTH:
+ if (value == null) {
+ unsetPrivilegesMapByAuth();
+ } else {
+ setPrivilegesMapByAuth((Map<String,TSentryPrivilegeMap>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ case PRIVILEGES_MAP_BY_AUTH:
+ return getPrivilegesMapByAuth();
+
+ }
+ 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 PRIVILEGES_MAP_BY_AUTH:
+ return isSetPrivilegesMapByAuth();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TListSentryPrivilegesByAuthResponse)
+ return this.equals((TListSentryPrivilegesByAuthResponse)that);
+ return false;
+ }
+
+ public boolean equals(TListSentryPrivilegesByAuthResponse 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_privilegesMapByAuth = true && this.isSetPrivilegesMapByAuth();
+ boolean that_present_privilegesMapByAuth = true && that.isSetPrivilegesMapByAuth();
+ if (this_present_privilegesMapByAuth || that_present_privilegesMapByAuth) {
+ if (!(this_present_privilegesMapByAuth && that_present_privilegesMapByAuth))
+ return false;
+ if (!this.privilegesMapByAuth.equals(that.privilegesMapByAuth))
+ 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_privilegesMapByAuth = true && (isSetPrivilegesMapByAuth());
+ list.add(present_privilegesMapByAuth);
+ if (present_privilegesMapByAuth)
+ list.add(privilegesMapByAuth);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TListSentryPrivilegesByAuthResponse 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(isSetPrivilegesMapByAuth()).compareTo(other.isSetPrivilegesMapByAuth());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPrivilegesMapByAuth()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilegesMapByAuth, other.privilegesMapByAuth);
+ 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("TListSentryPrivilegesByAuthResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ first = false;
+ if (isSetPrivilegesMapByAuth()) {
+ if (!first) sb.append(", ");
+ sb.append("privilegesMapByAuth:");
+ if (this.privilegesMapByAuth == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.privilegesMapByAuth);
+ }
+ 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());
+ }
+
+ // 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 {
+ 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 TListSentryPrivilegesByAuthResponseStandardSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesByAuthResponseStandardScheme getScheme() {
+ return new TListSentryPrivilegesByAuthResponseStandardScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesByAuthResponseStandardScheme extends StandardScheme<TListSentryPrivilegesByAuthResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesByAuthResponse 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: // PRIVILEGES_MAP_BY_AUTH
+ if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map138 = iprot.readMapBegin();
+ struct.privilegesMapByAuth = new HashMap<String,TSentryPrivilegeMap>(2*_map138.size);
+ String _key139;
+ TSentryPrivilegeMap _val140;
+ for (int _i141 = 0; _i141 < _map138.size; ++_i141)
+ {
+ _key139 = iprot.readString();
+ _val140 = new TSentryPrivilegeMap();
+ _val140.read(iprot);
+ struct.privilegesMapByAuth.put(_key139, _val140);
+ }
+ iprot.readMapEnd();
+ }
+ struct.setPrivilegesMapByAuthIsSet(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, TListSentryPrivilegesByAuthResponse 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();
+ }
+ if (struct.privilegesMapByAuth != null) {
+ if (struct.isSetPrivilegesMapByAuth()) {
+ oprot.writeFieldBegin(PRIVILEGES_MAP_BY_AUTH_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, struct.privilegesMapByAuth.size()));
+ for (Map.Entry<String, TSentryPrivilegeMap> _iter142 : struct.privilegesMapByAuth.entrySet())
+ {
+ oprot.writeString(_iter142.getKey());
+ _iter142.getValue().write(oprot);
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TListSentryPrivilegesByAuthResponseTupleSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesByAuthResponseTupleScheme getScheme() {
+ return new TListSentryPrivilegesByAuthResponseTupleScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesByAuthResponseTupleScheme extends TupleScheme<TListSentryPrivilegesByAuthResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesByAuthResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ struct.status.write(oprot);
+ BitSet optionals = new BitSet();
+ if (struct.isSetPrivilegesMapByAuth()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetPrivilegesMapByAuth()) {
+ {
+ oprot.writeI32(struct.privilegesMapByAuth.size());
+ for (Map.Entry<String, TSentryPrivilegeMap> _iter143 : struct.privilegesMapByAuth.entrySet())
+ {
+ oprot.writeString(_iter143.getKey());
+ _iter143.getValue().write(oprot);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesByAuthResponse 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);
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TMap _map144 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.privilegesMapByAuth = new HashMap<String,TSentryPrivilegeMap>(2*_map144.size);
+ String _key145;
+ TSentryPrivilegeMap _val146;
+ for (int _i147 = 0; _i147 < _map144.size; ++_i147)
+ {
+ _key145 = iprot.readString();
+ _val146 = new TSentryPrivilegeMap();
+ _val146.read(iprot);
+ struct.privilegesMapByAuth.put(_key145, _val146);
+ }
+ }
+ struct.setPrivilegesMapByAuthIsSet(true);
+ }
+ }
+ }
+
+}
+
[30/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryAuthorizable.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryAuthorizable.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryAuthorizable.java
deleted file mode 100644
index a9bc378..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryAuthorizable.java
+++ /dev/null
@@ -1,817 +0,0 @@
-/**
- * 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.provider.db.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 TSentryAuthorizable implements org.apache.thrift.TBase<TSentryAuthorizable, TSentryAuthorizable._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryAuthorizable> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryAuthorizable");
-
- private static final org.apache.thrift.protocol.TField SERVER_FIELD_DESC = new org.apache.thrift.protocol.TField("server", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final org.apache.thrift.protocol.TField URI_FIELD_DESC = new org.apache.thrift.protocol.TField("uri", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField DB_FIELD_DESC = new org.apache.thrift.protocol.TField("db", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField TABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("table", org.apache.thrift.protocol.TType.STRING, (short)4);
- private static final org.apache.thrift.protocol.TField COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("column", org.apache.thrift.protocol.TType.STRING, (short)5);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryAuthorizableStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryAuthorizableTupleSchemeFactory());
- }
-
- private String server; // required
- private String uri; // optional
- private String db; // optional
- private String table; // optional
- private String column; // optional
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- SERVER((short)1, "server"),
- URI((short)2, "uri"),
- DB((short)3, "db"),
- TABLE((short)4, "table"),
- COLUMN((short)5, "column");
-
- 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: // SERVER
- return SERVER;
- case 2: // URI
- return URI;
- case 3: // DB
- return DB;
- case 4: // TABLE
- return TABLE;
- case 5: // COLUMN
- return COLUMN;
- 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 _Fields optionals[] = {_Fields.URI,_Fields.DB,_Fields.TABLE,_Fields.COLUMN};
- 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.SERVER, new org.apache.thrift.meta_data.FieldMetaData("server", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.URI, new org.apache.thrift.meta_data.FieldMetaData("uri", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.DB, new org.apache.thrift.meta_data.FieldMetaData("db", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.TABLE, new org.apache.thrift.meta_data.FieldMetaData("table", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.COLUMN, new org.apache.thrift.meta_data.FieldMetaData("column", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryAuthorizable.class, metaDataMap);
- }
-
- public TSentryAuthorizable() {
- }
-
- public TSentryAuthorizable(
- String server)
- {
- this();
- this.server = server;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryAuthorizable(TSentryAuthorizable other) {
- if (other.isSetServer()) {
- this.server = other.server;
- }
- if (other.isSetUri()) {
- this.uri = other.uri;
- }
- if (other.isSetDb()) {
- this.db = other.db;
- }
- if (other.isSetTable()) {
- this.table = other.table;
- }
- if (other.isSetColumn()) {
- this.column = other.column;
- }
- }
-
- public TSentryAuthorizable deepCopy() {
- return new TSentryAuthorizable(this);
- }
-
- @Override
- public void clear() {
- this.server = null;
- this.uri = null;
- this.db = null;
- this.table = null;
- this.column = null;
- }
-
- public String getServer() {
- return this.server;
- }
-
- public void setServer(String server) {
- this.server = server;
- }
-
- public void unsetServer() {
- this.server = null;
- }
-
- /** Returns true if field server is set (has been assigned a value) and false otherwise */
- public boolean isSetServer() {
- return this.server != null;
- }
-
- public void setServerIsSet(boolean value) {
- if (!value) {
- this.server = null;
- }
- }
-
- public String getUri() {
- return this.uri;
- }
-
- public void setUri(String uri) {
- this.uri = uri;
- }
-
- public void unsetUri() {
- this.uri = null;
- }
-
- /** Returns true if field uri is set (has been assigned a value) and false otherwise */
- public boolean isSetUri() {
- return this.uri != null;
- }
-
- public void setUriIsSet(boolean value) {
- if (!value) {
- this.uri = null;
- }
- }
-
- public String getDb() {
- return this.db;
- }
-
- public void setDb(String db) {
- this.db = db;
- }
-
- public void unsetDb() {
- this.db = null;
- }
-
- /** Returns true if field db is set (has been assigned a value) and false otherwise */
- public boolean isSetDb() {
- return this.db != null;
- }
-
- public void setDbIsSet(boolean value) {
- if (!value) {
- this.db = null;
- }
- }
-
- public String getTable() {
- return this.table;
- }
-
- public void setTable(String table) {
- this.table = table;
- }
-
- public void unsetTable() {
- this.table = null;
- }
-
- /** Returns true if field table is set (has been assigned a value) and false otherwise */
- public boolean isSetTable() {
- return this.table != null;
- }
-
- public void setTableIsSet(boolean value) {
- if (!value) {
- this.table = null;
- }
- }
-
- public String getColumn() {
- return this.column;
- }
-
- public void setColumn(String column) {
- this.column = column;
- }
-
- public void unsetColumn() {
- this.column = null;
- }
-
- /** Returns true if field column is set (has been assigned a value) and false otherwise */
- public boolean isSetColumn() {
- return this.column != null;
- }
-
- public void setColumnIsSet(boolean value) {
- if (!value) {
- this.column = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case SERVER:
- if (value == null) {
- unsetServer();
- } else {
- setServer((String)value);
- }
- break;
-
- case URI:
- if (value == null) {
- unsetUri();
- } else {
- setUri((String)value);
- }
- break;
-
- case DB:
- if (value == null) {
- unsetDb();
- } else {
- setDb((String)value);
- }
- break;
-
- case TABLE:
- if (value == null) {
- unsetTable();
- } else {
- setTable((String)value);
- }
- break;
-
- case COLUMN:
- if (value == null) {
- unsetColumn();
- } else {
- setColumn((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case SERVER:
- return getServer();
-
- case URI:
- return getUri();
-
- case DB:
- return getDb();
-
- case TABLE:
- return getTable();
-
- case COLUMN:
- return getColumn();
-
- }
- 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 SERVER:
- return isSetServer();
- case URI:
- return isSetUri();
- case DB:
- return isSetDb();
- case TABLE:
- return isSetTable();
- case COLUMN:
- return isSetColumn();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryAuthorizable)
- return this.equals((TSentryAuthorizable)that);
- return false;
- }
-
- public boolean equals(TSentryAuthorizable that) {
- if (that == null)
- return false;
-
- boolean this_present_server = true && this.isSetServer();
- boolean that_present_server = true && that.isSetServer();
- if (this_present_server || that_present_server) {
- if (!(this_present_server && that_present_server))
- return false;
- if (!this.server.equals(that.server))
- return false;
- }
-
- boolean this_present_uri = true && this.isSetUri();
- boolean that_present_uri = true && that.isSetUri();
- if (this_present_uri || that_present_uri) {
- if (!(this_present_uri && that_present_uri))
- return false;
- if (!this.uri.equals(that.uri))
- return false;
- }
-
- boolean this_present_db = true && this.isSetDb();
- boolean that_present_db = true && that.isSetDb();
- if (this_present_db || that_present_db) {
- if (!(this_present_db && that_present_db))
- return false;
- if (!this.db.equals(that.db))
- return false;
- }
-
- boolean this_present_table = true && this.isSetTable();
- boolean that_present_table = true && that.isSetTable();
- if (this_present_table || that_present_table) {
- if (!(this_present_table && that_present_table))
- return false;
- if (!this.table.equals(that.table))
- return false;
- }
-
- boolean this_present_column = true && this.isSetColumn();
- boolean that_present_column = true && that.isSetColumn();
- if (this_present_column || that_present_column) {
- if (!(this_present_column && that_present_column))
- return false;
- if (!this.column.equals(that.column))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List<Object> list = new ArrayList<Object>();
-
- boolean present_server = true && (isSetServer());
- list.add(present_server);
- if (present_server)
- list.add(server);
-
- boolean present_uri = true && (isSetUri());
- list.add(present_uri);
- if (present_uri)
- list.add(uri);
-
- boolean present_db = true && (isSetDb());
- list.add(present_db);
- if (present_db)
- list.add(db);
-
- boolean present_table = true && (isSetTable());
- list.add(present_table);
- if (present_table)
- list.add(table);
-
- boolean present_column = true && (isSetColumn());
- list.add(present_column);
- if (present_column)
- list.add(column);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryAuthorizable other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetServer()).compareTo(other.isSetServer());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetServer()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.server, other.server);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetUri()).compareTo(other.isSetUri());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetUri()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uri, other.uri);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetDb()).compareTo(other.isSetDb());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetDb()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.db, other.db);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetTable()).compareTo(other.isSetTable());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetTable()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.table, other.table);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetColumn()).compareTo(other.isSetColumn());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetColumn()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column, other.column);
- 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("TSentryAuthorizable(");
- boolean first = true;
-
- sb.append("server:");
- if (this.server == null) {
- sb.append("null");
- } else {
- sb.append(this.server);
- }
- first = false;
- if (isSetUri()) {
- if (!first) sb.append(", ");
- sb.append("uri:");
- if (this.uri == null) {
- sb.append("null");
- } else {
- sb.append(this.uri);
- }
- first = false;
- }
- if (isSetDb()) {
- if (!first) sb.append(", ");
- sb.append("db:");
- if (this.db == null) {
- sb.append("null");
- } else {
- sb.append(this.db);
- }
- first = false;
- }
- if (isSetTable()) {
- if (!first) sb.append(", ");
- sb.append("table:");
- if (this.table == null) {
- sb.append("null");
- } else {
- sb.append(this.table);
- }
- first = false;
- }
- if (isSetColumn()) {
- if (!first) sb.append(", ");
- sb.append("column:");
- if (this.column == null) {
- sb.append("null");
- } else {
- sb.append(this.column);
- }
- first = false;
- }
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetServer()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'server' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TSentryAuthorizableStandardSchemeFactory implements SchemeFactory {
- public TSentryAuthorizableStandardScheme getScheme() {
- return new TSentryAuthorizableStandardScheme();
- }
- }
-
- private static class TSentryAuthorizableStandardScheme extends StandardScheme<TSentryAuthorizable> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryAuthorizable 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: // SERVER
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.server = iprot.readString();
- struct.setServerIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // URI
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.uri = iprot.readString();
- struct.setUriIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // DB
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.db = iprot.readString();
- struct.setDbIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // TABLE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.table = iprot.readString();
- struct.setTableIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // COLUMN
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.column = iprot.readString();
- struct.setColumnIsSet(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, TSentryAuthorizable struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.server != null) {
- oprot.writeFieldBegin(SERVER_FIELD_DESC);
- oprot.writeString(struct.server);
- oprot.writeFieldEnd();
- }
- if (struct.uri != null) {
- if (struct.isSetUri()) {
- oprot.writeFieldBegin(URI_FIELD_DESC);
- oprot.writeString(struct.uri);
- oprot.writeFieldEnd();
- }
- }
- if (struct.db != null) {
- if (struct.isSetDb()) {
- oprot.writeFieldBegin(DB_FIELD_DESC);
- oprot.writeString(struct.db);
- oprot.writeFieldEnd();
- }
- }
- if (struct.table != null) {
- if (struct.isSetTable()) {
- oprot.writeFieldBegin(TABLE_FIELD_DESC);
- oprot.writeString(struct.table);
- oprot.writeFieldEnd();
- }
- }
- if (struct.column != null) {
- if (struct.isSetColumn()) {
- oprot.writeFieldBegin(COLUMN_FIELD_DESC);
- oprot.writeString(struct.column);
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryAuthorizableTupleSchemeFactory implements SchemeFactory {
- public TSentryAuthorizableTupleScheme getScheme() {
- return new TSentryAuthorizableTupleScheme();
- }
- }
-
- private static class TSentryAuthorizableTupleScheme extends TupleScheme<TSentryAuthorizable> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryAuthorizable struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeString(struct.server);
- BitSet optionals = new BitSet();
- if (struct.isSetUri()) {
- optionals.set(0);
- }
- if (struct.isSetDb()) {
- optionals.set(1);
- }
- if (struct.isSetTable()) {
- optionals.set(2);
- }
- if (struct.isSetColumn()) {
- optionals.set(3);
- }
- oprot.writeBitSet(optionals, 4);
- if (struct.isSetUri()) {
- oprot.writeString(struct.uri);
- }
- if (struct.isSetDb()) {
- oprot.writeString(struct.db);
- }
- if (struct.isSetTable()) {
- oprot.writeString(struct.table);
- }
- if (struct.isSetColumn()) {
- oprot.writeString(struct.column);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryAuthorizable struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.server = iprot.readString();
- struct.setServerIsSet(true);
- BitSet incoming = iprot.readBitSet(4);
- if (incoming.get(0)) {
- struct.uri = iprot.readString();
- struct.setUriIsSet(true);
- }
- if (incoming.get(1)) {
- struct.db = iprot.readString();
- struct.setDbIsSet(true);
- }
- if (incoming.get(2)) {
- struct.table = iprot.readString();
- struct.setTableIsSet(true);
- }
- if (incoming.get(3)) {
- struct.column = iprot.readString();
- struct.setColumnIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryConfigValueRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryConfigValueRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryConfigValueRequest.java
deleted file mode 100644
index 52e3f28..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryConfigValueRequest.java
+++ /dev/null
@@ -1,600 +0,0 @@
-/**
- * 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.provider.db.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 TSentryConfigValueRequest implements org.apache.thrift.TBase<TSentryConfigValueRequest, TSentryConfigValueRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryConfigValueRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryConfigValueRequest");
-
- 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 PROPERTY_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("propertyName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField DEFAULT_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("defaultValue", org.apache.thrift.protocol.TType.STRING, (short)3);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryConfigValueRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryConfigValueRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String propertyName; // required
- private String defaultValue; // optional
-
- /** 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"),
- PROPERTY_NAME((short)2, "propertyName"),
- DEFAULT_VALUE((short)3, "defaultValue");
-
- 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: // PROPERTY_NAME
- return PROPERTY_NAME;
- case 3: // DEFAULT_VALUE
- return DEFAULT_VALUE;
- 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 byte __isset_bitfield = 0;
- private static final _Fields optionals[] = {_Fields.DEFAULT_VALUE};
- 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.PROPERTY_NAME, new org.apache.thrift.meta_data.FieldMetaData("propertyName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.DEFAULT_VALUE, new org.apache.thrift.meta_data.FieldMetaData("defaultValue", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryConfigValueRequest.class, metaDataMap);
- }
-
- public TSentryConfigValueRequest() {
- this.protocol_version = 2;
-
- }
-
- public TSentryConfigValueRequest(
- int protocol_version,
- String propertyName)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.propertyName = propertyName;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryConfigValueRequest(TSentryConfigValueRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetPropertyName()) {
- this.propertyName = other.propertyName;
- }
- if (other.isSetDefaultValue()) {
- this.defaultValue = other.defaultValue;
- }
- }
-
- public TSentryConfigValueRequest deepCopy() {
- return new TSentryConfigValueRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.propertyName = null;
- this.defaultValue = 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 String getPropertyName() {
- return this.propertyName;
- }
-
- public void setPropertyName(String propertyName) {
- this.propertyName = propertyName;
- }
-
- public void unsetPropertyName() {
- this.propertyName = null;
- }
-
- /** Returns true if field propertyName is set (has been assigned a value) and false otherwise */
- public boolean isSetPropertyName() {
- return this.propertyName != null;
- }
-
- public void setPropertyNameIsSet(boolean value) {
- if (!value) {
- this.propertyName = null;
- }
- }
-
- public String getDefaultValue() {
- return this.defaultValue;
- }
-
- public void setDefaultValue(String defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- public void unsetDefaultValue() {
- this.defaultValue = null;
- }
-
- /** Returns true if field defaultValue is set (has been assigned a value) and false otherwise */
- public boolean isSetDefaultValue() {
- return this.defaultValue != null;
- }
-
- public void setDefaultValueIsSet(boolean value) {
- if (!value) {
- this.defaultValue = 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 PROPERTY_NAME:
- if (value == null) {
- unsetPropertyName();
- } else {
- setPropertyName((String)value);
- }
- break;
-
- case DEFAULT_VALUE:
- if (value == null) {
- unsetDefaultValue();
- } else {
- setDefaultValue((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case PROPERTY_NAME:
- return getPropertyName();
-
- case DEFAULT_VALUE:
- return getDefaultValue();
-
- }
- 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 PROPERTY_NAME:
- return isSetPropertyName();
- case DEFAULT_VALUE:
- return isSetDefaultValue();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryConfigValueRequest)
- return this.equals((TSentryConfigValueRequest)that);
- return false;
- }
-
- public boolean equals(TSentryConfigValueRequest 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_propertyName = true && this.isSetPropertyName();
- boolean that_present_propertyName = true && that.isSetPropertyName();
- if (this_present_propertyName || that_present_propertyName) {
- if (!(this_present_propertyName && that_present_propertyName))
- return false;
- if (!this.propertyName.equals(that.propertyName))
- return false;
- }
-
- boolean this_present_defaultValue = true && this.isSetDefaultValue();
- boolean that_present_defaultValue = true && that.isSetDefaultValue();
- if (this_present_defaultValue || that_present_defaultValue) {
- if (!(this_present_defaultValue && that_present_defaultValue))
- return false;
- if (!this.defaultValue.equals(that.defaultValue))
- 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_propertyName = true && (isSetPropertyName());
- list.add(present_propertyName);
- if (present_propertyName)
- list.add(propertyName);
-
- boolean present_defaultValue = true && (isSetDefaultValue());
- list.add(present_defaultValue);
- if (present_defaultValue)
- list.add(defaultValue);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryConfigValueRequest 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(isSetPropertyName()).compareTo(other.isSetPropertyName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPropertyName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.propertyName, other.propertyName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetDefaultValue()).compareTo(other.isSetDefaultValue());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetDefaultValue()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.defaultValue, other.defaultValue);
- 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("TSentryConfigValueRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("propertyName:");
- if (this.propertyName == null) {
- sb.append("null");
- } else {
- sb.append(this.propertyName);
- }
- first = false;
- if (isSetDefaultValue()) {
- if (!first) sb.append(", ");
- sb.append("defaultValue:");
- if (this.defaultValue == null) {
- sb.append("null");
- } else {
- sb.append(this.defaultValue);
- }
- 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 (!isSetPropertyName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'propertyName' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TSentryConfigValueRequestStandardSchemeFactory implements SchemeFactory {
- public TSentryConfigValueRequestStandardScheme getScheme() {
- return new TSentryConfigValueRequestStandardScheme();
- }
- }
-
- private static class TSentryConfigValueRequestStandardScheme extends StandardScheme<TSentryConfigValueRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryConfigValueRequest 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: // PROPERTY_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.propertyName = iprot.readString();
- struct.setPropertyNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // DEFAULT_VALUE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.defaultValue = iprot.readString();
- struct.setDefaultValueIsSet(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, TSentryConfigValueRequest 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();
- if (struct.propertyName != null) {
- oprot.writeFieldBegin(PROPERTY_NAME_FIELD_DESC);
- oprot.writeString(struct.propertyName);
- oprot.writeFieldEnd();
- }
- if (struct.defaultValue != null) {
- if (struct.isSetDefaultValue()) {
- oprot.writeFieldBegin(DEFAULT_VALUE_FIELD_DESC);
- oprot.writeString(struct.defaultValue);
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryConfigValueRequestTupleSchemeFactory implements SchemeFactory {
- public TSentryConfigValueRequestTupleScheme getScheme() {
- return new TSentryConfigValueRequestTupleScheme();
- }
- }
-
- private static class TSentryConfigValueRequestTupleScheme extends TupleScheme<TSentryConfigValueRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryConfigValueRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.propertyName);
- BitSet optionals = new BitSet();
- if (struct.isSetDefaultValue()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetDefaultValue()) {
- oprot.writeString(struct.defaultValue);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryConfigValueRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.propertyName = iprot.readString();
- struct.setPropertyNameIsSet(true);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.defaultValue = iprot.readString();
- struct.setDefaultValueIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryConfigValueResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryConfigValueResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryConfigValueResponse.java
deleted file mode 100644
index 553e706..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryConfigValueResponse.java
+++ /dev/null
@@ -1,504 +0,0 @@
-/**
- * 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.provider.db.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 TSentryConfigValueResponse implements org.apache.thrift.TBase<TSentryConfigValueResponse, TSentryConfigValueResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryConfigValueResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryConfigValueResponse");
-
- 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 VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.STRING, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryConfigValueResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryConfigValueResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
- private String value; // optional
-
- /** 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"),
- VALUE((short)2, "value");
-
- 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: // VALUE
- return VALUE;
- 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 _Fields optionals[] = {_Fields.VALUE};
- 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.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryConfigValueResponse.class, metaDataMap);
- }
-
- public TSentryConfigValueResponse() {
- }
-
- public TSentryConfigValueResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryConfigValueResponse(TSentryConfigValueResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- if (other.isSetValue()) {
- this.value = other.value;
- }
- }
-
- public TSentryConfigValueResponse deepCopy() {
- return new TSentryConfigValueResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- this.value = null;
- }
-
- 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 String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public void unsetValue() {
- this.value = null;
- }
-
- /** Returns true if field value is set (has been assigned a value) and false otherwise */
- public boolean isSetValue() {
- return this.value != null;
- }
-
- public void setValueIsSet(boolean value) {
- if (!value) {
- this.value = null;
- }
- }
-
- 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 VALUE:
- if (value == null) {
- unsetValue();
- } else {
- setValue((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- case VALUE:
- return getValue();
-
- }
- 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 VALUE:
- return isSetValue();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryConfigValueResponse)
- return this.equals((TSentryConfigValueResponse)that);
- return false;
- }
-
- public boolean equals(TSentryConfigValueResponse 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_value = true && this.isSetValue();
- boolean that_present_value = true && that.isSetValue();
- if (this_present_value || that_present_value) {
- if (!(this_present_value && that_present_value))
- return false;
- if (!this.value.equals(that.value))
- 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_value = true && (isSetValue());
- list.add(present_value);
- if (present_value)
- list.add(value);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryConfigValueResponse 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(isSetValue()).compareTo(other.isSetValue());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetValue()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, other.value);
- 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("TSentryConfigValueResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- if (isSetValue()) {
- if (!first) sb.append(", ");
- sb.append("value:");
- if (this.value == null) {
- sb.append("null");
- } else {
- sb.append(this.value);
- }
- 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());
- }
-
- // 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 {
- 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 TSentryConfigValueResponseStandardSchemeFactory implements SchemeFactory {
- public TSentryConfigValueResponseStandardScheme getScheme() {
- return new TSentryConfigValueResponseStandardScheme();
- }
- }
-
- private static class TSentryConfigValueResponseStandardScheme extends StandardScheme<TSentryConfigValueResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryConfigValueResponse 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: // VALUE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.value = iprot.readString();
- struct.setValueIsSet(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, TSentryConfigValueResponse 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();
- }
- if (struct.value != null) {
- if (struct.isSetValue()) {
- oprot.writeFieldBegin(VALUE_FIELD_DESC);
- oprot.writeString(struct.value);
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryConfigValueResponseTupleSchemeFactory implements SchemeFactory {
- public TSentryConfigValueResponseTupleScheme getScheme() {
- return new TSentryConfigValueResponseTupleScheme();
- }
- }
-
- private static class TSentryConfigValueResponseTupleScheme extends TupleScheme<TSentryConfigValueResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryConfigValueResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- BitSet optionals = new BitSet();
- if (struct.isSetValue()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetValue()) {
- oprot.writeString(struct.value);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryConfigValueResponse 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);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.value = iprot.readString();
- struct.setValueIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryExportMappingDataRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryExportMappingDataRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryExportMappingDataRequest.java
deleted file mode 100644
index 95aab53..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryExportMappingDataRequest.java
+++ /dev/null
@@ -1,600 +0,0 @@
-/**
- * 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.provider.db.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 TSentryExportMappingDataRequest implements org.apache.thrift.TBase<TSentryExportMappingDataRequest, TSentryExportMappingDataRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryExportMappingDataRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryExportMappingDataRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField OBJECT_PATH_FIELD_DESC = new org.apache.thrift.protocol.TField("objectPath", org.apache.thrift.protocol.TType.STRING, (short)3);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryExportMappingDataRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryExportMappingDataRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String objectPath; // optional
-
- /** 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- OBJECT_PATH((short)3, "objectPath");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // OBJECT_PATH
- return OBJECT_PATH;
- 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 byte __isset_bitfield = 0;
- private static final _Fields optionals[] = {_Fields.OBJECT_PATH};
- 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.OBJECT_PATH, new org.apache.thrift.meta_data.FieldMetaData("objectPath", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryExportMappingDataRequest.class, metaDataMap);
- }
-
- public TSentryExportMappingDataRequest() {
- this.protocol_version = 1;
-
- }
-
- public TSentryExportMappingDataRequest(
- int protocol_version,
- String requestorUserName)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryExportMappingDataRequest(TSentryExportMappingDataRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetObjectPath()) {
- this.objectPath = other.objectPath;
- }
- }
-
- public TSentryExportMappingDataRequest deepCopy() {
- return new TSentryExportMappingDataRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 1;
-
- this.requestorUserName = null;
- this.objectPath = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getObjectPath() {
- return this.objectPath;
- }
-
- public void setObjectPath(String objectPath) {
- this.objectPath = objectPath;
- }
-
- public void unsetObjectPath() {
- this.objectPath = null;
- }
-
- /** Returns true if field objectPath is set (has been assigned a value) and false otherwise */
- public boolean isSetObjectPath() {
- return this.objectPath != null;
- }
-
- public void setObjectPathIsSet(boolean value) {
- if (!value) {
- this.objectPath = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case OBJECT_PATH:
- if (value == null) {
- unsetObjectPath();
- } else {
- setObjectPath((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case OBJECT_PATH:
- return getObjectPath();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case OBJECT_PATH:
- return isSetObjectPath();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryExportMappingDataRequest)
- return this.equals((TSentryExportMappingDataRequest)that);
- return false;
- }
-
- public boolean equals(TSentryExportMappingDataRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_objectPath = true && this.isSetObjectPath();
- boolean that_present_objectPath = true && that.isSetObjectPath();
- if (this_present_objectPath || that_present_objectPath) {
- if (!(this_present_objectPath && that_present_objectPath))
- return false;
- if (!this.objectPath.equals(that.objectPath))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_objectPath = true && (isSetObjectPath());
- list.add(present_objectPath);
- if (present_objectPath)
- list.add(objectPath);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryExportMappingDataRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetObjectPath()).compareTo(other.isSetObjectPath());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetObjectPath()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.objectPath, other.objectPath);
- 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("TSentryExportMappingDataRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (isSetObjectPath()) {
- if (!first) sb.append(", ");
- sb.append("objectPath:");
- if (this.objectPath == null) {
- sb.append("null");
- } else {
- sb.append(this.objectPath);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TSentryExportMappingDataRequestStandardSchemeFactory implements SchemeFactory {
- public TSentryExportMappingDataRequestStandardScheme getScheme() {
- return new TSentryExportMappingDataRequestStandardScheme();
- }
- }
-
- private static class TSentryExportMappingDataRequestStandardScheme extends StandardScheme<TSentryExportMappingDataRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryExportMappingDataRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // OBJECT_PATH
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.objectPath = iprot.readString();
- struct.setObjectPathIsSet(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, TSentryExportMappingDataRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.objectPath != null) {
- if (struct.isSetObjectPath()) {
- oprot.writeFieldBegin(OBJECT_PATH_FIELD_DESC);
- oprot.writeString(struct.objectPath);
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryExportMappingDataRequestTupleSchemeFactory implements SchemeFactory {
- public TSentryExportMappingDataRequestTupleScheme getScheme() {
- return new TSentryExportMappingDataRequestTupleScheme();
- }
- }
-
- private static class TSentryExportMappingDataRequestTupleScheme extends TupleScheme<TSentryExportMappingDataRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryExportMappingDataRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- BitSet optionals = new BitSet();
- if (struct.isSetObjectPath()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetObjectPath()) {
- oprot.writeString(struct.objectPath);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryExportMappingDataRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.objectPath = iprot.readString();
- struct.setObjectPathIsSet(true);
- }
- }
- }
-
-}
-
[22/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryAdminServlet.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryAdminServlet.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryAdminServlet.java
deleted file mode 100644
index 8a8bbd3..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryAdminServlet.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import com.google.gson.Gson;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.sentry.provider.db.service.persistent.SentryStore;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Admin Servlet is only used when SENTRY_WEB_ADMIN_SERVLET_ENABLED is true.
- */
-public class SentryAdminServlet extends HttpServlet {
- private static final String SHOW_ALL = "/showAll";
- // Here we use the same way as in com.codahale.metrics.servlets.AdminServlet, and just
- // use the TEMPLATE as a static html with some links referenced to other debug pages.
- private static final String TEMPLATE = "<!DOCTYPE HTML>\n"+
- "<html lang=\"en\">\n"+
- "<head>\n"+
- " <meta charset=\"utf-8\">\n"+
- " <title>Sentry Service Admin</title>\n"+
- " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n"+
- " <meta name=\"description\" content=\"\">\n"+
- " <link href=\"css/bootstrap.min.css\" rel=\"stylesheet\">\n"+
- " <link href=\"css/bootstrap-theme.min.css\" rel=\"stylesheet\">\n"+
- " <link href=\"css/sentry.css\" rel=\"stylesheet\">\n"+
- "</head>\n"+
- "<body>\n"+
- "<nav class=\"navbar navbar-default navbar-fixed-top\">\n"+
- " <div class=\"container\">\n"+
- " <div class=\"navbar-header\">\n"+
- " <a class=\"navbar-brand\" href=\"#\"><img src=\"sentry.png\" alt=\"Sentry Logo\"/></a>\n"+
- " </div>\n"+
- " <div class=\"collapse navbar-collapse\">\n"+
- " <ul class=\"nav navbar-nav\">\n"+
- " <li class=\"active\"><a href=\"#\">Admin</a></li>\n"+
- " <li><a href=\"/metrics?pretty=true\">Metrics</a></li>\n"+
- " <li><a href=\"/threads\">Threads</a></li>\n"+
- " <li><a href=\"/conf\">Configuration</a></li>\n"+
- " <li><a href=\"/admin/showAll\">ShowAllRoles</a></li>\n"+
- " </ul>\n"+
- " </div>\n"+
- " </div>\n"+
- "</nav>\n"+
- "<div class=\"container\">\n"+
- " <ul>\n"+
- " <li><a href=\"/metrics?pretty=true\">Metrics</a></li>\n"+
- " <li><a href=\"/threads\">Threads</a></li>\n"+
- " <li><a href=\"/conf\">Configuration</a></li>\n"+
- " <li><a href=\"/admin/showAll\">ShowAllRoles</a></li>\n"+
- " </ul>\n"+
- "</div>\n"+
- "</body>\n"+
- "</html>";
-
- @Override
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- String uri = request.getPathInfo();
- if(uri != null && !uri.equals("/")) {
- if (uri.equals(SHOW_ALL)) {
- showAll(response);
- } else {
- response.sendError(404);
- }
- } else {
- response.setStatus(200);
- response.setHeader("Cache-Control", "must-revalidate,no-cache,no-store");
- response.setHeader("Pragma", "no-cache");
- response.setDateHeader("Expires", 0);
- response.setContentType("text/html");
- PrintWriter writer = response.getWriter();
- try {
- writer.println(TEMPLATE);
- } finally {
- writer.close();
- }
- }
- }
-
- /**
- * Print out all the roles and privileges information as json format.
- */
- private void showAll(HttpServletResponse response)
- throws ServletException, IOException {
- Configuration conf = (Configuration)getServletContext().getAttribute(
- ConfServlet.CONF_CONTEXT_ATTRIBUTE);
- assert conf != null;
-
- Writer out = response.getWriter();
- try {
- SentryStore sentrystore = new SentryStore(conf);
- Map<String, Set<TSentryPrivilege>> roleMap = new HashMap<>();
- Set<String> roleSet = sentrystore.getAllRoleNames();
- for (String roleName: roleSet) {
- roleMap.put(roleName, sentrystore.getAllTSentryPrivilegesByRoleName(roleName));
- }
- String json = new Gson().toJson(roleMap);
- response.setContentType("application/json");
- response.setCharacterEncoding("UTF-8");
- out.write(json);
- } catch (Exception e) {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage());
- }
- out.close();
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryAuthFilter.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryAuthFilter.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryAuthFilter.java
deleted file mode 100644
index b67d6df..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryAuthFilter.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Properties;
-import java.util.Set;
-
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
-import org.apache.hadoop.util.StringUtils;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Sets;
-
-/**
- * SentryAuthFilter is a subclass of AuthenticationFilter,
- * add authorization: Only allowed users could connect the web server.
- */
-public class SentryAuthFilter extends AuthenticationFilter {
-
- private static final Logger LOG = LoggerFactory.getLogger(SentryAuthFilter.class);
-
- public static final String ALLOW_WEB_CONNECT_USERS = ServerConfig.SENTRY_WEB_SECURITY_ALLOW_CONNECT_USERS;
-
- private Set<String> allowUsers;
-
- @Override
- protected void doFilter(FilterChain filterChain, HttpServletRequest request,
- HttpServletResponse response) throws IOException, ServletException {
- String userName = request.getRemoteUser();
- LOG.debug("Authenticating user: " + userName + " from request.");
- if (!allowUsers.contains(userName)) {
- response.sendError(HttpServletResponse.SC_FORBIDDEN,
- "Unauthorized user status code: " + HttpServletResponse.SC_FORBIDDEN);
- throw new ServletException(userName + " is unauthorized. status code: " + HttpServletResponse.SC_FORBIDDEN);
- }
- super.doFilter(filterChain, request, response);
- }
-
- /**
- * Override <code>getConfiguration<code> to get <code>ALLOW_WEB_CONNECT_USERS<code>.
- */
- @Override
- protected Properties getConfiguration(String configPrefix, FilterConfig filterConfig) throws ServletException {
- Properties props = new Properties();
- Enumeration<?> names = filterConfig.getInitParameterNames();
- while (names.hasMoreElements()) {
- String name = (String) names.nextElement();
- if (name.startsWith(configPrefix)) {
- String value = filterConfig.getInitParameter(name);
- if (ALLOW_WEB_CONNECT_USERS.equals(name)) {
- allowUsers = parseConnectUsersFromConf(value);
- } else {
- props.put(name.substring(configPrefix.length()), value);
- }
- }
- }
- return props;
- }
-
- private static Set<String> parseConnectUsersFromConf(String value) {
- //Removed the logic to convert the allowed users to lower case, as user names need to be case sensitive
- return Sets.newHashSet(StringUtils.getStrings(value));
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryHealthCheckServletContextListener.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryHealthCheckServletContextListener.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryHealthCheckServletContextListener.java
deleted file mode 100644
index 8822c2e..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryHealthCheckServletContextListener.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import com.codahale.metrics.health.HealthCheckRegistry;
-import com.codahale.metrics.servlets.HealthCheckServlet;
-
-/**
- * Use this class's registry to register health checks: Can be some tests which make sure Sentry service is healthy
- */
-public class SentryHealthCheckServletContextListener extends HealthCheckServlet.ContextListener {
-
- //This is just a place holder for health check registry, with out this AdminServlet throws out an error
- public static final HealthCheckRegistry HEALTH_CHECK_REGISTRY = new HealthCheckRegistry();
-
- @Override
- protected HealthCheckRegistry getHealthCheckRegistry() {
- return HEALTH_CHECK_REGISTRY;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetrics.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetrics.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetrics.java
deleted file mode 100644
index 1056fa7..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetrics.java
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import com.codahale.metrics.ConsoleReporter;
-import com.codahale.metrics.Counter;
-import com.codahale.metrics.Gauge;
-import com.codahale.metrics.Histogram;
-import com.codahale.metrics.JmxReporter;
-import com.codahale.metrics.Metric;
-import com.codahale.metrics.MetricRegistry;
-import com.codahale.metrics.MetricSet;
-import com.codahale.metrics.Slf4jReporter;
-import com.codahale.metrics.Timer;
-import com.codahale.metrics.json.MetricsModule;
-import com.codahale.metrics.jvm.BufferPoolMetricSet;
-import com.codahale.metrics.jvm.GarbageCollectorMetricSet;
-import com.codahale.metrics.jvm.MemoryUsageGaugeSet;
-import com.codahale.metrics.jvm.ThreadStatesGaugeSet;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.sentry.provider.db.service.persistent.SentryStore;
-import org.apache.sentry.service.thrift.SentryService;
-import org.apache.sentry.service.thrift.SentryServiceUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedWriter;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.nio.file.attribute.FileAttribute;
-import java.nio.file.attribute.PosixFilePermission;
-import java.nio.file.attribute.PosixFilePermissions;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import static com.codahale.metrics.MetricRegistry.name;
-import static org.apache.sentry.provider.db.service.thrift.SentryMetricsServletContextListener.METRIC_REGISTRY;
-import static org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
-
-/**
- * A singleton class which holds metrics related utility functions as well as the list of metrics.
- */
-public final class SentryMetrics {
- public enum Reporting {
- JMX,
- CONSOLE,
- LOG,
- JSON,
- }
-
- private static final Logger LOGGER = LoggerFactory
- .getLogger(SentryMetrics.class);
-
- private static SentryMetrics sentryMetrics = null;
- private final AtomicBoolean reportingInitialized = new AtomicBoolean();
- private boolean gaugesAdded = false;
- private boolean sentryServiceGaugesAdded = false;
-
- final Timer createRoleTimer = METRIC_REGISTRY.timer(
- name(SentryPolicyStoreProcessor.class, "create-role"));
- final Timer dropRoleTimer = METRIC_REGISTRY.timer(
- name(SentryPolicyStoreProcessor.class, "drop-role"));
- final Timer grantRoleTimer = METRIC_REGISTRY.timer(
- name(SentryPolicyStoreProcessor.class, "grant-role"));
- final Timer revokeRoleTimer = METRIC_REGISTRY.timer(
- name(SentryPolicyStoreProcessor.class, "revoke-role"));
- final Timer grantTimer = METRIC_REGISTRY.timer(
- name(SentryPolicyStoreProcessor.class, "grant-privilege"));
- final Timer revokeTimer = METRIC_REGISTRY.timer(
- name(SentryPolicyStoreProcessor.class, "revoke-privilege"));
-
- final Timer dropPrivilegeTimer = METRIC_REGISTRY.timer(
- name(SentryPolicyStoreProcessor.class, "drop-privilege"));
- final Timer renamePrivilegeTimer = METRIC_REGISTRY.timer(
- name(SentryPolicyStoreProcessor.class, "rename-privilege"));
-
- final Timer listRolesByGroupTimer = METRIC_REGISTRY.timer(
- name(SentryPolicyStoreProcessor.class, "list-roles-by-group"));
- final Timer listPrivilegesByRoleTimer = METRIC_REGISTRY.timer(
- name(SentryPolicyStoreProcessor.class, "list-privileges-by-role"));
- final Timer listPrivilegesForProviderTimer = METRIC_REGISTRY.timer(
- name(SentryPolicyStoreProcessor.class, "list-privileges-for-provider"));
- final Timer listPrivilegesByAuthorizableTimer = METRIC_REGISTRY.timer(
- name(SentryPolicyStoreProcessor.class, "list-privileges-by-authorizable"));
-
- /**
- * Return a Timer with name.
- */
- public Timer getTimer(String name) {
- return METRIC_REGISTRY.timer(name);
- }
-
- /**
- * Return a Histogram with name.
- */
- public Histogram getHistogram(String name) {
- return METRIC_REGISTRY.histogram(name);
- }
-
- /**
- * Return a Counter with name.
- */
- public Counter getCounter(String name) {
- return METRIC_REGISTRY.counter(name);
- }
-
- private SentryMetrics() {
- registerMetricSet("gc", new GarbageCollectorMetricSet(), METRIC_REGISTRY);
- registerMetricSet("buffers",
- new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()),
- METRIC_REGISTRY);
- registerMetricSet("memory", new MemoryUsageGaugeSet(), METRIC_REGISTRY);
- registerMetricSet("threads", new ThreadStatesGaugeSet(), METRIC_REGISTRY);
- }
-
- /**
- * Get singleton instance.
- */
- public static synchronized SentryMetrics getInstance() {
- if (sentryMetrics == null) {
- sentryMetrics = new SentryMetrics();
- }
- return sentryMetrics;
- }
-
- void addSentryStoreGauges(SentryStore sentryStore) {
- if (!gaugesAdded) {
- addGauge(SentryStore.class, "role_count", sentryStore.getRoleCountGauge());
- addGauge(SentryStore.class, "privilege_count",
- sentryStore.getPrivilegeCountGauge());
- addGauge(SentryStore.class, "group_count", sentryStore.getGroupCountGauge());
- addGauge(SentryStore.class, "hms.waiters", sentryStore.getHMSWaitersCountGauge());
- addGauge(SentryStore.class, "hms.notification.id",
- sentryStore.getLastNotificationIdGauge());
- addGauge(SentryStore.class, "hms.snapshot.paths.id",
- sentryStore.getLastPathsSnapshotIdGauge());
- addGauge(SentryStore.class, "hms.perm.change.id",
- sentryStore.getPermChangeIdGauge());
- addGauge(SentryStore.class, "hms.psth.change.id",
- sentryStore.getPathChangeIdGauge());
- gaugesAdded = true;
- }
- }
-
- /**
- * Add gauges for the SentryService class.
- * @param sentryservice
- */
- public void addSentryServiceGauges(SentryService sentryservice) {
- if (!sentryServiceGaugesAdded) {
- addGauge(SentryService.class, "is_active", sentryservice.getIsActiveGauge());
- addGauge(SentryService.class, "activated", sentryservice.getBecomeActiveCount());
- sentryServiceGaugesAdded = true;
- }
- }
-
- /**
- * Initialize reporters. Only initializes once.<p>
- *
- * Available reporters:
- * <ul>
- * <li>console</li>
- * <li>log</li>
- * <li>jmx</li>
- * </ul>
- *
- * <p><For console reporter configre it to report every
- * <em>SENTRY_REPORTER_INTERVAL_SEC</em> seconds.
- *
- * <p>Method is thread safe.
- */
- @SuppressWarnings("squid:S2095")
- void initReporting(Configuration conf) {
- final String reporter = conf.get(ServerConfig.SENTRY_REPORTER);
- if ((reporter == null) || reporter.isEmpty() || reportingInitialized.getAndSet(true)) {
- // Nothing to do, just return
- return;
- }
-
- final int reportInterval =
- conf.getInt(ServerConfig.SENTRY_REPORTER_INTERVAL_SEC,
- ServerConfig.SENTRY_REPORTER_INTERVAL_DEFAULT);
-
- // Get list of configured reporters
- Set<String> reporters = new HashSet<>();
- for (String r: reporter.split(",")) {
- reporters.add(r.trim().toUpperCase());
- }
-
- // In case there are no reporters, configure JSON reporter
- if (reporters.isEmpty()) {
- reporters.add(Reporting.JSON.toString());
- }
-
- // Configure all reporters
- for (String r: reporters) {
- switch (SentryMetrics.Reporting.valueOf(r)) {
- case CONSOLE:
- LOGGER.info("Enabled console metrics reporter with {} seconds interval",
- reportInterval);
- final ConsoleReporter consoleReporter =
- ConsoleReporter.forRegistry(METRIC_REGISTRY)
- .convertRatesTo(TimeUnit.SECONDS)
- .convertDurationsTo(TimeUnit.MILLISECONDS)
- .build();
- consoleReporter.start(reportInterval, TimeUnit.SECONDS);
- break;
- case JMX:
- LOGGER.info("Enabled JMX metrics reporter");
- final JmxReporter jmxReporter = JmxReporter.forRegistry(METRIC_REGISTRY)
- .convertRatesTo(TimeUnit.SECONDS)
- .convertDurationsTo(TimeUnit.MILLISECONDS)
- .build();
- jmxReporter.start();
- break;
- case LOG:
- LOGGER.info("Enabled Log4J metrics reporter with {} seconds interval",
- reportInterval);
- final Slf4jReporter logReporter = Slf4jReporter.forRegistry(METRIC_REGISTRY)
- .outputTo(LOGGER)
- .convertRatesTo(TimeUnit.SECONDS)
- .convertDurationsTo(TimeUnit.MILLISECONDS)
- .build();
- logReporter.start(reportInterval, TimeUnit.SECONDS);
- break;
- case JSON:
- LOGGER.info("Enabled JSON metrics reporter with {} seconds interval", reportInterval);
- JsonFileReporter jsonReporter = new JsonFileReporter(conf,
- reportInterval, TimeUnit.SECONDS);
- jsonReporter.start();
- break;
- default:
- LOGGER.warn("Invalid metrics reporter {}", reporter);
- break;
- }
- }
- }
-
- private <T, V> void addGauge(Class<T> tClass, String gaugeName, Gauge<V> gauge) {
- METRIC_REGISTRY.register(
- name(tClass, gaugeName), gauge);
- }
-
- private void registerMetricSet(String prefix, MetricSet metricSet, MetricRegistry registry) {
- for (Map.Entry<String, Metric> entry : metricSet.getMetrics().entrySet()) {
- if (entry.getValue() instanceof MetricSet) {
- registerMetricSet(prefix + "." + entry.getKey(), (MetricSet) entry.getValue(), registry);
- } else {
- registry.register(prefix + "." + entry.getKey(), entry.getValue());
- }
- }
- }
-
- /**
- * Custom reporter that writes metrics as a JSON file.
- * This class originated from Apache Hive JSON reporter.
- */
- private static class JsonFileReporter implements AutoCloseable, Runnable {
- //
- // Implementation notes.
- //
- // 1. Since only local file systems are supported, there is no need to use Hadoop
- // version of Path class.
- // 2. java.nio package provides modern implementation of file and directory operations
- // which is better then the traditional java.io, so we are using it here.
- // In particular, it supports atomic creation of temporary files with specified
- // permissions in the specified directory. This also avoids various attacks possible
- // when temp file name is generated first, followed by file creation.
- // See http://www.oracle.com/technetwork/articles/javase/nio-139333.html for
- // the description of NIO API and
- // http://docs.oracle.com/javase/tutorial/essential/io/legacy.html for the
- // description of interoperability between legacy IO api vs NIO API.
- // 3. To avoid race conditions with readers of the metrics file, the implementation
- // dumps metrics to a temporary file in the same directory as the actual metrics
- // file and then renames it to the destination. Since both are located on the same
- // filesystem, this rename is likely to be atomic (as long as the underlying OS
- // support atomic renames.
- //
-
- // Permissions for the metrics file
- private static final FileAttribute<Set<PosixFilePermission>> FILE_ATTRS =
- PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rw-r--r--"));
- private static final String JSON_REPORTER_THREAD_NAME = "json-reporter";
-
- private ScheduledExecutorService executor = null;
- private final ObjectMapper jsonMapper =
- new ObjectMapper().registerModule(new MetricsModule(TimeUnit.SECONDS,
- TimeUnit.MILLISECONDS,
- false));
- private final Configuration conf;
- /** Destination file name. */
- // Location of JSON file
- private final Path path;
- // tmpdir is the dirname(path)
- private final Path tmpDir;
- private final long interval;
- private final TimeUnit unit;
-
- JsonFileReporter(Configuration conf, long interval, TimeUnit unit) {
- this.conf = conf;
- String pathString = conf.get(ServerConfig.SENTRY_JSON_REPORTER_FILE,
- ServerConfig.SENTRY_JSON_REPORTER_FILE_DEFAULT);
- path = Paths.get(pathString).toAbsolutePath();
- LOGGER.info("Reporting metrics to {}", path);
- // We want to use tmpDir i the same directory as the destination file to support atomic
- // move of temp file to the destination metrics file
- tmpDir = path.getParent();
- this.interval = interval;
- this.unit = unit;
- }
-
- private void start() {
- executor = Executors.newScheduledThreadPool(1,
- new ThreadFactoryBuilder().setNameFormat(JSON_REPORTER_THREAD_NAME).build());
- executor.scheduleAtFixedRate(this, 0, interval, unit);
- }
-
- @Override
- public void run() {
- Path tmpFile = null;
- try {
- String json = null;
- try {
- json = jsonMapper.writerWithDefaultPrettyPrinter().writeValueAsString(METRIC_REGISTRY);
- } catch (JsonProcessingException e) {
- LOGGER.error("Error converting metrics to JSON", e);
- return;
- }
- // Metrics are first dumped to a temp file which is then renamed to the destination
- try {
- tmpFile = Files.createTempFile(tmpDir, "smetrics", "json", FILE_ATTRS);
- } catch (IOException e) {
- LOGGER.error("failed to create temp file for JSON metrics", e);
- return;
- } catch (SecurityException e) {
- // This shouldn't ever happen
- LOGGER.error("failed to create temp file for JSON metrics: no permissions", e);
- return;
- } catch (UnsupportedOperationException e) {
- // This shouldn't ever happen
- LOGGER.error("failed to create temp file for JSON metrics: operartion not supported", e);
- return;
- }
-
- try (BufferedWriter bw = new BufferedWriter(new FileWriter(tmpFile.toFile()))) {
- bw.write(json);
- }
-
- // Move temp file to the destination file
- try {
- Files.move(tmpFile, path, StandardCopyOption.ATOMIC_MOVE);
- } catch (Exception e) {
- LOGGER.error("Failed to move temp metrics file to {}: {}", path, e.getMessage());
- }
- } catch (Throwable t) {
- // catch all errors (throwable and execptions to prevent subsequent tasks from being suppressed)
- LOGGER.error("Error executing scheduled task ", t);
- } finally {
- // If something happened and we were not able to rename the temp file, attempt to remove it
- if (tmpFile != null && tmpFile.toFile().exists()) {
- // Attempt to delete temp file, if this fails, not much can be done about it.
- try {
- Files.delete(tmpFile);
- } catch (Exception e) {
- LOGGER.error("failed to delete yemporary metrics file {}", tmpFile, e);
- }
- }
- }
- }
-
- @Override
- public void close() {
- if (executor != null) {
- SentryServiceUtil.shutdownAndAwaitTermination(executor,
- JSON_REPORTER_THREAD_NAME, 1, TimeUnit.MINUTES, LOGGER);
- executor = null;
- }
- try {
- Files.delete(path);
- } catch (IOException e) {
- LOGGER.error("Unable to delete {}", path, e);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetricsServletContextListener.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetricsServletContextListener.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetricsServletContextListener.java
deleted file mode 100644
index 6692197..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetricsServletContextListener.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import com.codahale.metrics.MetricRegistry;
-import com.codahale.metrics.servlets.MetricsServlet;
-
-public class SentryMetricsServletContextListener extends MetricsServlet.ContextListener {
-
- public static final MetricRegistry METRIC_REGISTRY = new MetricRegistry();
-
- @Override
- protected MetricRegistry getMetricRegistry() {
- return METRIC_REGISTRY;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java
deleted file mode 100644
index f69a8cd..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.sentry.core.common.exception.SentryUserException;
-import org.apache.sentry.core.common.ActiveRoleSet;
-import org.apache.sentry.core.common.Authorizable;
-
-public interface SentryPolicyServiceClient extends AutoCloseable {
-
- void createRole(String requestorUserName, String roleName) throws SentryUserException;
-
- void dropRole(String requestorUserName, String roleName) throws SentryUserException;
-
- void dropRoleIfExists(String requestorUserName, String roleName)
- throws SentryUserException;
-
- Set<TSentryRole> listRolesByUserName(String requestorUserName, String userName)
- throws SentryUserException;
-
- Set<TSentryRole> listRolesByGroupName(String requestorUserName, String groupName)
- throws SentryUserException;
-
- Set<TSentryPrivilege> listAllPrivilegesByRoleName(String requestorUserName, String roleName)
- throws SentryUserException;
-
- /**
- * Gets sentry privilege objects for a given roleName using the Sentry service
- *
- * @param requestorUserName : user on whose behalf the request is issued
- * @param roleName : roleName to look up
- * @param authorizable : authorizable Hierarchy (server->db->table etc)
- * @return Set of thrift sentry privilege objects
- * @throws SentryUserException
- */
- Set<TSentryPrivilege> listPrivilegesByRoleName(String requestorUserName, String roleName,
- List<? extends Authorizable> authorizable) throws SentryUserException;
-
- Set<TSentryRole> listAllRoles(String requestorUserName) throws SentryUserException;
-
- Set<TSentryRole> listUserRoles(String requestorUserName) throws SentryUserException;
-
- TSentryPrivilege grantURIPrivilege(String requestorUserName, String roleName,
- String server, String uri) throws SentryUserException;
-
- TSentryPrivilege grantURIPrivilege(String requestorUserName, String roleName,
- String server, String uri, Boolean grantOption) throws SentryUserException;
-
- void grantServerPrivilege(String requestorUserName, String roleName, String server,
- String action) throws SentryUserException;
-
- TSentryPrivilege grantServerPrivilege(String requestorUserName, String roleName,
- String server, Boolean grantOption) throws SentryUserException;
-
- TSentryPrivilege grantServerPrivilege(String requestorUserName, String roleName,
- String server, String action, Boolean grantOption) throws SentryUserException;
-
- TSentryPrivilege grantDatabasePrivilege(String requestorUserName, String roleName,
- String server, String db, String action) throws SentryUserException;
-
- TSentryPrivilege grantDatabasePrivilege(String requestorUserName, String roleName,
- String server, String db, String action, Boolean grantOption) throws SentryUserException;
-
- TSentryPrivilege grantTablePrivilege(String requestorUserName, String roleName,
- String server, String db, String table, String action) throws SentryUserException;
-
- TSentryPrivilege grantTablePrivilege(String requestorUserName, String roleName,
- String server, String db, String table, String action, Boolean grantOption)
- throws SentryUserException;
-
- TSentryPrivilege grantColumnPrivilege(String requestorUserName, String roleName,
- String server, String db, String table, String columnName, String action)
- throws SentryUserException;
-
- TSentryPrivilege grantColumnPrivilege(String requestorUserName, String roleName,
- String server, String db, String table, String columnName, String action, Boolean grantOption)
- throws SentryUserException;
-
- Set<TSentryPrivilege> grantColumnsPrivileges(String requestorUserName, String roleName,
- String server, String db, String table, List<String> columnNames, String action)
- throws SentryUserException;
-
- Set<TSentryPrivilege> grantColumnsPrivileges(String requestorUserName, String roleName,
- String server, String db, String table, List<String> columnNames, String action,
- Boolean grantOption) throws SentryUserException;
-
- Set<TSentryPrivilege> grantPrivileges(String requestorUserName, String
- roleName, Set<TSentryPrivilege> privileges) throws SentryUserException;
-
- TSentryPrivilege grantPrivilege(String requestorUserName, String roleName,
- TSentryPrivilege privilege) throws
- SentryUserException;
-
- void revokeURIPrivilege(String requestorUserName, String roleName, String server,
- String uri) throws SentryUserException;
-
- void revokeURIPrivilege(String requestorUserName, String roleName, String server,
- String uri, Boolean grantOption) throws SentryUserException;
-
- void revokeServerPrivilege(String requestorUserName, String roleName, String server,
- String action) throws SentryUserException;
-
- void revokeServerPrivilege(String requestorUserName, String roleName, String server,
- String action, Boolean grantOption) throws SentryUserException;
-
- void revokeServerPrivilege(String requestorUserName, String roleName, String server,
- boolean grantOption) throws SentryUserException;
-
- void revokeDatabasePrivilege(String requestorUserName, String roleName, String server,
- String db, String action) throws SentryUserException;
-
- void revokeDatabasePrivilege(String requestorUserName, String roleName, String server,
- String db, String action, Boolean grantOption) throws SentryUserException;
-
- void revokeTablePrivilege(String requestorUserName, String roleName, String server,
- String db, String table, String action) throws SentryUserException;
-
- void revokeTablePrivilege(String requestorUserName, String roleName, String server,
- String db, String table, String action, Boolean grantOption) throws SentryUserException;
-
- void revokeColumnPrivilege(String requestorUserName, String roleName, String server,
- String db, String table, String columnName, String action) throws SentryUserException;
-
- void revokeColumnPrivilege(String requestorUserName, String roleName, String server,
- String db, String table, String columnName, String action, Boolean grantOption)
- throws SentryUserException;
-
- void revokeColumnsPrivilege(String requestorUserName, String roleName, String server,
- String db, String table, List<String> columns, String action) throws SentryUserException;
-
- void revokeColumnsPrivilege(String requestorUserName, String roleName, String server,
- String db, String table, List<String> columns, String action, Boolean grantOption)
- throws SentryUserException;
-
- void revokePrivileges(String requestorUserName, String roleName, Set<TSentryPrivilege> privileges)
- throws SentryUserException;
-
- void revokePrivilege(String requestorUserName, String roleName, TSentryPrivilege privilege)
- throws SentryUserException;
-
- Set<String> listPrivilegesForProvider(Set<String> groups, Set<String> users,
- ActiveRoleSet roleSet, Authorizable... authorizable) throws SentryUserException;
-
- void grantRoleToGroup(String requestorUserName, String groupName, String roleName)
- throws SentryUserException;
-
- void revokeRoleFromGroup(String requestorUserName, String groupName, String roleName)
- throws SentryUserException;
-
- void grantRoleToGroups(String requestorUserName, String roleName, Set<String> groups)
- throws SentryUserException;
-
- void revokeRoleFromGroups(String requestorUserName, String roleName, Set<String> groups)
- throws SentryUserException;
-
- void grantRoleToUser(String requestorUserName, String userName, String roleName)
- throws SentryUserException;
-
- void revokeRoleFromUser(String requestorUserName, String userName, String roleName)
- throws SentryUserException;
-
- void grantRoleToUsers(String requestorUserName, String roleName, Set<String> users)
- throws SentryUserException;
-
- void revokeRoleFromUsers(String requestorUserName, String roleName, Set<String> users)
- throws SentryUserException;
-
- void dropPrivileges(String requestorUserName,
- List<? extends Authorizable> authorizableObjects) throws SentryUserException;
-
- void renamePrivileges(String requestorUserName,
- List<? extends Authorizable> oldAuthorizables, List<? extends Authorizable> newAuthorizables)
- throws SentryUserException;
-
- Map<TSentryAuthorizable, TSentryPrivilegeMap> listPrivilegsbyAuthorizable(
- String requestorUserName, Set<List<? extends Authorizable>> authorizables,
- Set<String> groups, ActiveRoleSet roleSet) throws SentryUserException;
-
- /**
- * Returns the configuration value in the sentry server associated with propertyName, or if
- * propertyName does not exist, the defaultValue. There is no "requestorUserName" because this is
- * regarded as an internal interface.
- *
- * @param propertyName Config attribute to search for
- * @param defaultValue String to return if not found
- * @return The value of the propertyName
- * @throws SentryUserException
- */
- String getConfigValue(String propertyName, String defaultValue) throws SentryUserException;
-
- // Import the sentry mapping data with map structure
- void importPolicy(Map<String, Map<String, Set<String>>> policyFileMappingData,
- String requestorUserName, boolean isOverwriteRole) throws SentryUserException;
-
- // export the sentry mapping data with map structure
- Map<String, Map<String, Set<String>>> exportPolicy(String requestorUserName, String objectPath)
- throws SentryUserException;
-
- /**
- * Requests the sentry server to synchronize all HMS notification events up to the specified id.
- * The sentry server will return once it have processed the id specified..
- *
- * @param id Requested HMS notification ID.
- * @return The most recent processed notification ID.
- */
- long syncNotifications(long id) throws SentryUserException;
-}
[07/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAuthorizable.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAuthorizable.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAuthorizable.java
new file mode 100644
index 0000000..b61eee6
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAuthorizable.java
@@ -0,0 +1,490 @@
+/**
+ * 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.generic.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 TAuthorizable implements org.apache.thrift.TBase<TAuthorizable, TAuthorizable._Fields>, java.io.Serializable, Cloneable, Comparable<TAuthorizable> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAuthorizable");
+
+ private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAuthorizableStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAuthorizableTupleSchemeFactory());
+ }
+
+ private String type; // required
+ private String name; // 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 {
+ TYPE((short)1, "type"),
+ NAME((short)2, "name");
+
+ 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: // TYPE
+ return TYPE;
+ case 2: // NAME
+ return NAME;
+ 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.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAuthorizable.class, metaDataMap);
+ }
+
+ public TAuthorizable() {
+ }
+
+ public TAuthorizable(
+ String type,
+ String name)
+ {
+ this();
+ this.type = type;
+ this.name = name;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAuthorizable(TAuthorizable other) {
+ if (other.isSetType()) {
+ this.type = other.type;
+ }
+ if (other.isSetName()) {
+ this.name = other.name;
+ }
+ }
+
+ public TAuthorizable deepCopy() {
+ return new TAuthorizable(this);
+ }
+
+ @Override
+ public void clear() {
+ this.type = null;
+ this.name = null;
+ }
+
+ public String getType() {
+ return this.type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public void unsetType() {
+ this.type = null;
+ }
+
+ /** Returns true if field type is set (has been assigned a value) and false otherwise */
+ public boolean isSetType() {
+ return this.type != null;
+ }
+
+ public void setTypeIsSet(boolean value) {
+ if (!value) {
+ this.type = null;
+ }
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void unsetName() {
+ this.name = null;
+ }
+
+ /** Returns true if field name is set (has been assigned a value) and false otherwise */
+ public boolean isSetName() {
+ return this.name != null;
+ }
+
+ public void setNameIsSet(boolean value) {
+ if (!value) {
+ this.name = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case TYPE:
+ if (value == null) {
+ unsetType();
+ } else {
+ setType((String)value);
+ }
+ break;
+
+ case NAME:
+ if (value == null) {
+ unsetName();
+ } else {
+ setName((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case TYPE:
+ return getType();
+
+ case NAME:
+ return getName();
+
+ }
+ 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 TYPE:
+ return isSetType();
+ case NAME:
+ return isSetName();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAuthorizable)
+ return this.equals((TAuthorizable)that);
+ return false;
+ }
+
+ public boolean equals(TAuthorizable that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_type = true && this.isSetType();
+ boolean that_present_type = true && that.isSetType();
+ if (this_present_type || that_present_type) {
+ if (!(this_present_type && that_present_type))
+ return false;
+ if (!this.type.equals(that.type))
+ return false;
+ }
+
+ boolean this_present_name = true && this.isSetName();
+ boolean that_present_name = true && that.isSetName();
+ if (this_present_name || that_present_name) {
+ if (!(this_present_name && that_present_name))
+ return false;
+ if (!this.name.equals(that.name))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ List<Object> list = new ArrayList<Object>();
+
+ boolean present_type = true && (isSetType());
+ list.add(present_type);
+ if (present_type)
+ list.add(type);
+
+ boolean present_name = true && (isSetName());
+ list.add(present_name);
+ if (present_name)
+ list.add(name);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TAuthorizable other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetType()).compareTo(other.isSetType());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetType()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
+ 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("TAuthorizable(");
+ boolean first = true;
+
+ sb.append("type:");
+ if (this.type == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.type);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("name:");
+ if (this.name == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.name);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetType()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'type' is unset! Struct:" + toString());
+ }
+
+ if (!isSetName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'name' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TAuthorizableStandardSchemeFactory implements SchemeFactory {
+ public TAuthorizableStandardScheme getScheme() {
+ return new TAuthorizableStandardScheme();
+ }
+ }
+
+ private static class TAuthorizableStandardScheme extends StandardScheme<TAuthorizable> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAuthorizable 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: // TYPE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.type = iprot.readString();
+ struct.setTypeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.name = iprot.readString();
+ struct.setNameIsSet(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, TAuthorizable struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.type != null) {
+ oprot.writeFieldBegin(TYPE_FIELD_DESC);
+ oprot.writeString(struct.type);
+ oprot.writeFieldEnd();
+ }
+ if (struct.name != null) {
+ oprot.writeFieldBegin(NAME_FIELD_DESC);
+ oprot.writeString(struct.name);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAuthorizableTupleSchemeFactory implements SchemeFactory {
+ public TAuthorizableTupleScheme getScheme() {
+ return new TAuthorizableTupleScheme();
+ }
+ }
+
+ private static class TAuthorizableTupleScheme extends TupleScheme<TAuthorizable> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TAuthorizable struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeString(struct.type);
+ oprot.writeString(struct.name);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAuthorizable struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.type = iprot.readString();
+ struct.setTypeIsSet(true);
+ struct.name = iprot.readString();
+ struct.setNameIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TCreateSentryRoleRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TCreateSentryRoleRequest.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TCreateSentryRoleRequest.java
new file mode 100644
index 0000000..bb7cff4
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TCreateSentryRoleRequest.java
@@ -0,0 +1,692 @@
+/**
+ * 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.generic.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 TCreateSentryRoleRequest implements org.apache.thrift.TBase<TCreateSentryRoleRequest, TCreateSentryRoleRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TCreateSentryRoleRequest> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCreateSentryRoleRequest");
+
+ 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TCreateSentryRoleRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TCreateSentryRoleRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String roleName; // required
+ private String component; // 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"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ ROLE_NAME((short)3, "roleName"),
+ COMPONENT((short)4, "component");
+
+ 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: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // ROLE_NAME
+ return ROLE_NAME;
+ case 4: // COMPONENT
+ return COMPONENT;
+ 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TCreateSentryRoleRequest.class, metaDataMap);
+ }
+
+ public TCreateSentryRoleRequest() {
+ this.protocol_version = 2;
+
+ }
+
+ public TCreateSentryRoleRequest(
+ int protocol_version,
+ String requestorUserName,
+ String roleName,
+ String component)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.roleName = roleName;
+ this.component = component;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TCreateSentryRoleRequest(TCreateSentryRoleRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetRoleName()) {
+ this.roleName = other.roleName;
+ }
+ if (other.isSetComponent()) {
+ this.component = other.component;
+ }
+ }
+
+ public TCreateSentryRoleRequest deepCopy() {
+ return new TCreateSentryRoleRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 2;
+
+ this.requestorUserName = null;
+ this.roleName = null;
+ this.component = 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 String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public String getRoleName() {
+ return this.roleName;
+ }
+
+ public void setRoleName(String roleName) {
+ this.roleName = roleName;
+ }
+
+ public void unsetRoleName() {
+ this.roleName = null;
+ }
+
+ /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRoleName() {
+ return this.roleName != null;
+ }
+
+ public void setRoleNameIsSet(boolean value) {
+ if (!value) {
+ this.roleName = null;
+ }
+ }
+
+ public String getComponent() {
+ return this.component;
+ }
+
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ public void unsetComponent() {
+ this.component = null;
+ }
+
+ /** Returns true if field component is set (has been assigned a value) and false otherwise */
+ public boolean isSetComponent() {
+ return this.component != null;
+ }
+
+ public void setComponentIsSet(boolean value) {
+ if (!value) {
+ this.component = 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 REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case ROLE_NAME:
+ if (value == null) {
+ unsetRoleName();
+ } else {
+ setRoleName((String)value);
+ }
+ break;
+
+ case COMPONENT:
+ if (value == null) {
+ unsetComponent();
+ } else {
+ setComponent((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return getProtocol_version();
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case ROLE_NAME:
+ return getRoleName();
+
+ case COMPONENT:
+ return getComponent();
+
+ }
+ 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 REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case ROLE_NAME:
+ return isSetRoleName();
+ case COMPONENT:
+ return isSetComponent();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TCreateSentryRoleRequest)
+ return this.equals((TCreateSentryRoleRequest)that);
+ return false;
+ }
+
+ public boolean equals(TCreateSentryRoleRequest 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_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_roleName = true && this.isSetRoleName();
+ boolean that_present_roleName = true && that.isSetRoleName();
+ if (this_present_roleName || that_present_roleName) {
+ if (!(this_present_roleName && that_present_roleName))
+ return false;
+ if (!this.roleName.equals(that.roleName))
+ return false;
+ }
+
+ boolean this_present_component = true && this.isSetComponent();
+ boolean that_present_component = true && that.isSetComponent();
+ if (this_present_component || that_present_component) {
+ if (!(this_present_component && that_present_component))
+ return false;
+ if (!this.component.equals(that.component))
+ 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_requestorUserName = true && (isSetRequestorUserName());
+ list.add(present_requestorUserName);
+ if (present_requestorUserName)
+ list.add(requestorUserName);
+
+ boolean present_roleName = true && (isSetRoleName());
+ list.add(present_roleName);
+ if (present_roleName)
+ list.add(roleName);
+
+ boolean present_component = true && (isSetComponent());
+ list.add(present_component);
+ if (present_component)
+ list.add(component);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TCreateSentryRoleRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetComponent()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
+ 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("TCreateSentryRoleRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("roleName:");
+ if (this.roleName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roleName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("component:");
+ if (this.component == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.component);
+ }
+ 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 (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRoleName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetComponent()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TCreateSentryRoleRequestStandardSchemeFactory implements SchemeFactory {
+ public TCreateSentryRoleRequestStandardScheme getScheme() {
+ return new TCreateSentryRoleRequestStandardScheme();
+ }
+ }
+
+ private static class TCreateSentryRoleRequestStandardScheme extends StandardScheme<TCreateSentryRoleRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TCreateSentryRoleRequest 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: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // ROLE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // COMPONENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(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, TCreateSentryRoleRequest 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();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.roleName != null) {
+ oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
+ oprot.writeString(struct.roleName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.component != null) {
+ oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
+ oprot.writeString(struct.component);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TCreateSentryRoleRequestTupleSchemeFactory implements SchemeFactory {
+ public TCreateSentryRoleRequestTupleScheme getScheme() {
+ return new TCreateSentryRoleRequestTupleScheme();
+ }
+ }
+
+ private static class TCreateSentryRoleRequestTupleScheme extends TupleScheme<TCreateSentryRoleRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeString(struct.roleName);
+ oprot.writeString(struct.component);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TCreateSentryRoleResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TCreateSentryRoleResponse.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TCreateSentryRoleResponse.java
new file mode 100644
index 0000000..d041729
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TCreateSentryRoleResponse.java
@@ -0,0 +1,391 @@
+/**
+ * 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.generic.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 TCreateSentryRoleResponse implements org.apache.thrift.TBase<TCreateSentryRoleResponse, TCreateSentryRoleResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TCreateSentryRoleResponse> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCreateSentryRoleResponse");
+
+ 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TCreateSentryRoleResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TCreateSentryRoleResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
+
+ 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;
+ 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TCreateSentryRoleResponse.class, metaDataMap);
+ }
+
+ public TCreateSentryRoleResponse() {
+ }
+
+ public TCreateSentryRoleResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TCreateSentryRoleResponse(TCreateSentryRoleResponse other) {
+ if (other.isSetStatus()) {
+ this.status = other.status;
+ }
+ }
+
+ public TCreateSentryRoleResponse deepCopy() {
+ return new TCreateSentryRoleResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ }
+
+ 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 void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ }
+ 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();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TCreateSentryRoleResponse)
+ return this.equals((TCreateSentryRoleResponse)that);
+ return false;
+ }
+
+ public boolean equals(TCreateSentryRoleResponse 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;
+ }
+
+ 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);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TCreateSentryRoleResponse 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;
+ }
+ }
+ 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("TCreateSentryRoleResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ 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());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TCreateSentryRoleResponseStandardSchemeFactory implements SchemeFactory {
+ public TCreateSentryRoleResponseStandardScheme getScheme() {
+ return new TCreateSentryRoleResponseStandardScheme();
+ }
+ }
+
+ private static class TCreateSentryRoleResponseStandardScheme extends StandardScheme<TCreateSentryRoleResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TCreateSentryRoleResponse 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;
+ 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, TCreateSentryRoleResponse 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.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TCreateSentryRoleResponseTupleSchemeFactory implements SchemeFactory {
+ public TCreateSentryRoleResponseTupleScheme getScheme() {
+ return new TCreateSentryRoleResponseTupleScheme();
+ }
+ }
+
+ private static class TCreateSentryRoleResponseTupleScheme extends TupleScheme<TCreateSentryRoleResponse> {
+
+ @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 read(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleResponse 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);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TDropPrivilegesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TDropPrivilegesRequest.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TDropPrivilegesRequest.java
new file mode 100644
index 0000000..63f0b56
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TDropPrivilegesRequest.java
@@ -0,0 +1,697 @@
+/**
+ * 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.generic.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 TDropPrivilegesRequest implements org.apache.thrift.TBase<TDropPrivilegesRequest, TDropPrivilegesRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TDropPrivilegesRequest> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropPrivilegesRequest");
+
+ 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField PRIVILEGE_FIELD_DESC = new org.apache.thrift.protocol.TField("privilege", org.apache.thrift.protocol.TType.STRUCT, (short)3);
+ private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TDropPrivilegesRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TDropPrivilegesRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private TSentryPrivilege privilege; // required
+ private String component; // 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"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ PRIVILEGE((short)3, "privilege"),
+ COMPONENT((short)4, "component");
+
+ 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: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // PRIVILEGE
+ return PRIVILEGE;
+ case 4: // COMPONENT
+ return COMPONENT;
+ 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.PRIVILEGE, new org.apache.thrift.meta_data.FieldMetaData("privilege", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class)));
+ tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropPrivilegesRequest.class, metaDataMap);
+ }
+
+ public TDropPrivilegesRequest() {
+ this.protocol_version = 2;
+
+ }
+
+ public TDropPrivilegesRequest(
+ int protocol_version,
+ String requestorUserName,
+ TSentryPrivilege privilege,
+ String component)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.privilege = privilege;
+ this.component = component;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TDropPrivilegesRequest(TDropPrivilegesRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetPrivilege()) {
+ this.privilege = new TSentryPrivilege(other.privilege);
+ }
+ if (other.isSetComponent()) {
+ this.component = other.component;
+ }
+ }
+
+ public TDropPrivilegesRequest deepCopy() {
+ return new TDropPrivilegesRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 2;
+
+ this.requestorUserName = null;
+ this.privilege = null;
+ this.component = 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 String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public TSentryPrivilege getPrivilege() {
+ return this.privilege;
+ }
+
+ public void setPrivilege(TSentryPrivilege privilege) {
+ this.privilege = privilege;
+ }
+
+ public void unsetPrivilege() {
+ this.privilege = null;
+ }
+
+ /** Returns true if field privilege is set (has been assigned a value) and false otherwise */
+ public boolean isSetPrivilege() {
+ return this.privilege != null;
+ }
+
+ public void setPrivilegeIsSet(boolean value) {
+ if (!value) {
+ this.privilege = null;
+ }
+ }
+
+ public String getComponent() {
+ return this.component;
+ }
+
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ public void unsetComponent() {
+ this.component = null;
+ }
+
+ /** Returns true if field component is set (has been assigned a value) and false otherwise */
+ public boolean isSetComponent() {
+ return this.component != null;
+ }
+
+ public void setComponentIsSet(boolean value) {
+ if (!value) {
+ this.component = 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 REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case PRIVILEGE:
+ if (value == null) {
+ unsetPrivilege();
+ } else {
+ setPrivilege((TSentryPrivilege)value);
+ }
+ break;
+
+ case COMPONENT:
+ if (value == null) {
+ unsetComponent();
+ } else {
+ setComponent((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return getProtocol_version();
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case PRIVILEGE:
+ return getPrivilege();
+
+ case COMPONENT:
+ return getComponent();
+
+ }
+ 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 REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case PRIVILEGE:
+ return isSetPrivilege();
+ case COMPONENT:
+ return isSetComponent();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TDropPrivilegesRequest)
+ return this.equals((TDropPrivilegesRequest)that);
+ return false;
+ }
+
+ public boolean equals(TDropPrivilegesRequest 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_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_privilege = true && this.isSetPrivilege();
+ boolean that_present_privilege = true && that.isSetPrivilege();
+ if (this_present_privilege || that_present_privilege) {
+ if (!(this_present_privilege && that_present_privilege))
+ return false;
+ if (!this.privilege.equals(that.privilege))
+ return false;
+ }
+
+ boolean this_present_component = true && this.isSetComponent();
+ boolean that_present_component = true && that.isSetComponent();
+ if (this_present_component || that_present_component) {
+ if (!(this_present_component && that_present_component))
+ return false;
+ if (!this.component.equals(that.component))
+ 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_requestorUserName = true && (isSetRequestorUserName());
+ list.add(present_requestorUserName);
+ if (present_requestorUserName)
+ list.add(requestorUserName);
+
+ boolean present_privilege = true && (isSetPrivilege());
+ list.add(present_privilege);
+ if (present_privilege)
+ list.add(privilege);
+
+ boolean present_component = true && (isSetComponent());
+ list.add(present_component);
+ if (present_component)
+ list.add(component);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TDropPrivilegesRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetPrivilege()).compareTo(other.isSetPrivilege());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPrivilege()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilege, other.privilege);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetComponent()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
+ 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("TDropPrivilegesRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("privilege:");
+ if (this.privilege == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.privilege);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("component:");
+ if (this.component == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.component);
+ }
+ 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 (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetPrivilege()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilege' is unset! Struct:" + toString());
+ }
+
+ if (!isSetComponent()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (privilege != null) {
+ privilege.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 TDropPrivilegesRequestStandardSchemeFactory implements SchemeFactory {
+ public TDropPrivilegesRequestStandardScheme getScheme() {
+ return new TDropPrivilegesRequestStandardScheme();
+ }
+ }
+
+ private static class TDropPrivilegesRequestStandardScheme extends StandardScheme<TDropPrivilegesRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TDropPrivilegesRequest 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: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // PRIVILEGE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.privilege = new TSentryPrivilege();
+ struct.privilege.read(iprot);
+ struct.setPrivilegeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // COMPONENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(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, TDropPrivilegesRequest 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();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.privilege != null) {
+ oprot.writeFieldBegin(PRIVILEGE_FIELD_DESC);
+ struct.privilege.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.component != null) {
+ oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
+ oprot.writeString(struct.component);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TDropPrivilegesRequestTupleSchemeFactory implements SchemeFactory {
+ public TDropPrivilegesRequestTupleScheme getScheme() {
+ return new TDropPrivilegesRequestTupleScheme();
+ }
+ }
+
+ private static class TDropPrivilegesRequestTupleScheme extends TupleScheme<TDropPrivilegesRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ struct.privilege.write(oprot);
+ oprot.writeString(struct.component);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.privilege = new TSentryPrivilege();
+ struct.privilege.read(iprot);
+ struct.setPrivilegeIsSet(true);
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ }
+ }
+
+}
+
[19/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryServiceUtil.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryServiceUtil.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryServiceUtil.java
deleted file mode 100644
index 3488e11..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryServiceUtil.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.service.thrift;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.TimeUnit;
-
-import com.google.common.base.Preconditions;
-import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.conf.Configuration;
-import static org.apache.hadoop.hive.conf.HiveConf.ConfVars.METASTOREURIS;
-import static org.apache.sentry.binding.hive.conf.HiveAuthzConf.AuthzConfVars.AUTHZ_SYNC_ALTER_WITH_POLICY_STORE;
-import static org.apache.sentry.binding.hive.conf.HiveAuthzConf.AuthzConfVars.AUTHZ_SYNC_CREATE_WITH_POLICY_STORE;
-import static org.apache.sentry.binding.hive.conf.HiveAuthzConf.AuthzConfVars.AUTHZ_SYNC_DROP_WITH_POLICY_STORE;
-
-import org.apache.hadoop.hive.conf.HiveConf;
-import org.apache.sentry.core.common.exception.SentryInvalidInputException;
-import org.apache.sentry.core.common.utils.SentryConstants;
-import org.apache.sentry.core.common.utils.KeyValue;
-import org.apache.sentry.core.common.utils.PolicyFileConstants;
-import org.apache.sentry.provider.db.service.persistent.SentryStore;
-import org.apache.sentry.provider.db.service.thrift.TSentryAuthorizable;
-import org.apache.sentry.provider.db.service.thrift.TSentryGrantOption;
-import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege;
-import org.apache.sentry.service.thrift.ServiceConstants.PrivilegeScope;
-
-import com.google.common.collect.Lists;
-import org.slf4j.Logger;
-
-public final class SentryServiceUtil {
-
- private static boolean firstCallHDFSSyncEnabled = true;
- private static boolean hdfsSyncEnabled = false;
-
- // parse the privilege in String and get the TSentryPrivilege as result
- public static TSentryPrivilege convertToTSentryPrivilege(String privilegeStr) {
- TSentryPrivilege tSentryPrivilege = new TSentryPrivilege();
- for (String authorizable : SentryConstants.AUTHORIZABLE_SPLITTER.split(privilegeStr)) {
- KeyValue tempKV = new KeyValue(authorizable);
- String key = tempKV.getKey();
- String value = tempKV.getValue();
-
- if (PolicyFileConstants.PRIVILEGE_SERVER_NAME.equalsIgnoreCase(key)) {
- tSentryPrivilege.setServerName(value);
- } else if (PolicyFileConstants.PRIVILEGE_DATABASE_NAME.equalsIgnoreCase(key)) {
- tSentryPrivilege.setDbName(value);
- } else if (PolicyFileConstants.PRIVILEGE_TABLE_NAME.equalsIgnoreCase(key)) {
- tSentryPrivilege.setTableName(value);
- } else if (PolicyFileConstants.PRIVILEGE_COLUMN_NAME.equalsIgnoreCase(key)) {
- tSentryPrivilege.setColumnName(value);
- } else if (PolicyFileConstants.PRIVILEGE_URI_NAME.equalsIgnoreCase(key)) {
- tSentryPrivilege.setURI(value);
- } else if (PolicyFileConstants.PRIVILEGE_ACTION_NAME.equalsIgnoreCase(key)) {
- tSentryPrivilege.setAction(value);
- } else if (PolicyFileConstants.PRIVILEGE_GRANT_OPTION_NAME.equalsIgnoreCase(key)) {
- TSentryGrantOption grantOption = "true".equalsIgnoreCase(value) ? TSentryGrantOption.TRUE
- : TSentryGrantOption.FALSE;
- tSentryPrivilege.setGrantOption(grantOption);
- }
- }
- tSentryPrivilege.setPrivilegeScope(getPrivilegeScope(tSentryPrivilege));
- return tSentryPrivilege;
- }
-
- /**
- * Parse the object path from string to map.
- * @param objectPath the string format as db=db1->table=tbl1
- * @return Map
- */
- public static Map<String, String> parseObjectPath(String objectPath) {
- Map<String, String> objectMap = new HashMap<String, String>();
- if (StringUtils.isEmpty(objectPath)) {
- return objectMap;
- }
- for (String kvStr : SentryConstants.AUTHORIZABLE_SPLITTER.split(objectPath)) {
- KeyValue kv = new KeyValue(kvStr);
- String key = kv.getKey();
- String value = kv.getValue();
-
- if (PolicyFileConstants.PRIVILEGE_DATABASE_NAME.equalsIgnoreCase(key)) {
- objectMap.put(PolicyFileConstants.PRIVILEGE_DATABASE_NAME, value);
- } else if (PolicyFileConstants.PRIVILEGE_TABLE_NAME.equalsIgnoreCase(key)) {
- objectMap.put(PolicyFileConstants.PRIVILEGE_TABLE_NAME, value);
- }
- }
- return objectMap;
- }
-
- // for the different hierarchy for hive:
- // 1: server->url
- // 2: server->database->table->column
- // if both of them are found in the privilege string, the privilege scope will be set as
- // PrivilegeScope.URI
- public static String getPrivilegeScope(TSentryPrivilege tSentryPrivilege) {
- PrivilegeScope privilegeScope = PrivilegeScope.SERVER;
- if (!StringUtils.isEmpty(tSentryPrivilege.getURI())) {
- privilegeScope = PrivilegeScope.URI;
- } else if (!StringUtils.isEmpty(tSentryPrivilege.getColumnName())) {
- privilegeScope = PrivilegeScope.COLUMN;
- } else if (!StringUtils.isEmpty(tSentryPrivilege.getTableName())) {
- privilegeScope = PrivilegeScope.TABLE;
- } else if (!StringUtils.isEmpty(tSentryPrivilege.getDbName())) {
- privilegeScope = PrivilegeScope.DATABASE;
- }
- return privilegeScope.toString();
- }
-
- // convert TSentryPrivilege to privilege in string
- public static String convertTSentryPrivilegeToStr(TSentryPrivilege tSentryPrivilege) {
- List<String> privileges = Lists.newArrayList();
- if (tSentryPrivilege != null) {
- String serverName = tSentryPrivilege.getServerName();
- String dbName = tSentryPrivilege.getDbName();
- String tableName = tSentryPrivilege.getTableName();
- String columnName = tSentryPrivilege.getColumnName();
- String uri = tSentryPrivilege.getURI();
- String action = tSentryPrivilege.getAction();
- String grantOption = (tSentryPrivilege.getGrantOption() == TSentryGrantOption.TRUE ? "true"
- : "false");
- if (!StringUtils.isEmpty(serverName)) {
- privileges.add(SentryConstants.KV_JOINER.join(PolicyFileConstants.PRIVILEGE_SERVER_NAME,
- serverName));
- if (!StringUtils.isEmpty(uri)) {
- privileges.add(SentryConstants.KV_JOINER.join(PolicyFileConstants.PRIVILEGE_URI_NAME,
- uri));
- } else if (!StringUtils.isEmpty(dbName)) {
- privileges.add(SentryConstants.KV_JOINER.join(
- PolicyFileConstants.PRIVILEGE_DATABASE_NAME, dbName));
- if (!StringUtils.isEmpty(tableName)) {
- privileges.add(SentryConstants.KV_JOINER.join(
- PolicyFileConstants.PRIVILEGE_TABLE_NAME, tableName));
- if (!StringUtils.isEmpty(columnName)) {
- privileges.add(SentryConstants.KV_JOINER.join(
- PolicyFileConstants.PRIVILEGE_COLUMN_NAME, columnName));
- }
- }
- }
- if (!StringUtils.isEmpty(action)) {
- privileges.add(SentryConstants.KV_JOINER.join(
- PolicyFileConstants.PRIVILEGE_ACTION_NAME, action));
- }
- }
- // only append the grant option to privilege string if it's true
- if ("true".equals(grantOption)) {
- privileges.add(SentryConstants.KV_JOINER.join(
- PolicyFileConstants.PRIVILEGE_GRANT_OPTION_NAME, grantOption));
- }
- }
- return SentryConstants.AUTHORIZABLE_JOINER.join(privileges);
- }
-
- /**
- * Gracefully shut down an Executor service.
- * <p>
- * This code is based on the Javadoc example for the Executor service.
- * <p>
- * First call shutdown to reject incoming tasks, and then call
- * shutdownNow, if necessary, to cancel any lingering tasks.
- *
- * @param pool the executor service to shut down
- * @param poolName the name of the executor service to shut down to make it easy for debugging
- * @param timeout the timeout interval to wait for its termination
- * @param unit the unit of the timeout
- * @param logger the logger to log the error message if it cannot terminate. It could be null
- */
- public static void shutdownAndAwaitTermination(ExecutorService pool, String poolName,
- long timeout, TimeUnit unit, Logger logger) {
- Preconditions.checkNotNull(pool);
-
- pool.shutdown(); // Disable new tasks from being submitted
- try {
- // Wait a while for existing tasks to terminate
- if (!pool.awaitTermination(timeout, unit)) {
- pool.shutdownNow(); // Cancel currently executing tasks
- // Wait a while for tasks to respond to being cancelled
- if ((!pool.awaitTermination(timeout, unit)) && (logger != null)) {
- logger.error("Executor service {} did not terminate",
- StringUtils.defaultIfBlank(poolName, "null"));
- }
- }
- } catch (InterruptedException ignored) {
- // (Re-)Cancel if current thread also interrupted
- pool.shutdownNow();
- // Preserve interrupt status
- Thread.currentThread().interrupt();
- }
- }
-
- /**
- * Check if Sentry is configured with HDFS sync enabled. Cache the result
- *
- * @param conf The Configuration object where HDFS sync configurations are set.
- * @return True if enabled; False otherwise.
- */
- public static boolean isHDFSSyncEnabled(Configuration conf) {
- if (firstCallHDFSSyncEnabled) {
- List<String> processorFactories =
- Arrays.asList(conf.get(ServiceConstants.ServerConfig.PROCESSOR_FACTORIES, "").split(","));
-
- List<String> policyStorePlugins =
- Arrays.asList(
- conf.get(ServiceConstants.ServerConfig.SENTRY_POLICY_STORE_PLUGINS, "").split(","));
-
- hdfsSyncEnabled =
- processorFactories.contains("org.apache.sentry.hdfs.SentryHDFSServiceProcessorFactory")
- && policyStorePlugins.contains("org.apache.sentry.hdfs.SentryPlugin");
- firstCallHDFSSyncEnabled = false;
- }
-
- return hdfsSyncEnabled;
- }
-
- /**
- * Check if Sentry is configured with HDFS sync enabled without caching the result
- *
- * @param conf The Configuration object where HDFS sync configurations are set.
- * @return True if enabled; False otherwise.
- */
- public static boolean isHDFSSyncEnabledNoCache(Configuration conf) {
-
- List<String> processorFactories =
- Arrays.asList(conf.get(ServiceConstants.ServerConfig.PROCESSOR_FACTORIES, "").split(","));
-
- List<String> policyStorePlugins =
- Arrays.asList(
- conf.get(ServiceConstants.ServerConfig.SENTRY_POLICY_STORE_PLUGINS, "").split(","));
-
- hdfsSyncEnabled =
- processorFactories.contains("org.apache.sentry.hdfs.SentryHDFSServiceProcessorFactory")
- && policyStorePlugins.contains("org.apache.sentry.hdfs.SentryPlugin");
-
-
- return hdfsSyncEnabled;
- }
-
- /**
- * Check if Sentry is configured with policy store sync enabled
- * @param conf
- * @return True if enabled; False otherwise
- */
- public static boolean isSyncPolicyStoreEnabled(Configuration conf) {
- boolean syncStoreOnCreate;
- boolean syncStoreOnDrop;
- boolean syncStoreOnAlter;
-
- syncStoreOnCreate = Boolean
- .parseBoolean(conf.get(AUTHZ_SYNC_CREATE_WITH_POLICY_STORE.getVar(),
- AUTHZ_SYNC_CREATE_WITH_POLICY_STORE.getDefault()));
- syncStoreOnDrop = Boolean.parseBoolean(conf.get(AUTHZ_SYNC_DROP_WITH_POLICY_STORE.getVar(),
- AUTHZ_SYNC_DROP_WITH_POLICY_STORE.getDefault()));
- syncStoreOnAlter = Boolean.parseBoolean(conf.get(AUTHZ_SYNC_ALTER_WITH_POLICY_STORE.getVar(),
- AUTHZ_SYNC_ALTER_WITH_POLICY_STORE.getDefault()));
-
- return syncStoreOnCreate || syncStoreOnDrop || syncStoreOnAlter;
- }
-
- static String getHiveMetastoreURI() {
- HiveConf hiveConf = new HiveConf();
- return hiveConf.get(METASTOREURIS.varname);
- }
-
- /**
- * Derives object name from database and table names by concatenating them
- *
- * @param authorizable for which is name is to be derived
- * @return authorizable name
- * @throws SentryInvalidInputException if argument provided does not have all the
- * required fields set.
- */
- public static String getAuthzObj(TSentryAuthorizable authorizable)
- throws SentryInvalidInputException {
- return getAuthzObj(authorizable.getDb(), authorizable.getTable());
- }
-
- /**
- * Derives object name from database and table names by concatenating them
- *
- * @param dbName
- * @param tblName
- * @return authorizable name
- * @throws SentryInvalidInputException if argument provided does not have all the
- * required fields set.
- */
- public static String getAuthzObj(String dbName, String tblName)
- throws SentryInvalidInputException {
- if (SentryStore.isNULL(dbName)) {
- throw new SentryInvalidInputException("Invalif input, DB name is missing");
- }
- return SentryStore.isNULL(tblName) ? dbName.toLowerCase() :
- (dbName + "." + tblName).toLowerCase();
- }
-
- private SentryServiceUtil() {
- // Make constructor private to avoid instantiation
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java
deleted file mode 100644
index a66d91e..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.service.thrift;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.security.sasl.Sasl;
-
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableMap;
-import org.apache.sentry.provider.db.service.thrift.SentryMetrics;
-
-public class ServiceConstants {
-
- private static final ImmutableMap<String, String> SASL_PROPERTIES;
-
- static {
- Map<String, String> saslProps = new HashMap<String, String>();
- saslProps.put(Sasl.SERVER_AUTH, "true");
- saslProps.put(Sasl.QOP, "auth-conf");
- SASL_PROPERTIES = ImmutableMap.copyOf(saslProps);
- }
-
- public static class ConfUtilties {
- public static final Splitter CLASS_SPLITTER = Splitter.onPattern("[\\s,]")
- .trimResults().omitEmptyStrings();
- }
- public static class ServiceArgs {
- public static final String CONFIG_FILE_SHORT = "c";
- public static final String CONFIG_FILE_LONG = "conffile";
- }
-
- public static class ServerConfig {
- public static final ImmutableMap<String, String> SASL_PROPERTIES = ServiceConstants.SASL_PROPERTIES;
- /**
- * This configuration parameter is only meant to be used for testing purposes.
- */
- public static final String SECURITY_MODE = "sentry.service.security.mode";
- public static final String SECURITY_MODE_KERBEROS = "kerberos";
- public static final String SECURITY_MODE_NONE = "none";
- public static final String SECURITY_USE_UGI_TRANSPORT = "sentry.service.security.use.ugi";
- public static final String ADMIN_GROUPS = "sentry.service.admin.group";
- public static final String PRINCIPAL = "sentry.service.server.principal";
- public static final String KEY_TAB = "sentry.service.server.keytab";
- public static final String RPC_PORT = "sentry.service.server.rpc-port";
- public static final int RPC_PORT_DEFAULT = 8038;
- public static final String RPC_ADDRESS = "sentry.service.server.rpc-address";
- public static final String RPC_ADDRESS_DEFAULT = "0.0.0.0"; //NOPMD
- public static final String RPC_MAX_THREADS = "sentry.service.server-max-threads";
- public static final int RPC_MAX_THREADS_DEFAULT = 500;
- public static final String RPC_MIN_THREADS = "sentry.service.server-min-threads";
- public static final int RPC_MIN_THREADS_DEFAULT = 10;
- public static final String ALLOW_CONNECT = "sentry.service.allow.connect";
-
- public static final String SENTRY_POLICY_STORE_PLUGINS = "sentry.policy.store.plugins";
- public static final String SENTRY_POLICY_STORE_PLUGINS_DEFAULT = "";
-
- public static final String SENTRY_METASTORE_PLUGINS = "sentry.metastore.plugins";
- public static final String SENTRY_METASTORE_PLUGINS_DEFAULT = "";
-
- public static final String PROCESSOR_FACTORIES = "sentry.service.processor.factories";
- public static final String PROCESSOR_FACTORIES_DEFAULT =
- "org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessorFactory" +
- ",org.apache.sentry.provider.db.generic.service.thrift.SentryGenericPolicyProcessorFactory";
- public static final String SENTRY_STORE_JDBC_URL = "sentry.store.jdbc.url";
- public static final String SENTRY_STORE_JDBC_USER = "sentry.store.jdbc.user";
- public static final String SENTRY_STORE_JDBC_USER_DEFAULT = "Sentry";
- public static final String SENTRY_STORE_JDBC_PASS = "sentry.store.jdbc.password";
- public static final String SENTRY_STORE_JDBC_DRIVER = "sentry.store.jdbc.driver";
- public static final String SENTRY_STORE_JDBC_DRIVER_DEFAULT = "org.apache.derby.jdbc.EmbeddedDriver";
- // The configuration for the maximum number of retries per db transaction,
- // the default value is 3 times
- public static final String SENTRY_STORE_TRANSACTION_RETRY = "sentry.store.transaction.retry";
- public static final int SENTRY_STORE_TRANSACTION_RETRY_DEFAULT = 10;
- // The configuration for the delay (in milliseconds) between retries,
- // the default value is 500 ms
- public static final String SENTRY_STORE_TRANSACTION_RETRY_WAIT_TIME_MILLIS =
- "sentry.store.transaction.retry.wait.time.millis";
- public static final int SENTRY_STORE_TRANSACTION_RETRY_WAIT_TIME_MILLIS_DEFAULT = 250;
-
- public static final String JAVAX_JDO_URL = "javax.jdo.option.ConnectionURL";
- public static final String JAVAX_JDO_USER = "javax.jdo.option.ConnectionUserName";
- public static final String JAVAX_JDO_PASS = "javax.jdo.option.ConnectionPassword";
- public static final String JAVAX_JDO_DRIVER_NAME = "javax.jdo.option.ConnectionDriverName";
-
- public static final String DATANUCLEUS_ISOLATION_LEVEL = "datanucleus.transactionIsolation";
- public static final String DATANUCLEUS_REPEATABLE_READ = "repeatable-read";
-
- public static final String SENTRY_DB_PROPERTY_PREFIX = "sentry.";
- public static final String SENTRY_JAVAX_JDO_PROPERTY_PREFIX = SENTRY_DB_PROPERTY_PREFIX + "javax.jdo";
- public static final String SENTRY_DATANUCLEUS_PROPERTY_PREFIX = SENTRY_DB_PROPERTY_PREFIX + "datanucleus";
-
- public static final String SENTRY_VERIFY_SCHEM_VERSION = "sentry.verify.schema.version";
- public static final String SENTRY_VERIFY_SCHEM_VERSION_DEFAULT = "true";
-
- public static final String SENTRY_SERVICE_NAME = "sentry.service.name";
- public static final String SENTRY_SERVICE_NAME_DEFAULT = "Sentry-Service";
-
- public static final String SENTRY_STORE_GROUP_MAPPING = "sentry.store.group.mapping";
- public static final String SENTRY_STORE_GROUP_MAPPING_RESOURCE = "sentry.store.group.mapping.resource";
- public static final String SENTRY_STORE_HADOOP_GROUP_MAPPING = "org.apache.sentry.provider.common.HadoopGroupMappingService";
- public static final String SENTRY_STORE_LOCAL_GROUP_MAPPING = "org.apache.sentry.provider.file.LocalGroupMappingService";
- public static final String SENTRY_STORE_GROUP_MAPPING_DEFAULT = SENTRY_STORE_HADOOP_GROUP_MAPPING;
-
- public static final String SENTRY_STORE_ORPHANED_PRIVILEGE_REMOVAL = "sentry.store.orphaned.privilege.removal";
- public static final String SENTRY_STORE_ORPHANED_PRIVILEGE_REMOVAL_DEFAULT = "false";
- public static final String SENTRY_STORE_CLEAN_PERIOD_SECONDS =
- "sentry.store.clean.period.seconds";
- public static final long SENTRY_STORE_CLEAN_PERIOD_SECONDS_DEFAULT = 43200; // 12 hours.
- public static final String SENTRY_HA_ZK_PROPERTY_PREFIX = "sentry.ha.zookeeper.";
- public static final String SENTRY_HA_ZOOKEEPER_SECURITY = SENTRY_HA_ZK_PROPERTY_PREFIX + "security";
- public static final boolean SENTRY_HA_ZOOKEEPER_SECURITY_DEFAULT = false;
- public static final String SENTRY_HA_ZOOKEEPER_QUORUM = SENTRY_HA_ZK_PROPERTY_PREFIX + "quorum";
- public static final String SENTRY_HA_ZOOKEEPER_RETRIES_MAX_COUNT = SENTRY_HA_ZK_PROPERTY_PREFIX + "session.retries.max.count";
- public static final int SENTRY_HA_ZOOKEEPER_RETRIES_MAX_COUNT_DEFAULT = 3;
- public static final String SENTRY_HA_ZOOKEEPER_SLEEP_BETWEEN_RETRIES_MS = SENTRY_HA_ZK_PROPERTY_PREFIX + "session.sleep.between.retries.ms";
- public static final int SENTRY_HA_ZOOKEEPER_SLEEP_BETWEEN_RETRIES_MS_DEFAULT = 100;
- public static final String SENTRY_HA_ZOOKEEPER_NAMESPACE = SENTRY_HA_ZK_PROPERTY_PREFIX + "namespace";
- public static final String SENTRY_HA_ZOOKEEPER_NAMESPACE_DEFAULT = "sentry";
- // principal and keytab for client to be able to connect to secure ZK. Needed for Sentry HA with secure ZK
- public static final String SERVER_HA_ZOOKEEPER_CLIENT_PRINCIPAL = "sentry.zookeeper.client.principal";
- public static final String SERVER_HA_ZOOKEEPER_CLIENT_KEYTAB = "sentry.zookeeper.client.keytab";
- public static final String SERVER_HA_ZOOKEEPER_CLIENT_TICKET_CACHE = "sentry.zookeeper.client.ticketcache";
- public static final String SERVER_HA_ZOOKEEPER_CLIENT_TICKET_CACHE_DEFAULT = "false";
- public static final String SERVER_HA_STANDBY_SIG = "sentry.ha.standby.signal";
-
- // Timeout value in seconds for HMS notificationID synchronization
- // Should match the value for RPC timeout in HMS client config
- public static final String SENTRY_NOTIFICATION_SYNC_TIMEOUT_MS = "sentry.notification.sync.timeout.ms";
- public static final int SENTRY_NOTIFICATION_SYNC_TIMEOUT_DEFAULT = 200000;
-
- public static final ImmutableMap<String, String> SENTRY_STORE_DEFAULTS =
- ImmutableMap.<String, String>builder()
- .put("datanucleus.connectionPoolingType", "BoneCP")
- .put("datanucleus.schema.validateTables", "false")
- .put("datanucleus.schema.validateColumns", "false")
- .put("datanucleus.schema.validateConstraints", "false")
- .put("datanucleus.storeManagerType", "rdbms")
- .put("datanucleus.schema.autoCreateAll", "false")
- .put("datanucleus.autoStartMechanismMode", "checked")
- .put(DATANUCLEUS_ISOLATION_LEVEL, DATANUCLEUS_REPEATABLE_READ)
- .put("datanucleus.cache.level2", "false")
- .put("datanucleus.cache.level2.type", "none")
- .put("datanucleus.query.sql.allowAll", "true")
- .put("datanucleus.identifierFactory", "datanucleus1")
- .put("datanucleus.rdbms.useLegacyNativeValueStrategy", "true")
- .put("datanucleus.plugin.pluginRegistryBundleCheck", "LOG")
- .put("javax.jdo.PersistenceManagerFactoryClass",
- "org.datanucleus.api.jdo.JDOPersistenceManagerFactory")
- .put("javax.jdo.option.DetachAllOnCommit", "true")
- .put("javax.jdo.option.NonTransactionalRead", "false")
- .put("javax.jdo.option.NonTransactionalWrite", "false")
- .put("javax.jdo.option.Multithreaded", "true")
- .build();
-
- // InitialDelay and period time for HMSFollower thread.
- public static final String SENTRY_HMSFOLLOWER_INIT_DELAY_MILLS = "sentry.hmsfollower.init.delay.mills";
- public static final long SENTRY_HMSFOLLOWER_INIT_DELAY_MILLS_DEFAULT = 0;
- public static final String SENTRY_HMSFOLLOWER_INTERVAL_MILLS = "sentry.hmsfollower.interval.mills";
- public static final long SENTRY_HMSFOLLOWER_INTERVAL_MILLS_DEFAULT = 500;
-
- public static final String SENTRY_WEB_ENABLE = "sentry.service.web.enable";
- public static final Boolean SENTRY_WEB_ENABLE_DEFAULT = false;
- public static final String SENTRY_WEB_PORT = "sentry.service.web.port";
- public static final int SENTRY_WEB_PORT_DEFAULT = 29000;
- // Reporter is either "console", "log" or "jmx"
- public static final String SENTRY_REPORTER = "sentry.service.reporter";
- public static final String SENTRY_REPORTER_JMX = SentryMetrics.Reporting.JMX.name(); //case insensitive
- public static final String SENTRY_REPORTER_CONSOLE = SentryMetrics.Reporting.CONSOLE.name();//case insensitive
-
- // for console reporter, reporting interval in seconds
- public static final String SENTRY_REPORTER_INTERVAL_SEC =
- "sentry.service.reporter.interval.sec";
- public static final String SENTRY_JSON_REPORTER_FILE = "sentry.service.reporter.file";
- public static final String SENTRY_JSON_REPORTER_FILE_DEFAULT = "/tmp/sentry-metrics.json";
-
- // Report every 5 minutes by default
- public static final int SENTRY_REPORTER_INTERVAL_DEFAULT = 300;
-
- // Web SSL
- public static final String SENTRY_WEB_USE_SSL = "sentry.web.use.ssl";
- public static final String SENTRY_WEB_SSL_KEYSTORE_PATH = "sentry.web.ssl.keystore.path";
- public static final String SENTRY_WEB_SSL_KEYSTORE_PASSWORD = "sentry.web.ssl.keystore.password";
- public static final String SENTRY_SSL_PROTOCOL_BLACKLIST = "sentry.ssl.protocol.blacklist";
- // Blacklist SSL protocols that are not secure (e.g., POODLE vulnerability)
- public static final String[] SENTRY_SSL_PROTOCOL_BLACKLIST_DEFAULT = {"SSLv2", "SSLv2Hello", "SSLv3"};
-
- // Web Security
- public static final String SENTRY_WEB_SECURITY_PREFIX = "sentry.service.web.authentication";
- public static final String SENTRY_WEB_SECURITY_TYPE = SENTRY_WEB_SECURITY_PREFIX + ".type";
- public static final String SENTRY_WEB_SECURITY_TYPE_NONE = "NONE";
- public static final String SENTRY_WEB_SECURITY_TYPE_KERBEROS = "KERBEROS";
- public static final String SENTRY_WEB_SECURITY_PRINCIPAL = SENTRY_WEB_SECURITY_PREFIX + ".kerberos.principal";
- public static final String SENTRY_WEB_SECURITY_KEYTAB = SENTRY_WEB_SECURITY_PREFIX + ".kerberos.keytab";
- public static final String SENTRY_WEB_SECURITY_ALLOW_CONNECT_USERS = SENTRY_WEB_SECURITY_PREFIX + ".allow.connect.users";
-
- // Flag to enable admin servlet
- public static final String SENTRY_WEB_ADMIN_SERVLET_ENABLED = "sentry.web.admin.servlet.enabled";
- public static final boolean SENTRY_WEB_ADMIN_SERVLET_ENABLED_DEFAULT = false;
-
- public static final String SENTRY_WEB_PUBSUB_SERVLET_ENABLED = "sentry.web.pubsub.servlet.enabled";
- public static final boolean SENTRY_WEB_PUBSUB_SERVLET_ENABLED_DEFAULT = false;
-
- // max message size for thrift messages
- public static final String SENTRY_POLICY_SERVER_THRIFT_MAX_MESSAGE_SIZE = "sentry.policy.server.thrift.max.message.size";
- public static final long SENTRY_POLICY_SERVER_THRIFT_MAX_MESSAGE_SIZE_DEFAULT = 100 * 1024 * 1024;
-
- // action factories for external components
- public static final String SENTRY_COMPONENT_ACTION_FACTORY_FORMAT = "sentry.%s.action.factory";
-
- // Sentry is never a client to other Kerberos Services, it should not be required to renew the TGT
- @Deprecated
- public static final String SENTRY_KERBEROS_TGT_AUTORENEW = "sentry.service.kerberos.tgt.autorenew";
- @Deprecated
- public static final Boolean SENTRY_KERBEROS_TGT_AUTORENEW_DEFAULT = false;
-
- /**
- * Number of path/priv deltas to keep around during cleaning
- * The value which is too small may cause unnecessary full snapshots sent to the Name Node
- * A value which is too large may cause slowdown due to too many deltas lying around in the DB.
- */
- public static final String SENTRY_DELTA_KEEP_COUNT = "sentry.server.delta.keep.count";
- public static final int SENTRY_DELTA_KEEP_COUNT_DEFAULT = 200;
-
- /**
- * Number of notification id's to keep around during cleaning
- */
- public static final String SENTRY_HMS_NOTIFICATION_ID_KEEP_COUNT = "sentry.server.delta.keep.count";
- public static final int SENTRY_HMS_NOTIFICATION_ID_KEEP_COUNT_DEFAULT = 100;
- }
-
- public static class ClientConfig {
- public static final String SERVER_RPC_PORT = "sentry.service.client.server.rpc-port";
- public static final int SERVER_RPC_PORT_DEFAULT = ServerConfig.RPC_PORT_DEFAULT;
- public static final String SERVER_RPC_ADDRESS = "sentry.service.client.server.rpc-addresses";
- public static final String SERVER_RPC_CONN_TIMEOUT = "sentry.service.client.server.rpc-connection-timeout";
-
- // HA configuration
- public static final String SENTRY_HA_ZOOKEEPER_QUORUM = ServerConfig.SENTRY_HA_ZOOKEEPER_QUORUM;
- public static final String SENTRY_HA_ZOOKEEPER_NAMESPACE = ServerConfig.SENTRY_HA_ZOOKEEPER_NAMESPACE;
- public static final String SERVER_HA_ZOOKEEPER_NAMESPACE_DEFAULT = ServerConfig.SENTRY_HA_ZOOKEEPER_NAMESPACE_DEFAULT;
-
- // connection pool configuration
- public static final String SENTRY_POOL_ENABLED = "sentry.service.client.connection.pool.enabled";
- public static final boolean SENTRY_POOL_ENABLED_DEFAULT = false;
-
- // commons-pool configuration for pool size
- public static final String SENTRY_POOL_MAX_TOTAL = "sentry.service.client.connection.pool.max-total";
- public static final int SENTRY_POOL_MAX_TOTAL_DEFAULT = 8;
- public static final String SENTRY_POOL_MAX_IDLE = "sentry.service.client.connection.pool.max-idle";
- public static final int SENTRY_POOL_MAX_IDLE_DEFAULT = 8;
- public static final String SENTRY_POOL_MIN_IDLE = "sentry.service.client.connection.pool.min-idle";
- public static final int SENTRY_POOL_MIN_IDLE_DEFAULT = 0;
-
- // retry num for getting the connection from connection pool
- public static final String SENTRY_POOL_RETRY_TOTAL = "sentry.service.client.connection.pool.retry-total";
- public static final int SENTRY_POOL_RETRY_TOTAL_DEFAULT = 3;
-
- // max message size for thrift messages
- public static final String SENTRY_POLICY_CLIENT_THRIFT_MAX_MESSAGE_SIZE = "sentry.policy.client.thrift.max.message.size";
- public static final long SENTRY_POLICY_CLIENT_THRIFT_MAX_MESSAGE_SIZE_DEFAULT = 100 * 1024 * 1024;
-
- // client retry settings
- public static final String RETRY_COUNT_CONF = "sentry.provider.backend.db.retry.count";
- public static final int RETRY_COUNT_DEFAULT = 3;
- public static final String RETRY_INTERVAL_SEC_CONF = "sentry.provider.backend.db.retry.interval.seconds";
- public static final int RETRY_INTERVAL_SEC_DEFAULT = 30;
-
- // provider backend cache settings
- public static final String ENABLE_CACHING = "sentry.provider.backend.generic.cache.enabled";
- public static final boolean ENABLE_CACHING_DEFAULT = false;
- public static final String CACHE_TTL_MS = "sentry.provider.backend.generic.cache.ttl.ms";
- public static final long CACHING_TTL_MS_DEFAULT = 30000;
- public static final String CACHE_UPDATE_FAILURES_BEFORE_PRIV_REVOKE = "sentry.provider.backend.generic.cache.update.failures.count";
- public static final int CACHE_UPDATE_FAILURES_BEFORE_PRIV_REVOKE_DEFAULT = 3;
- public static final String PRIVILEGE_CONVERTER = "sentry.provider.backend.generic.privilege.converter";
-
- public static final String COMPONENT_TYPE = "sentry.provider.backend.generic.component-type";
- public static final String SERVICE_NAME = "sentry.provider.backend.generic.service-name";
- }
-
- /**
- * Thrift generates terrible constant class names
- */
- public static class ThriftConstants extends org.apache.sentry.service.thrift.sentry_common_serviceConstants {
- public static final int TSENTRY_SERVICE_VERSION_CURRENT = TSENTRY_SERVICE_V2;
- }
-
- /* Privilege operation scope */
- public enum PrivilegeScope {
- SERVER,
- URI,
- DATABASE,
- TABLE,
- COLUMN
- }
-
- public static final String SENTRY_ZK_JAAS_NAME = "Sentry";
- public static final String CURRENT_INCARNATION_ID_KEY = "current.incarnation.key";
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/Status.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/Status.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/Status.java
deleted file mode 100644
index e9cc411..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/Status.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.service.thrift;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import javax.annotation.Nullable;
-
-import org.apache.sentry.core.common.exception.SentryUserException;
-import org.apache.sentry.core.common.exception.SentryAccessDeniedException;
-import org.apache.sentry.core.common.exception.SentryAlreadyExistsException;
-import org.apache.sentry.core.common.exception.SentryInvalidInputException;
-import org.apache.sentry.core.common.exception.SentryNoSuchObjectException;
-import org.apache.sentry.core.common.exception.SentryThriftAPIMismatchException;
-import org.apache.sentry.service.thrift.ServiceConstants.ThriftConstants;
-
-/**
- * Simple factory to make returning TSentryStatus objects easy
- */
-public enum Status {
- OK(ThriftConstants.TSENTRY_STATUS_OK),
- ALREADY_EXISTS(ThriftConstants.TSENTRY_STATUS_ALREADY_EXISTS),
- NO_SUCH_OBJECT(ThriftConstants.TSENTRY_STATUS_NO_SUCH_OBJECT),
- RUNTIME_ERROR(ThriftConstants.TSENTRY_STATUS_RUNTIME_ERROR),
- INVALID_INPUT(ThriftConstants.TSENTRY_STATUS_INVALID_INPUT),
- ACCESS_DENIED(ThriftConstants.TSENTRY_STATUS_ACCESS_DENIED),
- THRIFT_VERSION_MISMATCH(ThriftConstants.TSENTRY_STATUS_THRIFT_VERSION_MISMATCH),
- UNKNOWN(-1)
- ;
- private int code;
- private Status(int code) {
- this.code = code;
- }
- public int getCode() {
- return code;
- }
- public static Status fromCode(int code) {
- for (Status status : Status.values()) {
- if (status.getCode() == code) {
- return status;
- }
- }
- return Status.UNKNOWN;
- }
- public static TSentryResponseStatus OK() {
- return Create(Status.OK, "");
- }
- public static TSentryResponseStatus AccessDenied(String message, Throwable t) {
- return Create(Status.ACCESS_DENIED, message, t);
- }
- public static TSentryResponseStatus AlreadyExists(String message, Throwable t) {
- return Create(Status.ALREADY_EXISTS, message, t);
- }
- public static TSentryResponseStatus NoSuchObject(String message, Throwable t) {
- return Create(Status.NO_SUCH_OBJECT, message, t);
- }
- public static TSentryResponseStatus RuntimeError(String message, Throwable t) {
- return Create(Status.RUNTIME_ERROR, message, t);
- }
- public static TSentryResponseStatus Create(Status value, String message) {
- return Create(value, message, null);
- }
- public static TSentryResponseStatus InvalidInput(String message, Throwable t) {
- return Create(Status.INVALID_INPUT, message, t);
- }
- public static TSentryResponseStatus THRIFT_VERSION_MISMATCH(String message, Throwable t) {
- return Create(Status.THRIFT_VERSION_MISMATCH, message, t);
- }
- 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)
- 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));
- }
- }
-
- private static String serverErrorToString(TSentryResponseStatus thriftStatus) {
- String msg = thriftStatus.getMessage();
- String stack = thriftStatus.getStack();
- if (stack == null) {
- return msg;
- }
- return msg + ". Server Stacktrace: " + stack;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/resources/sentry_common_service.thrift
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry_common_service.thrift b/sentry-provider/sentry-provider-db/src/main/resources/sentry_common_service.thrift
deleted file mode 100644
index 2a92c97..0000000
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry_common_service.thrift
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/local/bin/thrift -java
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace java org.apache.sentry.service.thrift
-namespace php sentry.service.thrift
-namespace cpp Apache.Sentry.Service.Thrift
-
-const i32 TSENTRY_SERVICE_V1 = 1;
-// Made a backward incompatible change when adding column level privileges.
-// We also added generalized model in this version
-const i32 TSENTRY_SERVICE_V2 = 2;
-
-const i32 TSENTRY_STATUS_OK = 0;
-const i32 TSENTRY_STATUS_ALREADY_EXISTS = 1;
-const i32 TSENTRY_STATUS_NO_SUCH_OBJECT = 2;
-const i32 TSENTRY_STATUS_RUNTIME_ERROR = 3;
-const i32 TSENTRY_STATUS_INVALID_INPUT = 4;
-const i32 TSENTRY_STATUS_ACCESS_DENIED = 5;
-const i32 TSENTRY_STATUS_THRIFT_VERSION_MISMATCH = 6;
-
-struct TSentryResponseStatus {
-1: required i32 value,
-// message will be set to empty string when status is OK
-2: required string message
-3: optional string stack
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/resources/sentry_generic_policy_service.thrift
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry_generic_policy_service.thrift b/sentry-provider/sentry-provider-db/src/main/resources/sentry_generic_policy_service.thrift
deleted file mode 100644
index c56522f..0000000
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry_generic_policy_service.thrift
+++ /dev/null
@@ -1,278 +0,0 @@
-#!/usr/local/bin/thrift -java
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#
-# Thrift Service that the MetaStore is built on
-#
-
-include "sentry_common_service.thrift"
-include "sentry_policy_service.thrift"
-
-namespace java org.apache.sentry.provider.db.generic.service.thrift
-namespace php sentry.provider.db.service.db.generic.serivce.thrift
-namespace cpp Apache.Sentry.Provider.Db.Generic.Service.Thrift
-
-typedef sentry_common_service.TSentryResponseStatus TSentryResponseStatus
-
-# Represents a new generic model privilege for solr or other component in transport
-# from the client to the server
-enum TSentryGrantOption {
- TRUE = 1,
- FALSE = 0,
- UNSET = -1
-}
-
-# Represents a authorizable resource in the privilege
-# like DATABASE=db1 in the hive, COLLECTION=collection1 in the solr
-struct TAuthorizable {
-1: required string type,
-2: required string name
-}
-
-struct TSentryPrivilege {
-1: required string component,
-2: required string serviceName,
-3: required list<TAuthorizable> authorizables,
-4: required string action,
-5: optional i64 createTime, # Set on server side
-6: optional string grantorPrincipal, # Set on server side
-7: optional TSentryGrantOption grantOption = sentry_policy_service.TSentryGrantOption.FALSE
-}
-
-# CREATE ROLE r1
-struct TCreateSentryRoleRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName,
-4: required string component # The request is issued to which component
-}
-
-struct TCreateSentryRoleResponse {
-1: required TSentryResponseStatus status
-}
-
-# DROP ROLE r1
-struct TDropSentryRoleRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName,
-4: required string component # The request is issued to which component
-}
-
-struct TDropSentryRoleResponse {
-1: required TSentryResponseStatus status
-}
-
-# GRANT ROLE r1 TO GROUP g1
-struct TAlterSentryRoleAddGroupsRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName,
-4: required string component, # The request is issued to which component
-5: required set<string> groups
-}
-struct TAlterSentryRoleAddGroupsResponse {
-1: required TSentryResponseStatus status
-}
-
-# REVOLE ROLE r1 FROM GROUP g1
-struct TAlterSentryRoleDeleteGroupsRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName,
-4: required string component, # The request is issued to which component
-5: required set<string> groups
-}
-struct TAlterSentryRoleDeleteGroupsResponse {
-1: required TSentryResponseStatus status
-}
-
-# GRANT ... ON ... TO ROLE ...
-struct TAlterSentryRoleGrantPrivilegeRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName,
-4: required string component, # The request is issued to which component
-5: required TSentryPrivilege privilege
-}
-struct TAlterSentryRoleGrantPrivilegeResponse {
-1: required TSentryResponseStatus status
-}
-
-# REVOKE ... ON ... FROM ROLE ...
-struct TAlterSentryRoleRevokePrivilegeRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName,
-4: required string component, # The request is issued to which component
-5: required TSentryPrivilege privilege
-}
-struct TAlterSentryRoleRevokePrivilegeResponse {
-1: required TSentryResponseStatus status
-}
-
-# SHOW ROLE GRANT
-struct TListSentryRolesRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: optional string groupName, # for this group, or all roles for all groups if null
-4: required string component # The request is issued to which component
-}
-# used only for TListSentryRolesResponse
-struct TSentryRole {
-1: required string roleName,
-2: required set<string> groups
-}
-
-struct TListSentryRolesResponse {
-1: required TSentryResponseStatus status
-2: optional set<TSentryRole> roles
-}
-# SHOW GRANT
-struct TListSentryPrivilegesRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName, # get privileges assigned for this role
-4: required string component, # The request is issued to which component
-5: required string serviceName, # The privilege belongs to which service
-6: optional list<TAuthorizable> authorizables # get privileges assigned for this authorizable hierarchys
-}
-
-struct TListSentryPrivilegesResponse {
-1: required TSentryResponseStatus status
-2: optional set<TSentryPrivilege> privileges
-}
-
-# Drop privilege
-struct TDropPrivilegesRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required TSentryPrivilege privilege
-4: required string component, # The request is issued to which component
-}
-
-struct TDropPrivilegesResponse {
-1: required TSentryResponseStatus status
-}
-
-# Rename privilege
-struct TRenamePrivilegesRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string component, # The request is issued to which component
-4: required string serviceName, # The privilege belongs to which service
-5: required list<TAuthorizable> oldAuthorizables, # get old privileges assigned for this authorizable hierarchys
-6: required list<TAuthorizable> newAuthorizables # change to new authorizable hierarchys
-}
-
-struct TRenamePrivilegesResponse {
-1: required TSentryResponseStatus status
-}
-
-# This API was created specifically for ProviderBackend.getPrivileges
-# and is not mean for general purpose privilege retrieval.
-# This request/response pair are created specifically so we can
-# efficiently obtain the specific privilges for a user query
-struct TSentryActiveRoleSet {
-1: required bool all,
-2: required set<string> roles,
-}
-
-struct TListSentryPrivilegesForProviderRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string component, # The request is issued to which component
-3: required string serviceName, # The privilege belongs to which service
-4: required set<string> groups,
-5: required TSentryActiveRoleSet roleSet,
-6: optional list<TAuthorizable> authorizables # authorizable hierarchys
-}
-
-struct TListSentryPrivilegesForProviderResponse {
-1: required TSentryResponseStatus status
-2: required set<string> privileges
-}
-
-# Map of role:set<privileges> for the given authorizable
-# Optionally use the set of groups to filter the roles
-struct TSentryPrivilegeMap {
-1: required map<string, set<TSentryPrivilege>> privilegeMap
-}
-
-struct TListSentryPrivilegesByAuthRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-
-# User on whose behalf the request is issued
-2: required string requestorUserName,
-
-# The request is issued to which component
-3: required string component,
-
-# The privilege belongs to which service
-4: required string serviceName,
-
-# The authorizable hierarchys, it is represented as a string. e.g
-# resourceType1=resourceName1->resourceType2=resourceName2->resourceType3=resourceName3
-5: required set<string> authorizablesSet,
-
-# The requested groups. For admin, the requested groups can be empty, if so it is
-# treated as a wildcard query. Otherwise, it is a query on this specifc groups.
-# For non-admin user, the requested groups must be the groups they are part of.
-6: optional set<string> groups,
-
-# The active role set.
-7: optional TSentryActiveRoleSet roleSet
-}
-
-struct TListSentryPrivilegesByAuthResponse {
-1: required sentry_common_service.TSentryResponseStatus status,
-
-# Will not be set in case of an error. Otherwise it will be a
-# <Authorizables, <Role, Set<Privileges>>> mapping. For non-admin
-# requestor, the roles are intersection of active roles and granted roles.
-# For admin requestor, the roles are filtered based on the active roles
-# and requested group from TListSentryPrivilegesByAuthRequest.
-# The authorizable hierarchys is represented as a string in the form
-# of the request.
-2: optional map<string, TSentryPrivilegeMap> privilegesMapByAuth
-}
-
-service SentryGenericPolicyService
-{
- TCreateSentryRoleResponse create_sentry_role(1:TCreateSentryRoleRequest request)
- TDropSentryRoleResponse drop_sentry_role(1:TDropSentryRoleRequest request)
-
- TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(1:TAlterSentryRoleGrantPrivilegeRequest request)
- TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(1:TAlterSentryRoleRevokePrivilegeRequest request)
-
- TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(1:TAlterSentryRoleAddGroupsRequest request)
- TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(1:TAlterSentryRoleDeleteGroupsRequest request)
-
- TListSentryRolesResponse list_sentry_roles_by_group(1:TListSentryRolesRequest request)
-
- TListSentryPrivilegesResponse list_sentry_privileges_by_role(1:TListSentryPrivilegesRequest request)
-
- TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(1:TListSentryPrivilegesForProviderRequest request)
-
- TListSentryPrivilegesByAuthResponse list_sentry_privileges_by_authorizable(1:TListSentryPrivilegesByAuthRequest request);
-
- TDropPrivilegesResponse drop_sentry_privilege(1:TDropPrivilegesRequest request);
-
- TRenamePrivilegesResponse rename_sentry_privilege(1:TRenamePrivilegesRequest request);
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/resources/sentry_policy_service.thrift
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry_policy_service.thrift b/sentry-provider/sentry-provider-db/src/main/resources/sentry_policy_service.thrift
deleted file mode 100644
index 98fefab..0000000
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry_policy_service.thrift
+++ /dev/null
@@ -1,364 +0,0 @@
-#!/usr/local/bin/thrift -java
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#
-# Thrift Service that the MetaStore is built on
-#
-
-include "sentry_common_service.thrift"
-
-namespace java org.apache.sentry.provider.db.service.thrift
-namespace php sentry.provider.db.service.thrift
-namespace cpp Apache.Sentry.Provider.Db.Service.Thrift
-
-enum TSentryGrantOption {
- TRUE = 1,
- FALSE = 0,
- # UNSET is used for revoke privilege, the component like 'hive'
- # didn't support getting grant option, so use UNSET is stand
- # for revoke both privileges with grant option and without grant
- # option.
- UNSET = -1
-}
-
-# 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
-3: required string serverName,
-4: optional string dbName = "",
-5: optional string tableName = "",
-6: optional string URI = "",
-7: required string action = "",
-8: optional i64 createTime, # Set on server side
-9: optional TSentryGrantOption grantOption = TSentryGrantOption.FALSE
-10: optional string columnName = "",
-}
-
-# TODO can this be deleted? it's not adding value to TAlterSentryRoleAddGroupsRequest
-struct TSentryGroup {
-1: required string groupName
-}
-
-# CREATE ROLE r1
-struct TCreateSentryRoleRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName, # TSentryRole is not required for this request
-}
-struct TCreateSentryRoleResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-# DROP ROLE r1
-struct TDropSentryRoleRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName # role to drop
-}
-struct TDropSentryRoleResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-# GRANT ROLE r1 TO GROUP g1
-struct TAlterSentryRoleAddGroupsRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName,
-5: required set<TSentryGroup> groups
-}
-
-struct TAlterSentryRoleAddGroupsResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-# GRANT ROLE r1 TO USER u1
-struct TAlterSentryRoleAddUsersRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName,
-4: required set<string> users
-}
-
-struct TAlterSentryRoleAddUsersResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-# REVOKE ROLE r1 FROM GROUP g1
-struct TAlterSentryRoleDeleteGroupsRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName,
-5: required set<TSentryGroup> groups
-}
-struct TAlterSentryRoleDeleteGroupsResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-# REVOKE ROLE r1 FROM USER u1
-struct TAlterSentryRoleDeleteUsersRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName,
-4: required set<string> users
-}
-struct TAlterSentryRoleDeleteUsersResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-# GRANT ... ON ... TO ROLE ...
-struct TAlterSentryRoleGrantPrivilegeRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName,
-5: optional TSentryPrivilege privilege,
-6: optional set<TSentryPrivilege> privileges
-}
-struct TAlterSentryRoleGrantPrivilegeResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-2: optional TSentryPrivilege privilege
-3: optional set<TSentryPrivilege> privileges
-}
-
-# REVOKE ... ON ... FROM ROLE ...
-struct TAlterSentryRoleRevokePrivilegeRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName,
-5: optional TSentryPrivilege privilege,
-6: optional set<TSentryPrivilege> privileges
-}
-struct TAlterSentryRoleRevokePrivilegeResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-# SHOW ROLE GRANT
-struct TListSentryRolesRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: optional string groupName # for this group, or all roles for all groups if null
-}
-
-struct TListSentryRolesForUserRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string userName
-}
-
-# used only for TListSentryRolesResponse
-struct TSentryRole {
-1: required string roleName,
-2: required set<TSentryGroup> groups,
-3: required string grantorPrincipal #Deprecated
-}
-struct TListSentryRolesResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-2: optional set<TSentryRole> roles
-}
-
-struct TSentryAuthorizable {
-1: required string server,
-2: optional string uri,
-3: optional string db,
-4: optional string table,
-5: optional string column,
-}
-
-# SHOW GRANT
-struct TListSentryPrivilegesRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-4: required string roleName, # get privileges assigned for this role
-5: optional TSentryAuthorizable authorizableHierarchy # get privileges assigned for this role
-}
-struct TListSentryPrivilegesResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-2: optional set<TSentryPrivilege> privileges
-}
-
-# Drop privilege
-struct TDropPrivilegesRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required TSentryAuthorizable authorizable
-}
-
-struct TDropPrivilegesResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-struct TRenamePrivilegesRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required TSentryAuthorizable oldAuthorizable
-4: required TSentryAuthorizable newAuthorizable
-}
-
-struct TRenamePrivilegesResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-# This API was created specifically for ProviderBackend.getPrivileges
-# and is not mean for general purpose privilege retrieval.
-# This request/response pair are created specifically so we can
-# efficiently obtain the specific privilges for a user query
-struct TSentryActiveRoleSet {
-1: required bool all,
-2: required set<string> roles,
-}
-struct TListSentryPrivilegesForProviderRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required set<string> groups,
-3: required TSentryActiveRoleSet roleSet,
-4: optional TSentryAuthorizable authorizableHierarchy,
-5: optional set<string> users
-}
-struct TListSentryPrivilegesForProviderResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-2: required set<string> privileges
-}
-
-# List role:set<privileges> for the given authorizable
-# Optionally use the set of groups to filter the roles
-struct TSentryPrivilegeMap {
-1: required map<string, set<TSentryPrivilege>> privilegeMap
-}
-struct TListSentryPrivilegesByAuthRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required set<TSentryAuthorizable> authorizableSet,
-4: optional set<string> groups,
-5: optional TSentryActiveRoleSet roleSet
-}
-struct TListSentryPrivilegesByAuthResponse {
-1: required sentry_common_service.TSentryResponseStatus status,
-2: optional map<TSentryAuthorizable, TSentryPrivilegeMap> privilegesMapByAuth # will not be set in case of an error
-}
-
-# Obtain a config value from the Sentry service
-struct TSentryConfigValueRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required string propertyName, # Config attribute to obtain
-3: optional string defaultValue # Value if propertyName not found
-}
-struct TSentryConfigValueResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-2: optional string value
-}
-
-# struct for the mapping data like group to role, role to privilege
-struct TSentryMappingData {
-1: optional map<string, set<string>> groupRolesMap, # for the groupName -> role mapping
-2: optional map<string, set<TSentryPrivilege>> rolePrivilegesMap, # for the roleName -> privilege mapping
-3: optional map<string, set<string>> userRolesMap # for the userName -> role mapping
-}
-
-struct TSentryExportMappingDataRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: optional string objectPath # for specific auth object
-}
-
-struct TSentryExportMappingDataResponse {
-1: required sentry_common_service.TSentryResponseStatus status,
-2: required TSentryMappingData mappingData
-}
-
-struct TSentryImportMappingDataRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required bool overwriteRole = false, # if overwrite the exist role with the imported privileges, default is false
-4: required TSentryMappingData mappingData
-}
-
-struct TSentryImportMappingDataResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-/*
- * API for synchronizing between HMS notification events and Sentry.
- *
- * When Sentry gets updates from HMS using HMS Notifications, HMS should
- * should wait after each notification event is generated until the notification
- * is handled by Sentry This preserves the synchronous semantics of DDL statements.
- *
- * The notification synchronization API is private between HMS and Sentry and should
- * not be used by anything else.
- *
- * The API should be used in the following way:
- *
- * 1) HMS creates a notification and stores its ID in the persistent storage
- * 2) HMS sends ID to Sentry
- * 3) Sentry blocks the response until the specified ID is processed by Sentry
- * 4) Sentry responds with the most recent processed ID.
- *
- * Note that the important part is blocking in Sentry until the specified ID
- * is processed. The returned most recent processed ID is intended for debugging
- * purposes only, but may be used in HMS for performance optimizations.
- */
-
-struct TSentrySyncIDRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2,
-2: required i64 id // Requested ID
-}
-
-struct TSentrySyncIDResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-2: required i64 id // Most recent processed ID
-}
-
-service SentryPolicyService
-{
- TCreateSentryRoleResponse create_sentry_role(1:TCreateSentryRoleRequest request)
- TDropSentryRoleResponse drop_sentry_role(1:TDropSentryRoleRequest request)
-
- TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(1:TAlterSentryRoleGrantPrivilegeRequest request)
- TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(1:TAlterSentryRoleRevokePrivilegeRequest request)
-
- TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(1:TAlterSentryRoleAddGroupsRequest request)
- TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(1:TAlterSentryRoleDeleteGroupsRequest request)
-
- TAlterSentryRoleAddUsersResponse alter_sentry_role_add_users(1:TAlterSentryRoleAddUsersRequest request)
- TAlterSentryRoleDeleteUsersResponse alter_sentry_role_delete_users(1:TAlterSentryRoleDeleteUsersRequest request)
-
- TListSentryRolesResponse list_sentry_roles_by_group(1:TListSentryRolesRequest request)
- TListSentryRolesResponse list_sentry_roles_by_user(1:TListSentryRolesForUserRequest request)
-
- TListSentryPrivilegesResponse list_sentry_privileges_by_role(1:TListSentryPrivilegesRequest request)
-
- # For use with ProviderBackend.getPrivileges only
- TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(1:TListSentryPrivilegesForProviderRequest request)
-
- TDropPrivilegesResponse drop_sentry_privilege(1:TDropPrivilegesRequest request);
-
- TRenamePrivilegesResponse rename_sentry_privilege(1:TRenamePrivilegesRequest request);
-
- TListSentryPrivilegesByAuthResponse list_sentry_privileges_by_authorizable(1:TListSentryPrivilegesByAuthRequest request);
-
- TSentryConfigValueResponse get_sentry_config_value(1:TSentryConfigValueRequest request);
-
- # export the mapping data in sentry
- TSentryExportMappingDataResponse export_sentry_mapping_data(1:TSentryExportMappingDataRequest request);
-
- # import the mapping data in sentry
- TSentryImportMappingDataResponse import_sentry_mapping_data(1:TSentryImportMappingDataRequest request);
-
- # Synchronize between HMS notifications and Sentry
- TSentrySyncIDResponse sentry_sync_notifications(1:TSentrySyncIDRequest request);
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/SentryGenericServiceIntegrationBase.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/SentryGenericServiceIntegrationBase.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/SentryGenericServiceIntegrationBase.java
new file mode 100644
index 0000000..a26f4f7
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/SentryGenericServiceIntegrationBase.java
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.generic.thrift;
+
+import java.security.PrivilegedExceptionAction;
+import java.util.Set;
+
+import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+import org.junit.After;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SentryGenericServiceIntegrationBase extends SentryServiceIntegrationBase {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SentryGenericServiceIntegrationBase.class);
+ protected static final String SOLR = "SOLR";
+ protected SentryGenericServiceClient client;
+
+ /**
+ * use the generic client to connect sentry service
+ */
+ @Override
+ public void connectToSentryService() throws Exception {
+ // The client should already be logged in when running in solr
+ // therefore we must manually login in the integration tests
+ if (kerberos) {
+ this.client = clientUgi.doAs( new PrivilegedExceptionAction<SentryGenericServiceClient>() {
+ @Override
+ public SentryGenericServiceClient run() throws Exception {
+ return SentryGenericServiceClientFactory.create(conf);
+ }
+ });
+ } else {
+ this.client = SentryGenericServiceClientFactory.create(conf);
+ }
+ }
+
+ @After
+ public void after() {
+ try {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ Set<TSentryRole> tRoles = client.listAllRoles(ADMIN_USER, SOLR);
+ for (TSentryRole tRole : tRoles) {
+ client.dropRole(ADMIN_USER, tRole.getRoleName(), SOLR);
+ }
+ if(client != null) {
+ client.close();
+ }
+ }
+ });
+ } catch (Exception e) {
+ LOGGER.error(e.getMessage(), e);
+ } finally {
+ policyFilePath.delete();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/TestAuditLogForSentryGenericService.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/TestAuditLogForSentryGenericService.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/TestAuditLogForSentryGenericService.java
new file mode 100644
index 0000000..dea6152
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/TestAuditLogForSentryGenericService.java
@@ -0,0 +1,296 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sentry.api.generic.thrift;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.security.PrivilegedExceptionAction;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.sentry.provider.db.log.appender.AuditLoggerTestAppender;
+import org.apache.sentry.provider.db.log.util.CommandUtil;
+import org.apache.sentry.provider.db.log.util.Constants;
+import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+import org.codehaus.jettison.json.JSONObject;
+import org.junit.After;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+public class TestAuditLogForSentryGenericService extends SentryServiceIntegrationBase {
+
+ private SentryGenericServiceClient client;
+ private static final String COMPONENT = "SQOOP";
+ private static final org.slf4j.Logger LOGGER = LoggerFactory
+ .getLogger(TestAuditLogForSentryGenericService.class);
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ SentryServiceIntegrationBase.setup();
+ Logger logger = Logger.getLogger("sentry.generic.authorization.ddl.logger");
+ AuditLoggerTestAppender testAppender = new AuditLoggerTestAppender();
+ logger.addAppender(testAppender);
+ logger.setLevel(Level.INFO);
+ }
+
+ @Override
+ @After
+ public void after() {
+ try {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ Set<TSentryRole> tRoles = client.listAllRoles(ADMIN_USER, COMPONENT);
+ for (TSentryRole tRole : tRoles) {
+ client.dropRole(ADMIN_USER, tRole.getRoleName(), COMPONENT);
+ }
+ if (client != null) {
+ client.close();
+ }
+ }
+ });
+ } catch (Exception e) {
+ // log the exception
+ LOGGER.warn("Exception happened after test case.", e);
+ } finally {
+ policyFilePath.delete();
+ }
+ }
+
+ /**
+ * use the generic client to connect sentry service
+ */
+ @Override
+ public void connectToSentryService() throws Exception {
+ if (kerberos) {
+ this.client = clientUgi.doAs(new PrivilegedExceptionAction<SentryGenericServiceClient>() {
+ @Override
+ public SentryGenericServiceClient run() throws Exception {
+ return SentryGenericServiceClientFactory.create(conf);
+ }
+ });
+ } else {
+ this.client = SentryGenericServiceClientFactory.create(conf);
+ }
+ }
+
+ @Test
+ public void testAuditLogForGenericModel() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ String roleName = "admin_r";
+ String testGroupName = "g1";
+ String action = "all";
+ String service = "sentryService";
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ // test the audit log for create role, success
+ client.createRole(requestorUserName, roleName, COMPONENT);
+ Map<String, String> fieldValueMap = new HashMap<String, String>();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_CREATE_ROLE);
+ fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "CREATE ROLE " + roleName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+
+ // test the audit log for create role, failed
+ try {
+ client.createRole(requestorUserName, roleName, COMPONENT);
+ fail("Exception should have been thrown");
+ } catch (Exception e) {
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_CREATE_ROLE);
+ fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "CREATE ROLE " + roleName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ }
+
+ // test the audit log for add role to group, success
+ client.grantRoleToGroups(requestorUserName, roleName, COMPONENT,
+ Sets.newHashSet(testGroupName));
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_ADD_ROLE);
+ fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT ROLE " + roleName
+ + " TO GROUP " + testGroupName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+
+ // test the audit log for add role to group, failed
+ try {
+ client.grantRoleToGroups(requestorUserName, "invalidRole", COMPONENT,
+ Sets.newHashSet(testGroupName));
+ fail("Exception should have been thrown");
+ } catch (Exception e) {
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_ADD_ROLE);
+ fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT ROLE invalidRole TO GROUP "
+ + testGroupName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ }
+
+ // test the audit log for grant privilege, success
+ TSentryPrivilege privilege = new TSentryPrivilege(COMPONENT, service, Lists.newArrayList(
+ new TAuthorizable("resourceType1", "resourceName1"), new TAuthorizable("resourceType2",
+ "resourceName2")), action);
+ client.grantPrivilege(requestorUserName, roleName, COMPONENT, privilege);
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_GRANT_PRIVILEGE);
+ fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT,
+ "GRANT ALL ON resourceType1 resourceName1 resourceType2 resourceName2 TO ROLE "
+ + roleName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+
+ // for error audit log
+ TSentryPrivilege invalidPrivilege = new TSentryPrivilege(COMPONENT, service,
+ Lists.newArrayList(new TAuthorizable("resourceType1", "resourceName1")),
+ "invalidAction");
+ // test the audit log for grant privilege, failed
+ try {
+ client.grantPrivilege(requestorUserName, roleName, COMPONENT, invalidPrivilege);
+ fail("Exception should have been thrown");
+ } catch (Exception e) {
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_GRANT_PRIVILEGE);
+ fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT,
+ "GRANT INVALIDACTION ON resourceType1 resourceName1 TO ROLE " + roleName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ }
+
+ // test the audit log for revoke privilege, success
+ client.revokePrivilege(requestorUserName, roleName, COMPONENT, privilege);
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_REVOKE_PRIVILEGE);
+ fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT,
+ "REVOKE ALL ON resourceType1 resourceName1 resourceType2 resourceName2 FROM ROLE "
+ + roleName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+
+ // test the audit log for revoke privilege, failed
+ try {
+ client.revokePrivilege(requestorUserName, "invalidRole", COMPONENT, invalidPrivilege);
+ fail("Exception should have been thrown");
+ } catch (Exception e) {
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_REVOKE_PRIVILEGE);
+ fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT,
+ "REVOKE INVALIDACTION ON resourceType1 resourceName1 FROM ROLE invalidRole");
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ }
+
+ // test the audit log for delete role from group, success
+ client.revokeRoleFromGroups(requestorUserName, roleName, COMPONENT,
+ Sets.newHashSet(testGroupName));
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_DELETE_ROLE);
+ fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "REVOKE ROLE " + roleName
+ + " FROM GROUP " + testGroupName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ // test the audit log for delete role from group, failed
+ try {
+ client.revokeRoleFromGroups(requestorUserName, "invalidRole", COMPONENT,
+ Sets.newHashSet(testGroupName));
+ fail("Exception should have been thrown");
+ } catch (Exception e) {
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_DELETE_ROLE);
+ fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT,
+ "REVOKE ROLE invalidRole FROM GROUP " + testGroupName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ }
+ // test the audit log for drop role, success
+ client.dropRole(requestorUserName, roleName, COMPONENT);
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_DROP_ROLE);
+ fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "DROP ROLE " + roleName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ // test the audit log for drop role, failed
+ try {
+ client.dropRole(requestorUserName, roleName, COMPONENT);
+ fail("Exception should have been thrown");
+ } catch (Exception e) {
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_DROP_ROLE);
+ fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "DROP ROLE " + roleName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ }
+ }
+ });
+ }
+
+ private void assertAuditLog(Map<String, String> fieldValueMap) throws Exception {
+ assertThat(AuditLoggerTestAppender.getLastLogLevel(), is(Level.INFO));
+ JSONObject jsonObject = new JSONObject(AuditLoggerTestAppender.getLastLogEvent());
+ if (fieldValueMap != null) {
+ for (Map.Entry<String, String> entry : fieldValueMap.entrySet()) {
+ String entryKey = entry.getKey();
+ if (Constants.LOG_FIELD_IP_ADDRESS.equals(entryKey)) {
+ assertTrue(CommandUtil.assertIPInAuditLog(jsonObject.get(entryKey).toString()));
+ } else {
+ assertTrue(entry.getValue().equalsIgnoreCase(jsonObject.get(entryKey).toString()));
+ }
+ }
+ }
+ }
+}
[43/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesForProviderRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesForProviderRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesForProviderRequest.java
deleted file mode 100644
index c9ebd40..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesForProviderRequest.java
+++ /dev/null
@@ -1,1011 +0,0 @@
-/**
- * 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.provider.db.generic.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 TListSentryPrivilegesForProviderRequest implements org.apache.thrift.TBase<TListSentryPrivilegesForProviderRequest, TListSentryPrivilegesForProviderRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesForProviderRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesForProviderRequest");
-
- 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 COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField SERVICE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("serviceName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)4);
- private static final org.apache.thrift.protocol.TField ROLE_SET_FIELD_DESC = new org.apache.thrift.protocol.TField("roleSet", org.apache.thrift.protocol.TType.STRUCT, (short)5);
- private static final org.apache.thrift.protocol.TField AUTHORIZABLES_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizables", org.apache.thrift.protocol.TType.LIST, (short)6);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryPrivilegesForProviderRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryPrivilegesForProviderRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String component; // required
- private String serviceName; // required
- private Set<String> groups; // required
- private TSentryActiveRoleSet roleSet; // required
- private List<TAuthorizable> authorizables; // optional
-
- /** 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"),
- COMPONENT((short)2, "component"),
- SERVICE_NAME((short)3, "serviceName"),
- GROUPS((short)4, "groups"),
- ROLE_SET((short)5, "roleSet"),
- AUTHORIZABLES((short)6, "authorizables");
-
- 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: // COMPONENT
- return COMPONENT;
- case 3: // SERVICE_NAME
- return SERVICE_NAME;
- case 4: // GROUPS
- return GROUPS;
- case 5: // ROLE_SET
- return ROLE_SET;
- case 6: // AUTHORIZABLES
- return AUTHORIZABLES;
- 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 byte __isset_bitfield = 0;
- private static final _Fields optionals[] = {_Fields.AUTHORIZABLES};
- 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.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.SERVICE_NAME, new org.apache.thrift.meta_data.FieldMetaData("serviceName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- tmpMap.put(_Fields.ROLE_SET, new org.apache.thrift.meta_data.FieldMetaData("roleSet", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryActiveRoleSet.class)));
- tmpMap.put(_Fields.AUTHORIZABLES, new org.apache.thrift.meta_data.FieldMetaData("authorizables", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAuthorizable.class))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesForProviderRequest.class, metaDataMap);
- }
-
- public TListSentryPrivilegesForProviderRequest() {
- this.protocol_version = 2;
-
- }
-
- public TListSentryPrivilegesForProviderRequest(
- int protocol_version,
- String component,
- String serviceName,
- Set<String> groups,
- TSentryActiveRoleSet roleSet)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.component = component;
- this.serviceName = serviceName;
- this.groups = groups;
- this.roleSet = roleSet;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryPrivilegesForProviderRequest(TListSentryPrivilegesForProviderRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetComponent()) {
- this.component = other.component;
- }
- if (other.isSetServiceName()) {
- this.serviceName = other.serviceName;
- }
- if (other.isSetGroups()) {
- Set<String> __this__groups = new HashSet<String>(other.groups);
- this.groups = __this__groups;
- }
- if (other.isSetRoleSet()) {
- this.roleSet = new TSentryActiveRoleSet(other.roleSet);
- }
- if (other.isSetAuthorizables()) {
- List<TAuthorizable> __this__authorizables = new ArrayList<TAuthorizable>(other.authorizables.size());
- for (TAuthorizable other_element : other.authorizables) {
- __this__authorizables.add(new TAuthorizable(other_element));
- }
- this.authorizables = __this__authorizables;
- }
- }
-
- public TListSentryPrivilegesForProviderRequest deepCopy() {
- return new TListSentryPrivilegesForProviderRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.component = null;
- this.serviceName = null;
- this.groups = null;
- this.roleSet = null;
- this.authorizables = 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 String getComponent() {
- return this.component;
- }
-
- public void setComponent(String component) {
- this.component = component;
- }
-
- public void unsetComponent() {
- this.component = null;
- }
-
- /** Returns true if field component is set (has been assigned a value) and false otherwise */
- public boolean isSetComponent() {
- return this.component != null;
- }
-
- public void setComponentIsSet(boolean value) {
- if (!value) {
- this.component = null;
- }
- }
-
- public String getServiceName() {
- return this.serviceName;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- public void unsetServiceName() {
- this.serviceName = null;
- }
-
- /** Returns true if field serviceName is set (has been assigned a value) and false otherwise */
- public boolean isSetServiceName() {
- return this.serviceName != null;
- }
-
- public void setServiceNameIsSet(boolean value) {
- if (!value) {
- this.serviceName = null;
- }
- }
-
- public int getGroupsSize() {
- return (this.groups == null) ? 0 : this.groups.size();
- }
-
- public java.util.Iterator<String> getGroupsIterator() {
- return (this.groups == null) ? null : this.groups.iterator();
- }
-
- public void addToGroups(String elem) {
- if (this.groups == null) {
- this.groups = new HashSet<String>();
- }
- this.groups.add(elem);
- }
-
- public Set<String> getGroups() {
- return this.groups;
- }
-
- public void setGroups(Set<String> groups) {
- this.groups = groups;
- }
-
- public void unsetGroups() {
- this.groups = null;
- }
-
- /** Returns true if field groups is set (has been assigned a value) and false otherwise */
- public boolean isSetGroups() {
- return this.groups != null;
- }
-
- public void setGroupsIsSet(boolean value) {
- if (!value) {
- this.groups = null;
- }
- }
-
- public TSentryActiveRoleSet getRoleSet() {
- return this.roleSet;
- }
-
- public void setRoleSet(TSentryActiveRoleSet roleSet) {
- this.roleSet = roleSet;
- }
-
- public void unsetRoleSet() {
- this.roleSet = null;
- }
-
- /** Returns true if field roleSet is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleSet() {
- return this.roleSet != null;
- }
-
- public void setRoleSetIsSet(boolean value) {
- if (!value) {
- this.roleSet = null;
- }
- }
-
- public int getAuthorizablesSize() {
- return (this.authorizables == null) ? 0 : this.authorizables.size();
- }
-
- public java.util.Iterator<TAuthorizable> getAuthorizablesIterator() {
- return (this.authorizables == null) ? null : this.authorizables.iterator();
- }
-
- public void addToAuthorizables(TAuthorizable elem) {
- if (this.authorizables == null) {
- this.authorizables = new ArrayList<TAuthorizable>();
- }
- this.authorizables.add(elem);
- }
-
- public List<TAuthorizable> getAuthorizables() {
- return this.authorizables;
- }
-
- public void setAuthorizables(List<TAuthorizable> authorizables) {
- this.authorizables = authorizables;
- }
-
- public void unsetAuthorizables() {
- this.authorizables = null;
- }
-
- /** Returns true if field authorizables is set (has been assigned a value) and false otherwise */
- public boolean isSetAuthorizables() {
- return this.authorizables != null;
- }
-
- public void setAuthorizablesIsSet(boolean value) {
- if (!value) {
- this.authorizables = 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 COMPONENT:
- if (value == null) {
- unsetComponent();
- } else {
- setComponent((String)value);
- }
- break;
-
- case SERVICE_NAME:
- if (value == null) {
- unsetServiceName();
- } else {
- setServiceName((String)value);
- }
- break;
-
- case GROUPS:
- if (value == null) {
- unsetGroups();
- } else {
- setGroups((Set<String>)value);
- }
- break;
-
- case ROLE_SET:
- if (value == null) {
- unsetRoleSet();
- } else {
- setRoleSet((TSentryActiveRoleSet)value);
- }
- break;
-
- case AUTHORIZABLES:
- if (value == null) {
- unsetAuthorizables();
- } else {
- setAuthorizables((List<TAuthorizable>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case COMPONENT:
- return getComponent();
-
- case SERVICE_NAME:
- return getServiceName();
-
- case GROUPS:
- return getGroups();
-
- case ROLE_SET:
- return getRoleSet();
-
- case AUTHORIZABLES:
- return getAuthorizables();
-
- }
- 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 COMPONENT:
- return isSetComponent();
- case SERVICE_NAME:
- return isSetServiceName();
- case GROUPS:
- return isSetGroups();
- case ROLE_SET:
- return isSetRoleSet();
- case AUTHORIZABLES:
- return isSetAuthorizables();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryPrivilegesForProviderRequest)
- return this.equals((TListSentryPrivilegesForProviderRequest)that);
- return false;
- }
-
- public boolean equals(TListSentryPrivilegesForProviderRequest 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_component = true && this.isSetComponent();
- boolean that_present_component = true && that.isSetComponent();
- if (this_present_component || that_present_component) {
- if (!(this_present_component && that_present_component))
- return false;
- if (!this.component.equals(that.component))
- return false;
- }
-
- boolean this_present_serviceName = true && this.isSetServiceName();
- boolean that_present_serviceName = true && that.isSetServiceName();
- if (this_present_serviceName || that_present_serviceName) {
- if (!(this_present_serviceName && that_present_serviceName))
- return false;
- if (!this.serviceName.equals(that.serviceName))
- return false;
- }
-
- boolean this_present_groups = true && this.isSetGroups();
- boolean that_present_groups = true && that.isSetGroups();
- if (this_present_groups || that_present_groups) {
- if (!(this_present_groups && that_present_groups))
- return false;
- if (!this.groups.equals(that.groups))
- return false;
- }
-
- boolean this_present_roleSet = true && this.isSetRoleSet();
- boolean that_present_roleSet = true && that.isSetRoleSet();
- if (this_present_roleSet || that_present_roleSet) {
- if (!(this_present_roleSet && that_present_roleSet))
- return false;
- if (!this.roleSet.equals(that.roleSet))
- return false;
- }
-
- boolean this_present_authorizables = true && this.isSetAuthorizables();
- boolean that_present_authorizables = true && that.isSetAuthorizables();
- if (this_present_authorizables || that_present_authorizables) {
- if (!(this_present_authorizables && that_present_authorizables))
- return false;
- if (!this.authorizables.equals(that.authorizables))
- 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_component = true && (isSetComponent());
- list.add(present_component);
- if (present_component)
- list.add(component);
-
- boolean present_serviceName = true && (isSetServiceName());
- list.add(present_serviceName);
- if (present_serviceName)
- list.add(serviceName);
-
- boolean present_groups = true && (isSetGroups());
- list.add(present_groups);
- if (present_groups)
- list.add(groups);
-
- boolean present_roleSet = true && (isSetRoleSet());
- list.add(present_roleSet);
- if (present_roleSet)
- list.add(roleSet);
-
- boolean present_authorizables = true && (isSetAuthorizables());
- list.add(present_authorizables);
- if (present_authorizables)
- list.add(authorizables);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TListSentryPrivilegesForProviderRequest 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(isSetComponent()).compareTo(other.isSetComponent());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetComponent()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetServiceName()).compareTo(other.isSetServiceName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetServiceName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serviceName, other.serviceName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGroups()).compareTo(other.isSetGroups());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroups()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, other.groups);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleSet()).compareTo(other.isSetRoleSet());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleSet()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleSet, other.roleSet);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetAuthorizables()).compareTo(other.isSetAuthorizables());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAuthorizables()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizables, other.authorizables);
- 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("TListSentryPrivilegesForProviderRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("component:");
- if (this.component == null) {
- sb.append("null");
- } else {
- sb.append(this.component);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("serviceName:");
- if (this.serviceName == null) {
- sb.append("null");
- } else {
- sb.append(this.serviceName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("groups:");
- if (this.groups == null) {
- sb.append("null");
- } else {
- sb.append(this.groups);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleSet:");
- if (this.roleSet == null) {
- sb.append("null");
- } else {
- sb.append(this.roleSet);
- }
- first = false;
- if (isSetAuthorizables()) {
- if (!first) sb.append(", ");
- sb.append("authorizables:");
- if (this.authorizables == null) {
- sb.append("null");
- } else {
- sb.append(this.authorizables);
- }
- 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 (!isSetComponent()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
- }
-
- if (!isSetServiceName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'serviceName' is unset! Struct:" + toString());
- }
-
- if (!isSetGroups()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'groups' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleSet()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleSet' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (roleSet != null) {
- roleSet.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 TListSentryPrivilegesForProviderRequestStandardSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesForProviderRequestStandardScheme getScheme() {
- return new TListSentryPrivilegesForProviderRequestStandardScheme();
- }
- }
-
- private static class TListSentryPrivilegesForProviderRequestStandardScheme extends StandardScheme<TListSentryPrivilegesForProviderRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesForProviderRequest 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: // COMPONENT
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // SERVICE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.serviceName = iprot.readString();
- struct.setServiceNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // GROUPS
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set80 = iprot.readSetBegin();
- struct.groups = new HashSet<String>(2*_set80.size);
- String _elem81;
- for (int _i82 = 0; _i82 < _set80.size; ++_i82)
- {
- _elem81 = iprot.readString();
- struct.groups.add(_elem81);
- }
- iprot.readSetEnd();
- }
- struct.setGroupsIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // ROLE_SET
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.roleSet = new TSentryActiveRoleSet();
- struct.roleSet.read(iprot);
- struct.setRoleSetIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 6: // AUTHORIZABLES
- if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list83 = iprot.readListBegin();
- struct.authorizables = new ArrayList<TAuthorizable>(_list83.size);
- TAuthorizable _elem84;
- for (int _i85 = 0; _i85 < _list83.size; ++_i85)
- {
- _elem84 = new TAuthorizable();
- _elem84.read(iprot);
- struct.authorizables.add(_elem84);
- }
- iprot.readListEnd();
- }
- struct.setAuthorizablesIsSet(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, TListSentryPrivilegesForProviderRequest 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();
- if (struct.component != null) {
- oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
- oprot.writeString(struct.component);
- oprot.writeFieldEnd();
- }
- if (struct.serviceName != null) {
- oprot.writeFieldBegin(SERVICE_NAME_FIELD_DESC);
- oprot.writeString(struct.serviceName);
- oprot.writeFieldEnd();
- }
- if (struct.groups != null) {
- oprot.writeFieldBegin(GROUPS_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.groups.size()));
- for (String _iter86 : struct.groups)
- {
- oprot.writeString(_iter86);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- if (struct.roleSet != null) {
- oprot.writeFieldBegin(ROLE_SET_FIELD_DESC);
- struct.roleSet.write(oprot);
- oprot.writeFieldEnd();
- }
- if (struct.authorizables != null) {
- if (struct.isSetAuthorizables()) {
- oprot.writeFieldBegin(AUTHORIZABLES_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.authorizables.size()));
- for (TAuthorizable _iter87 : struct.authorizables)
- {
- _iter87.write(oprot);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryPrivilegesForProviderRequestTupleSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesForProviderRequestTupleScheme getScheme() {
- return new TListSentryPrivilegesForProviderRequestTupleScheme();
- }
- }
-
- private static class TListSentryPrivilegesForProviderRequestTupleScheme extends TupleScheme<TListSentryPrivilegesForProviderRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.component);
- oprot.writeString(struct.serviceName);
- {
- oprot.writeI32(struct.groups.size());
- for (String _iter88 : struct.groups)
- {
- oprot.writeString(_iter88);
- }
- }
- struct.roleSet.write(oprot);
- BitSet optionals = new BitSet();
- if (struct.isSetAuthorizables()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetAuthorizables()) {
- {
- oprot.writeI32(struct.authorizables.size());
- for (TAuthorizable _iter89 : struct.authorizables)
- {
- _iter89.write(oprot);
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- struct.serviceName = iprot.readString();
- struct.setServiceNameIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set90 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.groups = new HashSet<String>(2*_set90.size);
- String _elem91;
- for (int _i92 = 0; _i92 < _set90.size; ++_i92)
- {
- _elem91 = iprot.readString();
- struct.groups.add(_elem91);
- }
- }
- struct.setGroupsIsSet(true);
- struct.roleSet = new TSentryActiveRoleSet();
- struct.roleSet.read(iprot);
- struct.setRoleSetIsSet(true);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- {
- org.apache.thrift.protocol.TList _list93 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.authorizables = new ArrayList<TAuthorizable>(_list93.size);
- TAuthorizable _elem94;
- for (int _i95 = 0; _i95 < _list93.size; ++_i95)
- {
- _elem94 = new TAuthorizable();
- _elem94.read(iprot);
- struct.authorizables.add(_elem94);
- }
- }
- struct.setAuthorizablesIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesForProviderResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesForProviderResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesForProviderResponse.java
deleted file mode 100644
index 3fffa3e..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesForProviderResponse.java
+++ /dev/null
@@ -1,541 +0,0 @@
-/**
- * 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.provider.db.generic.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 TListSentryPrivilegesForProviderResponse implements org.apache.thrift.TBase<TListSentryPrivilegesForProviderResponse, TListSentryPrivilegesForProviderResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesForProviderResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesForProviderResponse");
-
- 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 PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryPrivilegesForProviderResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryPrivilegesForProviderResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
- private Set<String> privileges; // 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"),
- PRIVILEGES((short)2, "privileges");
-
- 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: // PRIVILEGES
- return PRIVILEGES;
- 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
- tmpMap.put(_Fields.PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("privileges", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesForProviderResponse.class, metaDataMap);
- }
-
- public TListSentryPrivilegesForProviderResponse() {
- }
-
- public TListSentryPrivilegesForProviderResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status,
- Set<String> privileges)
- {
- this();
- this.status = status;
- this.privileges = privileges;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryPrivilegesForProviderResponse(TListSentryPrivilegesForProviderResponse other) {
- if (other.isSetStatus()) {
- this.status = other.status;
- }
- if (other.isSetPrivileges()) {
- Set<String> __this__privileges = new HashSet<String>(other.privileges);
- this.privileges = __this__privileges;
- }
- }
-
- public TListSentryPrivilegesForProviderResponse deepCopy() {
- return new TListSentryPrivilegesForProviderResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- this.privileges = null;
- }
-
- 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 int getPrivilegesSize() {
- return (this.privileges == null) ? 0 : this.privileges.size();
- }
-
- public java.util.Iterator<String> getPrivilegesIterator() {
- return (this.privileges == null) ? null : this.privileges.iterator();
- }
-
- public void addToPrivileges(String elem) {
- if (this.privileges == null) {
- this.privileges = new HashSet<String>();
- }
- this.privileges.add(elem);
- }
-
- public Set<String> getPrivileges() {
- return this.privileges;
- }
-
- public void setPrivileges(Set<String> privileges) {
- this.privileges = privileges;
- }
-
- public void unsetPrivileges() {
- this.privileges = null;
- }
-
- /** Returns true if field privileges is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivileges() {
- return this.privileges != null;
- }
-
- public void setPrivilegesIsSet(boolean value) {
- if (!value) {
- this.privileges = null;
- }
- }
-
- 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 PRIVILEGES:
- if (value == null) {
- unsetPrivileges();
- } else {
- setPrivileges((Set<String>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- case PRIVILEGES:
- return getPrivileges();
-
- }
- 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 PRIVILEGES:
- return isSetPrivileges();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryPrivilegesForProviderResponse)
- return this.equals((TListSentryPrivilegesForProviderResponse)that);
- return false;
- }
-
- public boolean equals(TListSentryPrivilegesForProviderResponse 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_privileges = true && this.isSetPrivileges();
- boolean that_present_privileges = true && that.isSetPrivileges();
- if (this_present_privileges || that_present_privileges) {
- if (!(this_present_privileges && that_present_privileges))
- return false;
- if (!this.privileges.equals(that.privileges))
- 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_privileges = true && (isSetPrivileges());
- list.add(present_privileges);
- if (present_privileges)
- list.add(privileges);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TListSentryPrivilegesForProviderResponse 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(isSetPrivileges()).compareTo(other.isSetPrivileges());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivileges()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, other.privileges);
- 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("TListSentryPrivilegesForProviderResponse(");
- 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("privileges:");
- if (this.privileges == null) {
- sb.append("null");
- } else {
- sb.append(this.privileges);
- }
- 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 (!isSetPrivileges()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'privileges' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TListSentryPrivilegesForProviderResponseStandardSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesForProviderResponseStandardScheme getScheme() {
- return new TListSentryPrivilegesForProviderResponseStandardScheme();
- }
- }
-
- private static class TListSentryPrivilegesForProviderResponseStandardScheme extends StandardScheme<TListSentryPrivilegesForProviderResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesForProviderResponse 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: // PRIVILEGES
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set96 = iprot.readSetBegin();
- struct.privileges = new HashSet<String>(2*_set96.size);
- String _elem97;
- for (int _i98 = 0; _i98 < _set96.size; ++_i98)
- {
- _elem97 = iprot.readString();
- struct.privileges.add(_elem97);
- }
- iprot.readSetEnd();
- }
- struct.setPrivilegesIsSet(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, TListSentryPrivilegesForProviderResponse 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();
- }
- if (struct.privileges != null) {
- oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.privileges.size()));
- for (String _iter99 : struct.privileges)
- {
- oprot.writeString(_iter99);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryPrivilegesForProviderResponseTupleSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesForProviderResponseTupleScheme getScheme() {
- return new TListSentryPrivilegesForProviderResponseTupleScheme();
- }
- }
-
- private static class TListSentryPrivilegesForProviderResponseTupleScheme extends TupleScheme<TListSentryPrivilegesForProviderResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- {
- oprot.writeI32(struct.privileges.size());
- for (String _iter100 : struct.privileges)
- {
- oprot.writeString(_iter100);
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderResponse 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);
- {
- org.apache.thrift.protocol.TSet _set101 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.privileges = new HashSet<String>(2*_set101.size);
- String _elem102;
- for (int _i103 = 0; _i103 < _set101.size; ++_i103)
- {
- _elem102 = iprot.readString();
- struct.privileges.add(_elem102);
- }
- }
- struct.setPrivilegesIsSet(true);
- }
- }
-
-}
-
[34/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleRequest.java
deleted file mode 100644
index 3b3ac66..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleRequest.java
+++ /dev/null
@@ -1,591 +0,0 @@
-/**
- * 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.provider.db.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 TDropSentryRoleRequest implements org.apache.thrift.TBase<TDropSentryRoleRequest, TDropSentryRoleRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TDropSentryRoleRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropSentryRoleRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TDropSentryRoleRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TDropSentryRoleRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropSentryRoleRequest.class, metaDataMap);
- }
-
- public TDropSentryRoleRequest() {
- this.protocol_version = 2;
-
- }
-
- public TDropSentryRoleRequest(
- int protocol_version,
- String requestorUserName,
- String roleName)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TDropSentryRoleRequest(TDropSentryRoleRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- }
-
- public TDropSentryRoleRequest deepCopy() {
- return new TDropSentryRoleRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.roleName = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TDropSentryRoleRequest)
- return this.equals((TDropSentryRoleRequest)that);
- return false;
- }
-
- public boolean equals(TDropSentryRoleRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TDropSentryRoleRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- 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("TDropSentryRoleRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TDropSentryRoleRequestStandardSchemeFactory implements SchemeFactory {
- public TDropSentryRoleRequestStandardScheme getScheme() {
- return new TDropSentryRoleRequestStandardScheme();
- }
- }
-
- private static class TDropSentryRoleRequestStandardScheme extends StandardScheme<TDropSentryRoleRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TDropSentryRoleRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(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, TDropSentryRoleRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TDropSentryRoleRequestTupleSchemeFactory implements SchemeFactory {
- public TDropSentryRoleRequestTupleScheme getScheme() {
- return new TDropSentryRoleRequestTupleScheme();
- }
- }
-
- private static class TDropSentryRoleRequestTupleScheme extends TupleScheme<TDropSentryRoleRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleResponse.java
deleted file mode 100644
index ddeace0..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleResponse.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/**
- * 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.provider.db.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 TDropSentryRoleResponse implements org.apache.thrift.TBase<TDropSentryRoleResponse, TDropSentryRoleResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TDropSentryRoleResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropSentryRoleResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TDropSentryRoleResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TDropSentryRoleResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.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)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropSentryRoleResponse.class, metaDataMap);
- }
-
- public TDropSentryRoleResponse() {
- }
-
- public TDropSentryRoleResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * 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);
- }
- }
-
- public TDropSentryRoleResponse deepCopy() {
- return new TDropSentryRoleResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TDropSentryRoleResponse)
- return this.equals((TDropSentryRoleResponse)that);
- return false;
- }
-
- public boolean equals(TDropSentryRoleResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TDropSentryRoleResponse 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;
- }
- }
- 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("TDropSentryRoleResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // 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 {
- 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 TDropSentryRoleResponseStandardSchemeFactory implements SchemeFactory {
- public TDropSentryRoleResponseStandardScheme getScheme() {
- return new TDropSentryRoleResponseStandardScheme();
- }
- }
-
- private static class TDropSentryRoleResponseStandardScheme extends StandardScheme<TDropSentryRoleResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TDropSentryRoleResponse 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;
- 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, TDropSentryRoleResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TDropSentryRoleResponseTupleSchemeFactory implements SchemeFactory {
- public TDropSentryRoleResponseTupleScheme getScheme() {
- return new TDropSentryRoleResponseTupleScheme();
- }
- }
-
- private static class TDropSentryRoleResponseTupleScheme extends TupleScheme<TDropSentryRoleResponse> {
-
- @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 read(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleResponse 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);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesByAuthRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesByAuthRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesByAuthRequest.java
deleted file mode 100644
index 42d23ff..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesByAuthRequest.java
+++ /dev/null
@@ -1,915 +0,0 @@
-/**
- * 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.provider.db.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 TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBase<TListSentryPrivilegesByAuthRequest, TListSentryPrivilegesByAuthRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesByAuthRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesByAuthRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField AUTHORIZABLE_SET_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizableSet", org.apache.thrift.protocol.TType.SET, (short)3);
- private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)4);
- private static final org.apache.thrift.protocol.TField ROLE_SET_FIELD_DESC = new org.apache.thrift.protocol.TField("roleSet", org.apache.thrift.protocol.TType.STRUCT, (short)5);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryPrivilegesByAuthRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryPrivilegesByAuthRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private Set<TSentryAuthorizable> authorizableSet; // required
- private Set<String> groups; // optional
- private TSentryActiveRoleSet roleSet; // optional
-
- /** 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- AUTHORIZABLE_SET((short)3, "authorizableSet"),
- GROUPS((short)4, "groups"),
- ROLE_SET((short)5, "roleSet");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // AUTHORIZABLE_SET
- return AUTHORIZABLE_SET;
- case 4: // GROUPS
- return GROUPS;
- case 5: // ROLE_SET
- return ROLE_SET;
- 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 byte __isset_bitfield = 0;
- private static final _Fields optionals[] = {_Fields.GROUPS,_Fields.ROLE_SET};
- 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.AUTHORIZABLE_SET, new org.apache.thrift.meta_data.FieldMetaData("authorizableSet", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class))));
- tmpMap.put(_Fields.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- tmpMap.put(_Fields.ROLE_SET, new org.apache.thrift.meta_data.FieldMetaData("roleSet", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryActiveRoleSet.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesByAuthRequest.class, metaDataMap);
- }
-
- public TListSentryPrivilegesByAuthRequest() {
- this.protocol_version = 2;
-
- }
-
- public TListSentryPrivilegesByAuthRequest(
- int protocol_version,
- String requestorUserName,
- Set<TSentryAuthorizable> authorizableSet)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.authorizableSet = authorizableSet;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryPrivilegesByAuthRequest(TListSentryPrivilegesByAuthRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetAuthorizableSet()) {
- Set<TSentryAuthorizable> __this__authorizableSet = new HashSet<TSentryAuthorizable>(other.authorizableSet.size());
- for (TSentryAuthorizable other_element : other.authorizableSet) {
- __this__authorizableSet.add(new TSentryAuthorizable(other_element));
- }
- this.authorizableSet = __this__authorizableSet;
- }
- if (other.isSetGroups()) {
- Set<String> __this__groups = new HashSet<String>(other.groups);
- this.groups = __this__groups;
- }
- if (other.isSetRoleSet()) {
- this.roleSet = new TSentryActiveRoleSet(other.roleSet);
- }
- }
-
- public TListSentryPrivilegesByAuthRequest deepCopy() {
- return new TListSentryPrivilegesByAuthRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.authorizableSet = null;
- this.groups = null;
- this.roleSet = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public int getAuthorizableSetSize() {
- return (this.authorizableSet == null) ? 0 : this.authorizableSet.size();
- }
-
- public java.util.Iterator<TSentryAuthorizable> getAuthorizableSetIterator() {
- return (this.authorizableSet == null) ? null : this.authorizableSet.iterator();
- }
-
- public void addToAuthorizableSet(TSentryAuthorizable elem) {
- if (this.authorizableSet == null) {
- this.authorizableSet = new HashSet<TSentryAuthorizable>();
- }
- this.authorizableSet.add(elem);
- }
-
- public Set<TSentryAuthorizable> getAuthorizableSet() {
- return this.authorizableSet;
- }
-
- public void setAuthorizableSet(Set<TSentryAuthorizable> authorizableSet) {
- this.authorizableSet = authorizableSet;
- }
-
- public void unsetAuthorizableSet() {
- this.authorizableSet = null;
- }
-
- /** Returns true if field authorizableSet is set (has been assigned a value) and false otherwise */
- public boolean isSetAuthorizableSet() {
- return this.authorizableSet != null;
- }
-
- public void setAuthorizableSetIsSet(boolean value) {
- if (!value) {
- this.authorizableSet = null;
- }
- }
-
- public int getGroupsSize() {
- return (this.groups == null) ? 0 : this.groups.size();
- }
-
- public java.util.Iterator<String> getGroupsIterator() {
- return (this.groups == null) ? null : this.groups.iterator();
- }
-
- public void addToGroups(String elem) {
- if (this.groups == null) {
- this.groups = new HashSet<String>();
- }
- this.groups.add(elem);
- }
-
- public Set<String> getGroups() {
- return this.groups;
- }
-
- public void setGroups(Set<String> groups) {
- this.groups = groups;
- }
-
- public void unsetGroups() {
- this.groups = null;
- }
-
- /** Returns true if field groups is set (has been assigned a value) and false otherwise */
- public boolean isSetGroups() {
- return this.groups != null;
- }
-
- public void setGroupsIsSet(boolean value) {
- if (!value) {
- this.groups = null;
- }
- }
-
- public TSentryActiveRoleSet getRoleSet() {
- return this.roleSet;
- }
-
- public void setRoleSet(TSentryActiveRoleSet roleSet) {
- this.roleSet = roleSet;
- }
-
- public void unsetRoleSet() {
- this.roleSet = null;
- }
-
- /** Returns true if field roleSet is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleSet() {
- return this.roleSet != null;
- }
-
- public void setRoleSetIsSet(boolean value) {
- if (!value) {
- this.roleSet = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case AUTHORIZABLE_SET:
- if (value == null) {
- unsetAuthorizableSet();
- } else {
- setAuthorizableSet((Set<TSentryAuthorizable>)value);
- }
- break;
-
- case GROUPS:
- if (value == null) {
- unsetGroups();
- } else {
- setGroups((Set<String>)value);
- }
- break;
-
- case ROLE_SET:
- if (value == null) {
- unsetRoleSet();
- } else {
- setRoleSet((TSentryActiveRoleSet)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case AUTHORIZABLE_SET:
- return getAuthorizableSet();
-
- case GROUPS:
- return getGroups();
-
- case ROLE_SET:
- return getRoleSet();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case AUTHORIZABLE_SET:
- return isSetAuthorizableSet();
- case GROUPS:
- return isSetGroups();
- case ROLE_SET:
- return isSetRoleSet();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryPrivilegesByAuthRequest)
- return this.equals((TListSentryPrivilegesByAuthRequest)that);
- return false;
- }
-
- public boolean equals(TListSentryPrivilegesByAuthRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_authorizableSet = true && this.isSetAuthorizableSet();
- boolean that_present_authorizableSet = true && that.isSetAuthorizableSet();
- if (this_present_authorizableSet || that_present_authorizableSet) {
- if (!(this_present_authorizableSet && that_present_authorizableSet))
- return false;
- if (!this.authorizableSet.equals(that.authorizableSet))
- return false;
- }
-
- boolean this_present_groups = true && this.isSetGroups();
- boolean that_present_groups = true && that.isSetGroups();
- if (this_present_groups || that_present_groups) {
- if (!(this_present_groups && that_present_groups))
- return false;
- if (!this.groups.equals(that.groups))
- return false;
- }
-
- boolean this_present_roleSet = true && this.isSetRoleSet();
- boolean that_present_roleSet = true && that.isSetRoleSet();
- if (this_present_roleSet || that_present_roleSet) {
- if (!(this_present_roleSet && that_present_roleSet))
- return false;
- if (!this.roleSet.equals(that.roleSet))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_authorizableSet = true && (isSetAuthorizableSet());
- list.add(present_authorizableSet);
- if (present_authorizableSet)
- list.add(authorizableSet);
-
- boolean present_groups = true && (isSetGroups());
- list.add(present_groups);
- if (present_groups)
- list.add(groups);
-
- boolean present_roleSet = true && (isSetRoleSet());
- list.add(present_roleSet);
- if (present_roleSet)
- list.add(roleSet);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TListSentryPrivilegesByAuthRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetAuthorizableSet()).compareTo(other.isSetAuthorizableSet());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAuthorizableSet()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizableSet, other.authorizableSet);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGroups()).compareTo(other.isSetGroups());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroups()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, other.groups);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleSet()).compareTo(other.isSetRoleSet());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleSet()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleSet, other.roleSet);
- 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("TListSentryPrivilegesByAuthRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("authorizableSet:");
- if (this.authorizableSet == null) {
- sb.append("null");
- } else {
- sb.append(this.authorizableSet);
- }
- first = false;
- if (isSetGroups()) {
- if (!first) sb.append(", ");
- sb.append("groups:");
- if (this.groups == null) {
- sb.append("null");
- } else {
- sb.append(this.groups);
- }
- first = false;
- }
- if (isSetRoleSet()) {
- if (!first) sb.append(", ");
- sb.append("roleSet:");
- if (this.roleSet == null) {
- sb.append("null");
- } else {
- sb.append(this.roleSet);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetAuthorizableSet()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'authorizableSet' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (roleSet != null) {
- roleSet.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 TListSentryPrivilegesByAuthRequestStandardSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesByAuthRequestStandardScheme getScheme() {
- return new TListSentryPrivilegesByAuthRequestStandardScheme();
- }
- }
-
- private static class TListSentryPrivilegesByAuthRequestStandardScheme extends StandardScheme<TListSentryPrivilegesByAuthRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesByAuthRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // AUTHORIZABLE_SET
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set130 = iprot.readSetBegin();
- struct.authorizableSet = new HashSet<TSentryAuthorizable>(2*_set130.size);
- TSentryAuthorizable _elem131;
- for (int _i132 = 0; _i132 < _set130.size; ++_i132)
- {
- _elem131 = new TSentryAuthorizable();
- _elem131.read(iprot);
- struct.authorizableSet.add(_elem131);
- }
- iprot.readSetEnd();
- }
- struct.setAuthorizableSetIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // GROUPS
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set133 = iprot.readSetBegin();
- struct.groups = new HashSet<String>(2*_set133.size);
- String _elem134;
- for (int _i135 = 0; _i135 < _set133.size; ++_i135)
- {
- _elem134 = iprot.readString();
- struct.groups.add(_elem134);
- }
- iprot.readSetEnd();
- }
- struct.setGroupsIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // ROLE_SET
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.roleSet = new TSentryActiveRoleSet();
- struct.roleSet.read(iprot);
- struct.setRoleSetIsSet(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, TListSentryPrivilegesByAuthRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.authorizableSet != null) {
- oprot.writeFieldBegin(AUTHORIZABLE_SET_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.authorizableSet.size()));
- for (TSentryAuthorizable _iter136 : struct.authorizableSet)
- {
- _iter136.write(oprot);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- if (struct.groups != null) {
- if (struct.isSetGroups()) {
- oprot.writeFieldBegin(GROUPS_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.groups.size()));
- for (String _iter137 : struct.groups)
- {
- oprot.writeString(_iter137);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- if (struct.roleSet != null) {
- if (struct.isSetRoleSet()) {
- oprot.writeFieldBegin(ROLE_SET_FIELD_DESC);
- struct.roleSet.write(oprot);
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryPrivilegesByAuthRequestTupleSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesByAuthRequestTupleScheme getScheme() {
- return new TListSentryPrivilegesByAuthRequestTupleScheme();
- }
- }
-
- private static class TListSentryPrivilegesByAuthRequestTupleScheme extends TupleScheme<TListSentryPrivilegesByAuthRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesByAuthRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- {
- oprot.writeI32(struct.authorizableSet.size());
- for (TSentryAuthorizable _iter138 : struct.authorizableSet)
- {
- _iter138.write(oprot);
- }
- }
- BitSet optionals = new BitSet();
- if (struct.isSetGroups()) {
- optionals.set(0);
- }
- if (struct.isSetRoleSet()) {
- optionals.set(1);
- }
- oprot.writeBitSet(optionals, 2);
- if (struct.isSetGroups()) {
- {
- oprot.writeI32(struct.groups.size());
- for (String _iter139 : struct.groups)
- {
- oprot.writeString(_iter139);
- }
- }
- }
- if (struct.isSetRoleSet()) {
- struct.roleSet.write(oprot);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesByAuthRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set140 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.authorizableSet = new HashSet<TSentryAuthorizable>(2*_set140.size);
- TSentryAuthorizable _elem141;
- for (int _i142 = 0; _i142 < _set140.size; ++_i142)
- {
- _elem141 = new TSentryAuthorizable();
- _elem141.read(iprot);
- struct.authorizableSet.add(_elem141);
- }
- }
- struct.setAuthorizableSetIsSet(true);
- BitSet incoming = iprot.readBitSet(2);
- if (incoming.get(0)) {
- {
- org.apache.thrift.protocol.TSet _set143 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.groups = new HashSet<String>(2*_set143.size);
- String _elem144;
- for (int _i145 = 0; _i145 < _set143.size; ++_i145)
- {
- _elem144 = iprot.readString();
- struct.groups.add(_elem144);
- }
- }
- struct.setGroupsIsSet(true);
- }
- if (incoming.get(1)) {
- struct.roleSet = new TSentryActiveRoleSet();
- struct.roleSet.read(iprot);
- struct.setRoleSetIsSet(true);
- }
- }
- }
-
-}
-
[10/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/SentryGenericPolicyService.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/SentryGenericPolicyService.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/SentryGenericPolicyService.java
new file mode 100644
index 0000000..d647903
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/SentryGenericPolicyService.java
@@ -0,0 +1,10416 @@
+/**
+ * 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.generic.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 SentryGenericPolicyService {
+
+ public interface Iface {
+
+ public TCreateSentryRoleResponse create_sentry_role(TCreateSentryRoleRequest request) throws org.apache.thrift.TException;
+
+ public TDropSentryRoleResponse drop_sentry_role(TDropSentryRoleRequest request) throws org.apache.thrift.TException;
+
+ public TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request) throws org.apache.thrift.TException;
+
+ public TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request) throws org.apache.thrift.TException;
+
+ public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request) throws org.apache.thrift.TException;
+
+ public TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request) throws org.apache.thrift.TException;
+
+ public TListSentryRolesResponse list_sentry_roles_by_group(TListSentryRolesRequest request) throws org.apache.thrift.TException;
+
+ public TListSentryPrivilegesResponse list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException;
+
+ public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException;
+
+ public TListSentryPrivilegesByAuthResponse list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request) throws org.apache.thrift.TException;
+
+ public TDropPrivilegesResponse drop_sentry_privilege(TDropPrivilegesRequest request) throws org.apache.thrift.TException;
+
+ public TRenamePrivilegesResponse rename_sentry_privilege(TRenamePrivilegesRequest request) throws org.apache.thrift.TException;
+
+ }
+
+ public interface AsyncIface {
+
+ public void create_sentry_role(TCreateSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void drop_sentry_role(TDropSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void list_sentry_roles_by_group(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void list_sentry_privileges_by_role(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void drop_sentry_privilege(TDropPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void rename_sentry_privilege(TRenamePrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ }
+
+ public static class Client extends org.apache.thrift.TServiceClient implements Iface {
+ public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
+ public Factory() {}
+ public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
+ return new Client(prot);
+ }
+ public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+ return new Client(iprot, oprot);
+ }
+ }
+
+ public Client(org.apache.thrift.protocol.TProtocol prot)
+ {
+ super(prot, prot);
+ }
+
+ public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+ super(iprot, oprot);
+ }
+
+ public TCreateSentryRoleResponse create_sentry_role(TCreateSentryRoleRequest request) throws org.apache.thrift.TException
+ {
+ send_create_sentry_role(request);
+ return recv_create_sentry_role();
+ }
+
+ public void send_create_sentry_role(TCreateSentryRoleRequest request) throws org.apache.thrift.TException
+ {
+ create_sentry_role_args args = new create_sentry_role_args();
+ args.setRequest(request);
+ sendBase("create_sentry_role", args);
+ }
+
+ public TCreateSentryRoleResponse recv_create_sentry_role() throws org.apache.thrift.TException
+ {
+ create_sentry_role_result result = new create_sentry_role_result();
+ receiveBase(result, "create_sentry_role");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "create_sentry_role failed: unknown result");
+ }
+
+ public TDropSentryRoleResponse drop_sentry_role(TDropSentryRoleRequest request) throws org.apache.thrift.TException
+ {
+ send_drop_sentry_role(request);
+ return recv_drop_sentry_role();
+ }
+
+ public void send_drop_sentry_role(TDropSentryRoleRequest request) throws org.apache.thrift.TException
+ {
+ drop_sentry_role_args args = new drop_sentry_role_args();
+ args.setRequest(request);
+ sendBase("drop_sentry_role", args);
+ }
+
+ public TDropSentryRoleResponse recv_drop_sentry_role() throws org.apache.thrift.TException
+ {
+ drop_sentry_role_result result = new drop_sentry_role_result();
+ receiveBase(result, "drop_sentry_role");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "drop_sentry_role failed: unknown result");
+ }
+
+ public TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request) throws org.apache.thrift.TException
+ {
+ send_alter_sentry_role_grant_privilege(request);
+ return recv_alter_sentry_role_grant_privilege();
+ }
+
+ public void send_alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request) throws org.apache.thrift.TException
+ {
+ alter_sentry_role_grant_privilege_args args = new alter_sentry_role_grant_privilege_args();
+ args.setRequest(request);
+ sendBase("alter_sentry_role_grant_privilege", args);
+ }
+
+ public TAlterSentryRoleGrantPrivilegeResponse recv_alter_sentry_role_grant_privilege() throws org.apache.thrift.TException
+ {
+ alter_sentry_role_grant_privilege_result result = new alter_sentry_role_grant_privilege_result();
+ receiveBase(result, "alter_sentry_role_grant_privilege");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_grant_privilege failed: unknown result");
+ }
+
+ public TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request) throws org.apache.thrift.TException
+ {
+ send_alter_sentry_role_revoke_privilege(request);
+ return recv_alter_sentry_role_revoke_privilege();
+ }
+
+ public void send_alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request) throws org.apache.thrift.TException
+ {
+ alter_sentry_role_revoke_privilege_args args = new alter_sentry_role_revoke_privilege_args();
+ args.setRequest(request);
+ sendBase("alter_sentry_role_revoke_privilege", args);
+ }
+
+ public TAlterSentryRoleRevokePrivilegeResponse recv_alter_sentry_role_revoke_privilege() throws org.apache.thrift.TException
+ {
+ alter_sentry_role_revoke_privilege_result result = new alter_sentry_role_revoke_privilege_result();
+ receiveBase(result, "alter_sentry_role_revoke_privilege");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_revoke_privilege failed: unknown result");
+ }
+
+ public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request) throws org.apache.thrift.TException
+ {
+ send_alter_sentry_role_add_groups(request);
+ return recv_alter_sentry_role_add_groups();
+ }
+
+ public void send_alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request) throws org.apache.thrift.TException
+ {
+ alter_sentry_role_add_groups_args args = new alter_sentry_role_add_groups_args();
+ args.setRequest(request);
+ sendBase("alter_sentry_role_add_groups", args);
+ }
+
+ public TAlterSentryRoleAddGroupsResponse recv_alter_sentry_role_add_groups() throws org.apache.thrift.TException
+ {
+ alter_sentry_role_add_groups_result result = new alter_sentry_role_add_groups_result();
+ receiveBase(result, "alter_sentry_role_add_groups");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_add_groups failed: unknown result");
+ }
+
+ public TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request) throws org.apache.thrift.TException
+ {
+ send_alter_sentry_role_delete_groups(request);
+ return recv_alter_sentry_role_delete_groups();
+ }
+
+ public void send_alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request) throws org.apache.thrift.TException
+ {
+ alter_sentry_role_delete_groups_args args = new alter_sentry_role_delete_groups_args();
+ args.setRequest(request);
+ sendBase("alter_sentry_role_delete_groups", args);
+ }
+
+ public TAlterSentryRoleDeleteGroupsResponse recv_alter_sentry_role_delete_groups() throws org.apache.thrift.TException
+ {
+ alter_sentry_role_delete_groups_result result = new alter_sentry_role_delete_groups_result();
+ receiveBase(result, "alter_sentry_role_delete_groups");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_delete_groups failed: unknown result");
+ }
+
+ public TListSentryRolesResponse list_sentry_roles_by_group(TListSentryRolesRequest request) throws org.apache.thrift.TException
+ {
+ send_list_sentry_roles_by_group(request);
+ return recv_list_sentry_roles_by_group();
+ }
+
+ public void send_list_sentry_roles_by_group(TListSentryRolesRequest request) throws org.apache.thrift.TException
+ {
+ list_sentry_roles_by_group_args args = new list_sentry_roles_by_group_args();
+ args.setRequest(request);
+ sendBase("list_sentry_roles_by_group", args);
+ }
+
+ public TListSentryRolesResponse recv_list_sentry_roles_by_group() throws org.apache.thrift.TException
+ {
+ list_sentry_roles_by_group_result result = new list_sentry_roles_by_group_result();
+ receiveBase(result, "list_sentry_roles_by_group");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_roles_by_group failed: unknown result");
+ }
+
+ public TListSentryPrivilegesResponse list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException
+ {
+ send_list_sentry_privileges_by_role(request);
+ return recv_list_sentry_privileges_by_role();
+ }
+
+ public void send_list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException
+ {
+ list_sentry_privileges_by_role_args args = new list_sentry_privileges_by_role_args();
+ args.setRequest(request);
+ sendBase("list_sentry_privileges_by_role", args);
+ }
+
+ public TListSentryPrivilegesResponse recv_list_sentry_privileges_by_role() throws org.apache.thrift.TException
+ {
+ list_sentry_privileges_by_role_result result = new list_sentry_privileges_by_role_result();
+ receiveBase(result, "list_sentry_privileges_by_role");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_privileges_by_role failed: unknown result");
+ }
+
+ public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException
+ {
+ send_list_sentry_privileges_for_provider(request);
+ return recv_list_sentry_privileges_for_provider();
+ }
+
+ public void send_list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException
+ {
+ list_sentry_privileges_for_provider_args args = new list_sentry_privileges_for_provider_args();
+ args.setRequest(request);
+ sendBase("list_sentry_privileges_for_provider", args);
+ }
+
+ public TListSentryPrivilegesForProviderResponse recv_list_sentry_privileges_for_provider() throws org.apache.thrift.TException
+ {
+ list_sentry_privileges_for_provider_result result = new list_sentry_privileges_for_provider_result();
+ receiveBase(result, "list_sentry_privileges_for_provider");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_privileges_for_provider failed: unknown result");
+ }
+
+ public TListSentryPrivilegesByAuthResponse list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request) throws org.apache.thrift.TException
+ {
+ send_list_sentry_privileges_by_authorizable(request);
+ return recv_list_sentry_privileges_by_authorizable();
+ }
+
+ public void send_list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request) throws org.apache.thrift.TException
+ {
+ list_sentry_privileges_by_authorizable_args args = new list_sentry_privileges_by_authorizable_args();
+ args.setRequest(request);
+ sendBase("list_sentry_privileges_by_authorizable", args);
+ }
+
+ public TListSentryPrivilegesByAuthResponse recv_list_sentry_privileges_by_authorizable() throws org.apache.thrift.TException
+ {
+ list_sentry_privileges_by_authorizable_result result = new list_sentry_privileges_by_authorizable_result();
+ receiveBase(result, "list_sentry_privileges_by_authorizable");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_privileges_by_authorizable failed: unknown result");
+ }
+
+ public TDropPrivilegesResponse drop_sentry_privilege(TDropPrivilegesRequest request) throws org.apache.thrift.TException
+ {
+ send_drop_sentry_privilege(request);
+ return recv_drop_sentry_privilege();
+ }
+
+ public void send_drop_sentry_privilege(TDropPrivilegesRequest request) throws org.apache.thrift.TException
+ {
+ drop_sentry_privilege_args args = new drop_sentry_privilege_args();
+ args.setRequest(request);
+ sendBase("drop_sentry_privilege", args);
+ }
+
+ public TDropPrivilegesResponse recv_drop_sentry_privilege() throws org.apache.thrift.TException
+ {
+ drop_sentry_privilege_result result = new drop_sentry_privilege_result();
+ receiveBase(result, "drop_sentry_privilege");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "drop_sentry_privilege failed: unknown result");
+ }
+
+ public TRenamePrivilegesResponse rename_sentry_privilege(TRenamePrivilegesRequest request) throws org.apache.thrift.TException
+ {
+ send_rename_sentry_privilege(request);
+ return recv_rename_sentry_privilege();
+ }
+
+ public void send_rename_sentry_privilege(TRenamePrivilegesRequest request) throws org.apache.thrift.TException
+ {
+ rename_sentry_privilege_args args = new rename_sentry_privilege_args();
+ args.setRequest(request);
+ sendBase("rename_sentry_privilege", args);
+ }
+
+ public TRenamePrivilegesResponse recv_rename_sentry_privilege() throws org.apache.thrift.TException
+ {
+ rename_sentry_privilege_result result = new rename_sentry_privilege_result();
+ receiveBase(result, "rename_sentry_privilege");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "rename_sentry_privilege 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> {
+ private org.apache.thrift.async.TAsyncClientManager clientManager;
+ private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
+ public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
+ this.clientManager = clientManager;
+ this.protocolFactory = protocolFactory;
+ }
+ public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
+ return new AsyncClient(protocolFactory, clientManager, transport);
+ }
+ }
+
+ public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
+ super(protocolFactory, clientManager, transport);
+ }
+
+ public void create_sentry_role(TCreateSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ create_sentry_role_call method_call = new create_sentry_role_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class create_sentry_role_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TCreateSentryRoleRequest request;
+ public create_sentry_role_call(TCreateSentryRoleRequest 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("create_sentry_role", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ create_sentry_role_args args = new create_sentry_role_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TCreateSentryRoleResponse 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_create_sentry_role();
+ }
+ }
+
+ public void drop_sentry_role(TDropSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ drop_sentry_role_call method_call = new drop_sentry_role_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class drop_sentry_role_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TDropSentryRoleRequest request;
+ public drop_sentry_role_call(TDropSentryRoleRequest 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("drop_sentry_role", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ drop_sentry_role_args args = new drop_sentry_role_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TDropSentryRoleResponse 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_drop_sentry_role();
+ }
+ }
+
+ public void alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ alter_sentry_role_grant_privilege_call method_call = new alter_sentry_role_grant_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class alter_sentry_role_grant_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TAlterSentryRoleGrantPrivilegeRequest request;
+ public alter_sentry_role_grant_privilege_call(TAlterSentryRoleGrantPrivilegeRequest 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("alter_sentry_role_grant_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ alter_sentry_role_grant_privilege_args args = new alter_sentry_role_grant_privilege_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TAlterSentryRoleGrantPrivilegeResponse 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_alter_sentry_role_grant_privilege();
+ }
+ }
+
+ public void alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ alter_sentry_role_revoke_privilege_call method_call = new alter_sentry_role_revoke_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class alter_sentry_role_revoke_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TAlterSentryRoleRevokePrivilegeRequest request;
+ public alter_sentry_role_revoke_privilege_call(TAlterSentryRoleRevokePrivilegeRequest 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("alter_sentry_role_revoke_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ alter_sentry_role_revoke_privilege_args args = new alter_sentry_role_revoke_privilege_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TAlterSentryRoleRevokePrivilegeResponse 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_alter_sentry_role_revoke_privilege();
+ }
+ }
+
+ public void alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ alter_sentry_role_add_groups_call method_call = new alter_sentry_role_add_groups_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class alter_sentry_role_add_groups_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TAlterSentryRoleAddGroupsRequest request;
+ public alter_sentry_role_add_groups_call(TAlterSentryRoleAddGroupsRequest 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("alter_sentry_role_add_groups", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ alter_sentry_role_add_groups_args args = new alter_sentry_role_add_groups_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TAlterSentryRoleAddGroupsResponse 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_alter_sentry_role_add_groups();
+ }
+ }
+
+ public void alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ alter_sentry_role_delete_groups_call method_call = new alter_sentry_role_delete_groups_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class alter_sentry_role_delete_groups_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TAlterSentryRoleDeleteGroupsRequest request;
+ public alter_sentry_role_delete_groups_call(TAlterSentryRoleDeleteGroupsRequest 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("alter_sentry_role_delete_groups", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ alter_sentry_role_delete_groups_args args = new alter_sentry_role_delete_groups_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TAlterSentryRoleDeleteGroupsResponse 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_alter_sentry_role_delete_groups();
+ }
+ }
+
+ public void list_sentry_roles_by_group(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ list_sentry_roles_by_group_call method_call = new list_sentry_roles_by_group_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class list_sentry_roles_by_group_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TListSentryRolesRequest request;
+ public list_sentry_roles_by_group_call(TListSentryRolesRequest 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("list_sentry_roles_by_group", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ list_sentry_roles_by_group_args args = new list_sentry_roles_by_group_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TListSentryRolesResponse 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_list_sentry_roles_by_group();
+ }
+ }
+
+ public void list_sentry_privileges_by_role(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ list_sentry_privileges_by_role_call method_call = new list_sentry_privileges_by_role_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class list_sentry_privileges_by_role_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TListSentryPrivilegesRequest request;
+ public list_sentry_privileges_by_role_call(TListSentryPrivilegesRequest 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("list_sentry_privileges_by_role", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ list_sentry_privileges_by_role_args args = new list_sentry_privileges_by_role_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TListSentryPrivilegesResponse 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_list_sentry_privileges_by_role();
+ }
+ }
+
+ public void list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ list_sentry_privileges_for_provider_call method_call = new list_sentry_privileges_for_provider_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class list_sentry_privileges_for_provider_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TListSentryPrivilegesForProviderRequest request;
+ public list_sentry_privileges_for_provider_call(TListSentryPrivilegesForProviderRequest 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("list_sentry_privileges_for_provider", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ list_sentry_privileges_for_provider_args args = new list_sentry_privileges_for_provider_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TListSentryPrivilegesForProviderResponse 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_list_sentry_privileges_for_provider();
+ }
+ }
+
+ public void list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ list_sentry_privileges_by_authorizable_call method_call = new list_sentry_privileges_by_authorizable_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class list_sentry_privileges_by_authorizable_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TListSentryPrivilegesByAuthRequest request;
+ public list_sentry_privileges_by_authorizable_call(TListSentryPrivilegesByAuthRequest 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("list_sentry_privileges_by_authorizable", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ list_sentry_privileges_by_authorizable_args args = new list_sentry_privileges_by_authorizable_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TListSentryPrivilegesByAuthResponse 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_list_sentry_privileges_by_authorizable();
+ }
+ }
+
+ public void drop_sentry_privilege(TDropPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ drop_sentry_privilege_call method_call = new drop_sentry_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class drop_sentry_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TDropPrivilegesRequest request;
+ public drop_sentry_privilege_call(TDropPrivilegesRequest 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("drop_sentry_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ drop_sentry_privilege_args args = new drop_sentry_privilege_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TDropPrivilegesResponse 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_drop_sentry_privilege();
+ }
+ }
+
+ public void rename_sentry_privilege(TRenamePrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ rename_sentry_privilege_call method_call = new rename_sentry_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class rename_sentry_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TRenamePrivilegesRequest request;
+ public rename_sentry_privilege_call(TRenamePrivilegesRequest 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("rename_sentry_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ rename_sentry_privilege_args args = new rename_sentry_privilege_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TRenamePrivilegesResponse 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_rename_sentry_privilege();
+ }
+ }
+
+ }
+
+ public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
+ private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
+ public Processor(I iface) {
+ super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
+ }
+
+ protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
+ super(iface, getProcessMap(processMap));
+ }
+
+ private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
+ processMap.put("create_sentry_role", new create_sentry_role());
+ processMap.put("drop_sentry_role", new drop_sentry_role());
+ processMap.put("alter_sentry_role_grant_privilege", new alter_sentry_role_grant_privilege());
+ processMap.put("alter_sentry_role_revoke_privilege", new alter_sentry_role_revoke_privilege());
+ processMap.put("alter_sentry_role_add_groups", new alter_sentry_role_add_groups());
+ processMap.put("alter_sentry_role_delete_groups", new alter_sentry_role_delete_groups());
+ processMap.put("list_sentry_roles_by_group", new list_sentry_roles_by_group());
+ processMap.put("list_sentry_privileges_by_role", new list_sentry_privileges_by_role());
+ processMap.put("list_sentry_privileges_for_provider", new list_sentry_privileges_for_provider());
+ processMap.put("list_sentry_privileges_by_authorizable", new list_sentry_privileges_by_authorizable());
+ processMap.put("drop_sentry_privilege", new drop_sentry_privilege());
+ processMap.put("rename_sentry_privilege", new rename_sentry_privilege());
+ return processMap;
+ }
+
+ public static class create_sentry_role<I extends Iface> extends org.apache.thrift.ProcessFunction<I, create_sentry_role_args> {
+ public create_sentry_role() {
+ super("create_sentry_role");
+ }
+
+ public create_sentry_role_args getEmptyArgsInstance() {
+ return new create_sentry_role_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public create_sentry_role_result getResult(I iface, create_sentry_role_args args) throws org.apache.thrift.TException {
+ create_sentry_role_result result = new create_sentry_role_result();
+ result.success = iface.create_sentry_role(args.request);
+ return result;
+ }
+ }
+
+ public static class drop_sentry_role<I extends Iface> extends org.apache.thrift.ProcessFunction<I, drop_sentry_role_args> {
+ public drop_sentry_role() {
+ super("drop_sentry_role");
+ }
+
+ public drop_sentry_role_args getEmptyArgsInstance() {
+ return new drop_sentry_role_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public drop_sentry_role_result getResult(I iface, drop_sentry_role_args args) throws org.apache.thrift.TException {
+ drop_sentry_role_result result = new drop_sentry_role_result();
+ result.success = iface.drop_sentry_role(args.request);
+ return result;
+ }
+ }
+
+ public static class alter_sentry_role_grant_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_grant_privilege_args> {
+ public alter_sentry_role_grant_privilege() {
+ super("alter_sentry_role_grant_privilege");
+ }
+
+ public alter_sentry_role_grant_privilege_args getEmptyArgsInstance() {
+ return new alter_sentry_role_grant_privilege_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public alter_sentry_role_grant_privilege_result getResult(I iface, alter_sentry_role_grant_privilege_args args) throws org.apache.thrift.TException {
+ alter_sentry_role_grant_privilege_result result = new alter_sentry_role_grant_privilege_result();
+ result.success = iface.alter_sentry_role_grant_privilege(args.request);
+ return result;
+ }
+ }
+
+ public static class alter_sentry_role_revoke_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_revoke_privilege_args> {
+ public alter_sentry_role_revoke_privilege() {
+ super("alter_sentry_role_revoke_privilege");
+ }
+
+ public alter_sentry_role_revoke_privilege_args getEmptyArgsInstance() {
+ return new alter_sentry_role_revoke_privilege_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public alter_sentry_role_revoke_privilege_result getResult(I iface, alter_sentry_role_revoke_privilege_args args) throws org.apache.thrift.TException {
+ alter_sentry_role_revoke_privilege_result result = new alter_sentry_role_revoke_privilege_result();
+ result.success = iface.alter_sentry_role_revoke_privilege(args.request);
+ return result;
+ }
+ }
+
+ public static class alter_sentry_role_add_groups<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_add_groups_args> {
+ public alter_sentry_role_add_groups() {
+ super("alter_sentry_role_add_groups");
+ }
+
+ public alter_sentry_role_add_groups_args getEmptyArgsInstance() {
+ return new alter_sentry_role_add_groups_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public alter_sentry_role_add_groups_result getResult(I iface, alter_sentry_role_add_groups_args args) throws org.apache.thrift.TException {
+ alter_sentry_role_add_groups_result result = new alter_sentry_role_add_groups_result();
+ result.success = iface.alter_sentry_role_add_groups(args.request);
+ return result;
+ }
+ }
+
+ public static class alter_sentry_role_delete_groups<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_delete_groups_args> {
+ public alter_sentry_role_delete_groups() {
+ super("alter_sentry_role_delete_groups");
+ }
+
+ public alter_sentry_role_delete_groups_args getEmptyArgsInstance() {
+ return new alter_sentry_role_delete_groups_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public alter_sentry_role_delete_groups_result getResult(I iface, alter_sentry_role_delete_groups_args args) throws org.apache.thrift.TException {
+ alter_sentry_role_delete_groups_result result = new alter_sentry_role_delete_groups_result();
+ result.success = iface.alter_sentry_role_delete_groups(args.request);
+ return result;
+ }
+ }
+
+ public static class list_sentry_roles_by_group<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_roles_by_group_args> {
+ public list_sentry_roles_by_group() {
+ super("list_sentry_roles_by_group");
+ }
+
+ public list_sentry_roles_by_group_args getEmptyArgsInstance() {
+ return new list_sentry_roles_by_group_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public list_sentry_roles_by_group_result getResult(I iface, list_sentry_roles_by_group_args args) throws org.apache.thrift.TException {
+ list_sentry_roles_by_group_result result = new list_sentry_roles_by_group_result();
+ result.success = iface.list_sentry_roles_by_group(args.request);
+ return result;
+ }
+ }
+
+ public static class list_sentry_privileges_by_role<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_privileges_by_role_args> {
+ public list_sentry_privileges_by_role() {
+ super("list_sentry_privileges_by_role");
+ }
+
+ public list_sentry_privileges_by_role_args getEmptyArgsInstance() {
+ return new list_sentry_privileges_by_role_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public list_sentry_privileges_by_role_result getResult(I iface, list_sentry_privileges_by_role_args args) throws org.apache.thrift.TException {
+ list_sentry_privileges_by_role_result result = new list_sentry_privileges_by_role_result();
+ result.success = iface.list_sentry_privileges_by_role(args.request);
+ return result;
+ }
+ }
+
+ public static class list_sentry_privileges_for_provider<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_privileges_for_provider_args> {
+ public list_sentry_privileges_for_provider() {
+ super("list_sentry_privileges_for_provider");
+ }
+
+ public list_sentry_privileges_for_provider_args getEmptyArgsInstance() {
+ return new list_sentry_privileges_for_provider_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public list_sentry_privileges_for_provider_result getResult(I iface, list_sentry_privileges_for_provider_args args) throws org.apache.thrift.TException {
+ list_sentry_privileges_for_provider_result result = new list_sentry_privileges_for_provider_result();
+ result.success = iface.list_sentry_privileges_for_provider(args.request);
+ return result;
+ }
+ }
+
+ public static class list_sentry_privileges_by_authorizable<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_privileges_by_authorizable_args> {
+ public list_sentry_privileges_by_authorizable() {
+ super("list_sentry_privileges_by_authorizable");
+ }
+
+ public list_sentry_privileges_by_authorizable_args getEmptyArgsInstance() {
+ return new list_sentry_privileges_by_authorizable_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public list_sentry_privileges_by_authorizable_result getResult(I iface, list_sentry_privileges_by_authorizable_args args) throws org.apache.thrift.TException {
+ list_sentry_privileges_by_authorizable_result result = new list_sentry_privileges_by_authorizable_result();
+ result.success = iface.list_sentry_privileges_by_authorizable(args.request);
+ return result;
+ }
+ }
+
+ public static class drop_sentry_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, drop_sentry_privilege_args> {
+ public drop_sentry_privilege() {
+ super("drop_sentry_privilege");
+ }
+
+ public drop_sentry_privilege_args getEmptyArgsInstance() {
+ return new drop_sentry_privilege_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public drop_sentry_privilege_result getResult(I iface, drop_sentry_privilege_args args) throws org.apache.thrift.TException {
+ drop_sentry_privilege_result result = new drop_sentry_privilege_result();
+ result.success = iface.drop_sentry_privilege(args.request);
+ return result;
+ }
+ }
+
+ public static class rename_sentry_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, rename_sentry_privilege_args> {
+ public rename_sentry_privilege() {
+ super("rename_sentry_privilege");
+ }
+
+ public rename_sentry_privilege_args getEmptyArgsInstance() {
+ return new rename_sentry_privilege_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public rename_sentry_privilege_result getResult(I iface, rename_sentry_privilege_args args) throws org.apache.thrift.TException {
+ rename_sentry_privilege_result result = new rename_sentry_privilege_result();
+ result.success = iface.rename_sentry_privilege(args.request);
+ return result;
+ }
+ }
+
+ }
+
+ public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
+ private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
+ public AsyncProcessor(I iface) {
+ super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
+ }
+
+ protected AsyncProcessor(I iface, Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
+ super(iface, getProcessMap(processMap));
+ }
+
+ private static <I extends AsyncIface> Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase,?>> getProcessMap(Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
+ processMap.put("create_sentry_role", new create_sentry_role());
+ processMap.put("drop_sentry_role", new drop_sentry_role());
+ processMap.put("alter_sentry_role_grant_privilege", new alter_sentry_role_grant_privilege());
+ processMap.put("alter_sentry_role_revoke_privilege", new alter_sentry_role_revoke_privilege());
+ processMap.put("alter_sentry_role_add_groups", new alter_sentry_role_add_groups());
+ processMap.put("alter_sentry_role_delete_groups", new alter_sentry_role_delete_groups());
+ processMap.put("list_sentry_roles_by_group", new list_sentry_roles_by_group());
+ processMap.put("list_sentry_privileges_by_role", new list_sentry_privileges_by_role());
+ processMap.put("list_sentry_privileges_for_provider", new list_sentry_privileges_for_provider());
+ processMap.put("list_sentry_privileges_by_authorizable", new list_sentry_privileges_by_authorizable());
+ processMap.put("drop_sentry_privilege", new drop_sentry_privilege());
+ processMap.put("rename_sentry_privilege", new rename_sentry_privilege());
+ return processMap;
+ }
+
+ public static class create_sentry_role<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, create_sentry_role_args, TCreateSentryRoleResponse> {
+ public create_sentry_role() {
+ super("create_sentry_role");
+ }
+
+ public create_sentry_role_args getEmptyArgsInstance() {
+ return new create_sentry_role_args();
+ }
+
+ public AsyncMethodCallback<TCreateSentryRoleResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<TCreateSentryRoleResponse>() {
+ public void onComplete(TCreateSentryRoleResponse o) {
+ create_sentry_role_result result = new create_sentry_role_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;
+ create_sentry_role_result result = new create_sentry_role_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, create_sentry_role_args args, org.apache.thrift.async.AsyncMethodCallback<TCreateSentryRoleResponse> resultHandler) throws TException {
+ iface.create_sentry_role(args.request,resultHandler);
+ }
+ }
+
+ public static class drop_sentry_role<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, drop_sentry_role_args, TDropSentryRoleResponse> {
+ public drop_sentry_role() {
+ super("drop_sentry_role");
+ }
+
+ public drop_sentry_role_args getEmptyArgsInstance() {
+ return new drop_sentry_role_args();
+ }
+
+ public AsyncMethodCallback<TDropSentryRoleResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<TDropSentryRoleResponse>() {
+ public void onComplete(TDropSentryRoleResponse o) {
+ drop_sentry_role_result result = new drop_sentry_role_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;
+ drop_sentry_role_result result = new drop_sentry_role_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, drop_sentry_role_args args, org.apache.thrift.async.AsyncMethodCallback<TDropSentryRoleResponse> resultHandler) throws TException {
+ iface.drop_sentry_role(args.request,resultHandler);
+ }
+ }
+
+ public static class alter_sentry_role_grant_privilege<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, alter_sentry_role_grant_privilege_args, TAlterSentryRoleGrantPrivilegeResponse> {
+ public alter_sentry_role_grant_privilege() {
+ super("alter_sentry_role_grant_privilege");
+ }
+
+ public alter_sentry_role_grant_privilege_args getEmptyArgsInstance() {
+ return new alter_sentry_role_grant_privilege_args();
+ }
+
+ public AsyncMethodCallback<TAlterSentryRoleGrantPrivilegeResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<TAlterSentryRoleGrantPrivilegeResponse>() {
+ public void onComplete(TAlterSentryRoleGrantPrivilegeResponse o) {
+ alter_sentry_role_grant_privilege_result result = new alter_sentry_role_grant_privilege_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;
+ alter_sentry_role_grant_privilege_result result = new alter_sentry_role_grant_privilege_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, alter_sentry_role_grant_privilege_args args, org.apache.thrift.async.AsyncMethodCallback<TAlterSentryRoleGrantPrivilegeResponse> resultHandler) throws TException {
+ iface.alter_sentry_role_grant_privilege(args.request,resultHandler);
+ }
+ }
+
+ public static class alter_sentry_role_revoke_privilege<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, alter_sentry_role_revoke_privilege_args, TAlterSentryRoleRevokePrivilegeResponse> {
+ public alter_sentry_role_revoke_privilege() {
+ super("alter_sentry_role_revoke_privilege");
+ }
+
+ public alter_sentry_role_revoke_privilege_args getEmptyArgsInstance() {
+ return new alter_sentry_role_revoke_privilege_args();
+ }
+
+ public AsyncMethodCallback<TAlterSentryRoleRevokePrivilegeResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<TAlterSentryRoleRevokePrivilegeResponse>() {
+ public void onComplete(TAlterSentryRoleRevokePrivilegeResponse o) {
+ alter_sentry_role_revoke_privilege_result result = new alter_sentry_role_revoke_privilege_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;
+ alter_sentry_role_revoke_privilege_result result = new alter_sentry_role_revoke_privilege_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, alter_sentry_role_revoke_privilege_args args, org.apache.thrift.async.AsyncMethodCallback<TAlterSentryRoleRevokePrivilegeResponse> resultHandler) throws TException {
+ iface.alter_sentry_role_revoke_privilege(args.request,resultHandler);
+ }
+ }
+
+ public static class alter_sentry_role_add_groups<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, alter_sentry_role_add_groups_args, TAlterSentryRoleAddGroupsResponse> {
+ public alter_sentry_role_add_groups() {
+ super("alter_sentry_role_add_groups");
+ }
+
+ public alter_sentry_role_add_groups_args getEmptyArgsInstance() {
+ return new alter_sentry_role_add_groups_args();
+ }
+
+ public AsyncMethodCallback<TAlterSentryRoleAddGroupsResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<TAlterSentryRoleAddGroupsResponse>() {
+ public void onComplete(TAlterSentryRoleAddGroupsResponse o) {
+ alter_sentry_role_add_groups_result result = new alter_sentry_role_add_groups_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;
+ alter_sentry_role_add_groups_result result = new alter_sentry_role_add_groups_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, alter_sentry_role_add_groups_args args, org.apache.thrift.async.AsyncMethodCallback<TAlterSentryRoleAddGroupsResponse> resultHandler) throws TException {
+ iface.alter_sentry_role_add_groups(args.request,resultHandler);
+ }
+ }
+
+ public static class alter_sentry_role_delete_groups<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, alter_sentry_role_delete_groups_args, TAlterSentryRoleDeleteGroupsResponse> {
+ public alter_sentry_role_delete_groups() {
+ super("alter_sentry_role_delete_groups");
+ }
+
+ public alter_sentry_role_delete_groups_args getEmptyArgsInstance() {
+ return new alter_sentry_role_delete_groups_args();
+ }
+
+ public AsyncMethodCallback<TAlterSentryRoleDeleteGroupsResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<TAlterSentryRoleDeleteGroupsResponse>() {
+ public void onComplete(TAlterSentryRoleDeleteGroupsResponse o) {
+ alter_sentry_role_delete_groups_result result = new alter_sentry_role_delete_groups_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;
+ alter_sentry_role_delete_groups_result result = new alter_sentry_role_delete_groups_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, alter_sentry_role_delete_groups_args args, org.apache.thrift.async.AsyncMethodCallback<TAlterSentryRoleDeleteGroupsResponse> resultHandler) throws TException {
+ iface.alter_sentry_role_delete_groups(args.request,resultHandler);
+ }
+ }
+
+ public static class list_sentry_roles_by_group<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, list_sentry_roles_by_group_args, TListSentryRolesResponse> {
+ public list_sentry_roles_by_group() {
+ super("list_sentry_roles_by_group");
+ }
+
+ public list_sentry_roles_by_group_args getEmptyArgsInstance() {
+ return new list_sentry_roles_by_group_args();
+ }
+
+ public AsyncMethodCallback<TListSentryRolesResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<TListSentryRolesResponse>() {
+ public void onComplete(TListSentryRolesResponse o) {
+ list_sentry_roles_by_group_result result = new list_sentry_roles_by_group_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;
+ list_sentry_roles_by_group_result result = new list_sentry_roles_by_group_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, list_sentry_roles_by_group_args args, org.apache.thrift.async.AsyncMethodCallback<TListSentryRolesResponse> resultHandler) throws TException {
+ iface.list_sentry_roles_by_group(args.request,resultHandler);
+ }
+ }
+
+ public static class list_sentry_privileges_by_role<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, list_sentry_privileges_by_role_args, TListSentryPrivilegesResponse> {
+ public list_sentry_privileges_by_role() {
+ super("list_sentry_privileges_by_role");
+ }
+
+ public list_sentry_privileges_by_role_args getEmptyArgsInstance() {
+ return new list_sentry_privileges_by_role_args();
+ }
+
+ public AsyncMethodCallback<TListSentryPrivilegesResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<TListSentryPrivilegesResponse>() {
+ public void onComplete(TListSentryPrivilegesResponse o) {
+ list_sentry_privileges_by_role_result result = new list_sentry_privileges_by_role_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;
+ list_sentry_privileges_by_role_result result = new list_sentry_privileges_by_role_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, list_sentry_privileges_by_role_args args, org.apache.thrift.async.AsyncMethodCallback<TListSentryPrivilegesResponse> resultHandler) throws TException {
+ iface.list_sentry_privileges_by_role(args.request,resultHandler);
+ }
+ }
+
+ public static class list_sentry_privileges_for_provider<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, list_sentry_privileges_for_provider_args, TListSentryPrivilegesForProviderResponse> {
+ public list_sentry_privileges_for_provider() {
+ super("list_sentry_privileges_for_provider");
+ }
+
+ public list_sentry_privileges_for_provider_args getEmptyArgsInstance() {
+ return new list_sentry_privileges_for_provider_args();
+ }
+
+ public AsyncMethodCallback<TListSentryPrivilegesForProviderResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<TListSentryPrivilegesForProviderResponse>() {
+ public void onComplete(TListSentryPrivilegesForProviderResponse o) {
+ list_sentry_privileges_for_provider_result result = new list_sentry_privileges_for_provider_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;
+ list_sentry_privileges_for_provider_result result = new list_sentry_privileges_for_provider_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, list_sentry_privileges_for_provider_args args, org.apache.thrift.async.AsyncMethodCallback<TListSentryPrivilegesForProviderResponse> resultHandler) throws TException {
+ iface.list_sentry_privileges_for_provider(args.request,resultHandler);
+ }
+ }
+
+ public static class list_sentry_privileges_by_authorizable<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, list_sentry_privileges_by_authorizable_args, TListSentryPrivilegesByAuthResponse> {
+ public list_sentry_privileges_by_authorizable() {
+ super("list_sentry_privileges_by_authorizable");
+ }
+
+ public list_sentry_privileges_by_authorizable_args getEmptyArgsInstance() {
+ return new list_sentry_privileges_by_authorizable_args();
+ }
+
+ public AsyncMethodCallback<TListSentryPrivilegesByAuthResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<TListSentryPrivilegesByAuthResponse>() {
+ public void onComplete(TListSentryPrivilegesByAuthResponse o) {
+ list_sentry_privileges_by_authorizable_result result = new list_sentry_privileges_by_authorizable_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;
+ list_sentry_privileges_by_authorizable_result result = new list_sentry_privileges_by_authorizable_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, list_sentry_privileges_by_authorizable_args args, org.apache.thrift.async.AsyncMethodCallback<TListSentryPrivilegesByAuthResponse> resultHandler) throws TException {
+ iface.list_sentry_privileges_by_authorizable(args.request,resultHandler);
+ }
+ }
+
+ public static class drop_sentry_privilege<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, drop_sentry_privilege_args, TDropPrivilegesResponse> {
+ public drop_sentry_privilege() {
+ super("drop_sentry_privilege");
+ }
+
+ public drop_sentry_privilege_args getEmptyArgsInstance() {
+ return new drop_sentry_privilege_args();
+ }
+
+ public AsyncMethodCallback<TDropPrivilegesResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<TDropPrivilegesResponse>() {
+ public void onComplete(TDropPrivilegesResponse o) {
+ drop_sentry_privilege_result result = new drop_sentry_privilege_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;
+ drop_sentry_privilege_result result = new drop_sentry_privilege_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, drop_sentry_privilege_args args, org.apache.thrift.async.AsyncMethodCallback<TDropPrivilegesResponse> resultHandler) throws TException {
+ iface.drop_sentry_privilege(args.request,resultHandler);
+ }
+ }
+
+ public static class rename_sentry_privilege<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, rename_sentry_privilege_args, TRenamePrivilegesResponse> {
+ public rename_sentry_privilege() {
+ super("rename_sentry_privilege");
+ }
+
+ public rename_sentry_privilege_args getEmptyArgsInstance() {
+ return new rename_sentry_privilege_args();
+ }
+
+ public AsyncMethodCallback<TRenamePrivilegesResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<TRenamePrivilegesResponse>() {
+ public void onComplete(TRenamePrivilegesResponse o) {
+ rename_sentry_privilege_result result = new rename_sentry_privilege_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;
+ rename_sentry_privilege_result result = new rename_sentry_privilege_result();
+ {
+ msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+ msg = (org.apache.thrift.
<TRUNCATED>
[03/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesRequest.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesRequest.java
new file mode 100644
index 0000000..ee8b52b
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesRequest.java
@@ -0,0 +1,957 @@
+/**
+ * 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.generic.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 TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TListSentryPrivilegesRequest, TListSentryPrivilegesRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesRequest> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesRequest");
+
+ 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
+ private static final org.apache.thrift.protocol.TField SERVICE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("serviceName", org.apache.thrift.protocol.TType.STRING, (short)5);
+ private static final org.apache.thrift.protocol.TField AUTHORIZABLES_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizables", org.apache.thrift.protocol.TType.LIST, (short)6);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TListSentryPrivilegesRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TListSentryPrivilegesRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String roleName; // required
+ private String component; // required
+ private String serviceName; // required
+ private List<TAuthorizable> authorizables; // optional
+
+ /** 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"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ ROLE_NAME((short)3, "roleName"),
+ COMPONENT((short)4, "component"),
+ SERVICE_NAME((short)5, "serviceName"),
+ AUTHORIZABLES((short)6, "authorizables");
+
+ 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: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // ROLE_NAME
+ return ROLE_NAME;
+ case 4: // COMPONENT
+ return COMPONENT;
+ case 5: // SERVICE_NAME
+ return SERVICE_NAME;
+ case 6: // AUTHORIZABLES
+ return AUTHORIZABLES;
+ 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 byte __isset_bitfield = 0;
+ private static final _Fields optionals[] = {_Fields.AUTHORIZABLES};
+ 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.SERVICE_NAME, new org.apache.thrift.meta_data.FieldMetaData("serviceName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.AUTHORIZABLES, new org.apache.thrift.meta_data.FieldMetaData("authorizables", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAuthorizable.class))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesRequest.class, metaDataMap);
+ }
+
+ public TListSentryPrivilegesRequest() {
+ this.protocol_version = 2;
+
+ }
+
+ public TListSentryPrivilegesRequest(
+ int protocol_version,
+ String requestorUserName,
+ String roleName,
+ String component,
+ String serviceName)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.roleName = roleName;
+ this.component = component;
+ this.serviceName = serviceName;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TListSentryPrivilegesRequest(TListSentryPrivilegesRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetRoleName()) {
+ this.roleName = other.roleName;
+ }
+ if (other.isSetComponent()) {
+ this.component = other.component;
+ }
+ if (other.isSetServiceName()) {
+ this.serviceName = other.serviceName;
+ }
+ if (other.isSetAuthorizables()) {
+ List<TAuthorizable> __this__authorizables = new ArrayList<TAuthorizable>(other.authorizables.size());
+ for (TAuthorizable other_element : other.authorizables) {
+ __this__authorizables.add(new TAuthorizable(other_element));
+ }
+ this.authorizables = __this__authorizables;
+ }
+ }
+
+ public TListSentryPrivilegesRequest deepCopy() {
+ return new TListSentryPrivilegesRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 2;
+
+ this.requestorUserName = null;
+ this.roleName = null;
+ this.component = null;
+ this.serviceName = null;
+ this.authorizables = 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 String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public String getRoleName() {
+ return this.roleName;
+ }
+
+ public void setRoleName(String roleName) {
+ this.roleName = roleName;
+ }
+
+ public void unsetRoleName() {
+ this.roleName = null;
+ }
+
+ /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRoleName() {
+ return this.roleName != null;
+ }
+
+ public void setRoleNameIsSet(boolean value) {
+ if (!value) {
+ this.roleName = null;
+ }
+ }
+
+ public String getComponent() {
+ return this.component;
+ }
+
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ public void unsetComponent() {
+ this.component = null;
+ }
+
+ /** Returns true if field component is set (has been assigned a value) and false otherwise */
+ public boolean isSetComponent() {
+ return this.component != null;
+ }
+
+ public void setComponentIsSet(boolean value) {
+ if (!value) {
+ this.component = null;
+ }
+ }
+
+ public String getServiceName() {
+ return this.serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public void unsetServiceName() {
+ this.serviceName = null;
+ }
+
+ /** Returns true if field serviceName is set (has been assigned a value) and false otherwise */
+ public boolean isSetServiceName() {
+ return this.serviceName != null;
+ }
+
+ public void setServiceNameIsSet(boolean value) {
+ if (!value) {
+ this.serviceName = null;
+ }
+ }
+
+ public int getAuthorizablesSize() {
+ return (this.authorizables == null) ? 0 : this.authorizables.size();
+ }
+
+ public java.util.Iterator<TAuthorizable> getAuthorizablesIterator() {
+ return (this.authorizables == null) ? null : this.authorizables.iterator();
+ }
+
+ public void addToAuthorizables(TAuthorizable elem) {
+ if (this.authorizables == null) {
+ this.authorizables = new ArrayList<TAuthorizable>();
+ }
+ this.authorizables.add(elem);
+ }
+
+ public List<TAuthorizable> getAuthorizables() {
+ return this.authorizables;
+ }
+
+ public void setAuthorizables(List<TAuthorizable> authorizables) {
+ this.authorizables = authorizables;
+ }
+
+ public void unsetAuthorizables() {
+ this.authorizables = null;
+ }
+
+ /** Returns true if field authorizables is set (has been assigned a value) and false otherwise */
+ public boolean isSetAuthorizables() {
+ return this.authorizables != null;
+ }
+
+ public void setAuthorizablesIsSet(boolean value) {
+ if (!value) {
+ this.authorizables = 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 REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case ROLE_NAME:
+ if (value == null) {
+ unsetRoleName();
+ } else {
+ setRoleName((String)value);
+ }
+ break;
+
+ case COMPONENT:
+ if (value == null) {
+ unsetComponent();
+ } else {
+ setComponent((String)value);
+ }
+ break;
+
+ case SERVICE_NAME:
+ if (value == null) {
+ unsetServiceName();
+ } else {
+ setServiceName((String)value);
+ }
+ break;
+
+ case AUTHORIZABLES:
+ if (value == null) {
+ unsetAuthorizables();
+ } else {
+ setAuthorizables((List<TAuthorizable>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return getProtocol_version();
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case ROLE_NAME:
+ return getRoleName();
+
+ case COMPONENT:
+ return getComponent();
+
+ case SERVICE_NAME:
+ return getServiceName();
+
+ case AUTHORIZABLES:
+ return getAuthorizables();
+
+ }
+ 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 REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case ROLE_NAME:
+ return isSetRoleName();
+ case COMPONENT:
+ return isSetComponent();
+ case SERVICE_NAME:
+ return isSetServiceName();
+ case AUTHORIZABLES:
+ return isSetAuthorizables();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TListSentryPrivilegesRequest)
+ return this.equals((TListSentryPrivilegesRequest)that);
+ return false;
+ }
+
+ public boolean equals(TListSentryPrivilegesRequest 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_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_roleName = true && this.isSetRoleName();
+ boolean that_present_roleName = true && that.isSetRoleName();
+ if (this_present_roleName || that_present_roleName) {
+ if (!(this_present_roleName && that_present_roleName))
+ return false;
+ if (!this.roleName.equals(that.roleName))
+ return false;
+ }
+
+ boolean this_present_component = true && this.isSetComponent();
+ boolean that_present_component = true && that.isSetComponent();
+ if (this_present_component || that_present_component) {
+ if (!(this_present_component && that_present_component))
+ return false;
+ if (!this.component.equals(that.component))
+ return false;
+ }
+
+ boolean this_present_serviceName = true && this.isSetServiceName();
+ boolean that_present_serviceName = true && that.isSetServiceName();
+ if (this_present_serviceName || that_present_serviceName) {
+ if (!(this_present_serviceName && that_present_serviceName))
+ return false;
+ if (!this.serviceName.equals(that.serviceName))
+ return false;
+ }
+
+ boolean this_present_authorizables = true && this.isSetAuthorizables();
+ boolean that_present_authorizables = true && that.isSetAuthorizables();
+ if (this_present_authorizables || that_present_authorizables) {
+ if (!(this_present_authorizables && that_present_authorizables))
+ return false;
+ if (!this.authorizables.equals(that.authorizables))
+ 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_requestorUserName = true && (isSetRequestorUserName());
+ list.add(present_requestorUserName);
+ if (present_requestorUserName)
+ list.add(requestorUserName);
+
+ boolean present_roleName = true && (isSetRoleName());
+ list.add(present_roleName);
+ if (present_roleName)
+ list.add(roleName);
+
+ boolean present_component = true && (isSetComponent());
+ list.add(present_component);
+ if (present_component)
+ list.add(component);
+
+ boolean present_serviceName = true && (isSetServiceName());
+ list.add(present_serviceName);
+ if (present_serviceName)
+ list.add(serviceName);
+
+ boolean present_authorizables = true && (isSetAuthorizables());
+ list.add(present_authorizables);
+ if (present_authorizables)
+ list.add(authorizables);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TListSentryPrivilegesRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetComponent()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetServiceName()).compareTo(other.isSetServiceName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetServiceName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serviceName, other.serviceName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetAuthorizables()).compareTo(other.isSetAuthorizables());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAuthorizables()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizables, other.authorizables);
+ 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("TListSentryPrivilegesRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("roleName:");
+ if (this.roleName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roleName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("component:");
+ if (this.component == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.component);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("serviceName:");
+ if (this.serviceName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.serviceName);
+ }
+ first = false;
+ if (isSetAuthorizables()) {
+ if (!first) sb.append(", ");
+ sb.append("authorizables:");
+ if (this.authorizables == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.authorizables);
+ }
+ 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 (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRoleName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetComponent()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
+ }
+
+ if (!isSetServiceName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'serviceName' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TListSentryPrivilegesRequestStandardSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesRequestStandardScheme getScheme() {
+ return new TListSentryPrivilegesRequestStandardScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesRequestStandardScheme extends StandardScheme<TListSentryPrivilegesRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesRequest 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: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // ROLE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // COMPONENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 5: // SERVICE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.serviceName = iprot.readString();
+ struct.setServiceNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 6: // AUTHORIZABLES
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list40 = iprot.readListBegin();
+ struct.authorizables = new ArrayList<TAuthorizable>(_list40.size);
+ TAuthorizable _elem41;
+ for (int _i42 = 0; _i42 < _list40.size; ++_i42)
+ {
+ _elem41 = new TAuthorizable();
+ _elem41.read(iprot);
+ struct.authorizables.add(_elem41);
+ }
+ iprot.readListEnd();
+ }
+ struct.setAuthorizablesIsSet(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, TListSentryPrivilegesRequest 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();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.roleName != null) {
+ oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
+ oprot.writeString(struct.roleName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.component != null) {
+ oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
+ oprot.writeString(struct.component);
+ oprot.writeFieldEnd();
+ }
+ if (struct.serviceName != null) {
+ oprot.writeFieldBegin(SERVICE_NAME_FIELD_DESC);
+ oprot.writeString(struct.serviceName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.authorizables != null) {
+ if (struct.isSetAuthorizables()) {
+ oprot.writeFieldBegin(AUTHORIZABLES_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.authorizables.size()));
+ for (TAuthorizable _iter43 : struct.authorizables)
+ {
+ _iter43.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TListSentryPrivilegesRequestTupleSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesRequestTupleScheme getScheme() {
+ return new TListSentryPrivilegesRequestTupleScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesRequestTupleScheme extends TupleScheme<TListSentryPrivilegesRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeString(struct.roleName);
+ oprot.writeString(struct.component);
+ oprot.writeString(struct.serviceName);
+ BitSet optionals = new BitSet();
+ if (struct.isSetAuthorizables()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetAuthorizables()) {
+ {
+ oprot.writeI32(struct.authorizables.size());
+ for (TAuthorizable _iter44 : struct.authorizables)
+ {
+ _iter44.write(oprot);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ struct.serviceName = iprot.readString();
+ struct.setServiceNameIsSet(true);
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TList _list45 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.authorizables = new ArrayList<TAuthorizable>(_list45.size);
+ TAuthorizable _elem46;
+ for (int _i47 = 0; _i47 < _list45.size; ++_i47)
+ {
+ _elem46 = new TAuthorizable();
+ _elem46.read(iprot);
+ struct.authorizables.add(_elem46);
+ }
+ }
+ struct.setAuthorizablesIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesResponse.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesResponse.java
new file mode 100644
index 0000000..1b5253d
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesResponse.java
@@ -0,0 +1,555 @@
+/**
+ * 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.generic.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 TListSentryPrivilegesResponse implements org.apache.thrift.TBase<TListSentryPrivilegesResponse, TListSentryPrivilegesResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesResponse> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesResponse");
+
+ 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 PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TListSentryPrivilegesResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TListSentryPrivilegesResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
+ private Set<TSentryPrivilege> privileges; // optional
+
+ /** 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"),
+ PRIVILEGES((short)2, "privileges");
+
+ 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: // PRIVILEGES
+ return PRIVILEGES;
+ 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 _Fields optionals[] = {_Fields.PRIVILEGES};
+ 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.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
+ tmpMap.put(_Fields.PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("privileges", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesResponse.class, metaDataMap);
+ }
+
+ public TListSentryPrivilegesResponse() {
+ }
+
+ public TListSentryPrivilegesResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TListSentryPrivilegesResponse(TListSentryPrivilegesResponse other) {
+ if (other.isSetStatus()) {
+ this.status = other.status;
+ }
+ if (other.isSetPrivileges()) {
+ Set<TSentryPrivilege> __this__privileges = new HashSet<TSentryPrivilege>(other.privileges.size());
+ for (TSentryPrivilege other_element : other.privileges) {
+ __this__privileges.add(new TSentryPrivilege(other_element));
+ }
+ this.privileges = __this__privileges;
+ }
+ }
+
+ public TListSentryPrivilegesResponse deepCopy() {
+ return new TListSentryPrivilegesResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ this.privileges = null;
+ }
+
+ 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 int getPrivilegesSize() {
+ return (this.privileges == null) ? 0 : this.privileges.size();
+ }
+
+ public java.util.Iterator<TSentryPrivilege> getPrivilegesIterator() {
+ return (this.privileges == null) ? null : this.privileges.iterator();
+ }
+
+ public void addToPrivileges(TSentryPrivilege elem) {
+ if (this.privileges == null) {
+ this.privileges = new HashSet<TSentryPrivilege>();
+ }
+ this.privileges.add(elem);
+ }
+
+ public Set<TSentryPrivilege> getPrivileges() {
+ return this.privileges;
+ }
+
+ public void setPrivileges(Set<TSentryPrivilege> privileges) {
+ this.privileges = privileges;
+ }
+
+ public void unsetPrivileges() {
+ this.privileges = null;
+ }
+
+ /** Returns true if field privileges is set (has been assigned a value) and false otherwise */
+ public boolean isSetPrivileges() {
+ return this.privileges != null;
+ }
+
+ public void setPrivilegesIsSet(boolean value) {
+ if (!value) {
+ this.privileges = null;
+ }
+ }
+
+ 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 PRIVILEGES:
+ if (value == null) {
+ unsetPrivileges();
+ } else {
+ setPrivileges((Set<TSentryPrivilege>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ case PRIVILEGES:
+ return getPrivileges();
+
+ }
+ 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 PRIVILEGES:
+ return isSetPrivileges();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TListSentryPrivilegesResponse)
+ return this.equals((TListSentryPrivilegesResponse)that);
+ return false;
+ }
+
+ public boolean equals(TListSentryPrivilegesResponse 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_privileges = true && this.isSetPrivileges();
+ boolean that_present_privileges = true && that.isSetPrivileges();
+ if (this_present_privileges || that_present_privileges) {
+ if (!(this_present_privileges && that_present_privileges))
+ return false;
+ if (!this.privileges.equals(that.privileges))
+ 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_privileges = true && (isSetPrivileges());
+ list.add(present_privileges);
+ if (present_privileges)
+ list.add(privileges);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TListSentryPrivilegesResponse 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(isSetPrivileges()).compareTo(other.isSetPrivileges());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPrivileges()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, other.privileges);
+ 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("TListSentryPrivilegesResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ first = false;
+ if (isSetPrivileges()) {
+ if (!first) sb.append(", ");
+ sb.append("privileges:");
+ if (this.privileges == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.privileges);
+ }
+ 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());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TListSentryPrivilegesResponseStandardSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesResponseStandardScheme getScheme() {
+ return new TListSentryPrivilegesResponseStandardScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesResponseStandardScheme extends StandardScheme<TListSentryPrivilegesResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesResponse 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: // PRIVILEGES
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set48 = iprot.readSetBegin();
+ struct.privileges = new HashSet<TSentryPrivilege>(2*_set48.size);
+ TSentryPrivilege _elem49;
+ for (int _i50 = 0; _i50 < _set48.size; ++_i50)
+ {
+ _elem49 = new TSentryPrivilege();
+ _elem49.read(iprot);
+ struct.privileges.add(_elem49);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setPrivilegesIsSet(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, TListSentryPrivilegesResponse 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();
+ }
+ if (struct.privileges != null) {
+ if (struct.isSetPrivileges()) {
+ oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
+ {
+ oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.privileges.size()));
+ for (TSentryPrivilege _iter51 : struct.privileges)
+ {
+ _iter51.write(oprot);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TListSentryPrivilegesResponseTupleSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesResponseTupleScheme getScheme() {
+ return new TListSentryPrivilegesResponseTupleScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesResponseTupleScheme extends TupleScheme<TListSentryPrivilegesResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ struct.status.write(oprot);
+ BitSet optionals = new BitSet();
+ if (struct.isSetPrivileges()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetPrivileges()) {
+ {
+ oprot.writeI32(struct.privileges.size());
+ for (TSentryPrivilege _iter52 : struct.privileges)
+ {
+ _iter52.write(oprot);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesResponse 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);
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TSet _set53 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.privileges = new HashSet<TSentryPrivilege>(2*_set53.size);
+ TSentryPrivilege _elem54;
+ for (int _i55 = 0; _i55 < _set53.size; ++_i55)
+ {
+ _elem54 = new TSentryPrivilege();
+ _elem54.read(iprot);
+ struct.privileges.add(_elem54);
+ }
+ }
+ struct.setPrivilegesIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryRolesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryRolesRequest.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryRolesRequest.java
new file mode 100644
index 0000000..7138f12
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryRolesRequest.java
@@ -0,0 +1,701 @@
+/**
+ * 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.generic.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 TListSentryRolesRequest implements org.apache.thrift.TBase<TListSentryRolesRequest, TListSentryRolesRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryRolesRequest> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryRolesRequest");
+
+ 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField GROUP_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("groupName", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TListSentryRolesRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TListSentryRolesRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String groupName; // optional
+ private String component; // 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"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ GROUP_NAME((short)3, "groupName"),
+ COMPONENT((short)4, "component");
+
+ 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: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // GROUP_NAME
+ return GROUP_NAME;
+ case 4: // COMPONENT
+ return COMPONENT;
+ 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 byte __isset_bitfield = 0;
+ private static final _Fields optionals[] = {_Fields.GROUP_NAME};
+ 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.GROUP_NAME, new org.apache.thrift.meta_data.FieldMetaData("groupName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryRolesRequest.class, metaDataMap);
+ }
+
+ public TListSentryRolesRequest() {
+ this.protocol_version = 2;
+
+ }
+
+ public TListSentryRolesRequest(
+ int protocol_version,
+ String requestorUserName,
+ String component)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.component = component;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TListSentryRolesRequest(TListSentryRolesRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetGroupName()) {
+ this.groupName = other.groupName;
+ }
+ if (other.isSetComponent()) {
+ this.component = other.component;
+ }
+ }
+
+ public TListSentryRolesRequest deepCopy() {
+ return new TListSentryRolesRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 2;
+
+ this.requestorUserName = null;
+ this.groupName = null;
+ this.component = 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 String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public String getGroupName() {
+ return this.groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public void unsetGroupName() {
+ this.groupName = null;
+ }
+
+ /** Returns true if field groupName is set (has been assigned a value) and false otherwise */
+ public boolean isSetGroupName() {
+ return this.groupName != null;
+ }
+
+ public void setGroupNameIsSet(boolean value) {
+ if (!value) {
+ this.groupName = null;
+ }
+ }
+
+ public String getComponent() {
+ return this.component;
+ }
+
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ public void unsetComponent() {
+ this.component = null;
+ }
+
+ /** Returns true if field component is set (has been assigned a value) and false otherwise */
+ public boolean isSetComponent() {
+ return this.component != null;
+ }
+
+ public void setComponentIsSet(boolean value) {
+ if (!value) {
+ this.component = 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 REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case GROUP_NAME:
+ if (value == null) {
+ unsetGroupName();
+ } else {
+ setGroupName((String)value);
+ }
+ break;
+
+ case COMPONENT:
+ if (value == null) {
+ unsetComponent();
+ } else {
+ setComponent((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return getProtocol_version();
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case GROUP_NAME:
+ return getGroupName();
+
+ case COMPONENT:
+ return getComponent();
+
+ }
+ 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 REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case GROUP_NAME:
+ return isSetGroupName();
+ case COMPONENT:
+ return isSetComponent();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TListSentryRolesRequest)
+ return this.equals((TListSentryRolesRequest)that);
+ return false;
+ }
+
+ public boolean equals(TListSentryRolesRequest 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_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_groupName = true && this.isSetGroupName();
+ boolean that_present_groupName = true && that.isSetGroupName();
+ if (this_present_groupName || that_present_groupName) {
+ if (!(this_present_groupName && that_present_groupName))
+ return false;
+ if (!this.groupName.equals(that.groupName))
+ return false;
+ }
+
+ boolean this_present_component = true && this.isSetComponent();
+ boolean that_present_component = true && that.isSetComponent();
+ if (this_present_component || that_present_component) {
+ if (!(this_present_component && that_present_component))
+ return false;
+ if (!this.component.equals(that.component))
+ 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_requestorUserName = true && (isSetRequestorUserName());
+ list.add(present_requestorUserName);
+ if (present_requestorUserName)
+ list.add(requestorUserName);
+
+ boolean present_groupName = true && (isSetGroupName());
+ list.add(present_groupName);
+ if (present_groupName)
+ list.add(groupName);
+
+ boolean present_component = true && (isSetComponent());
+ list.add(present_component);
+ if (present_component)
+ list.add(component);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TListSentryRolesRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGroupName()).compareTo(other.isSetGroupName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGroupName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groupName, other.groupName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetComponent()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
+ 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("TListSentryRolesRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (isSetGroupName()) {
+ if (!first) sb.append(", ");
+ sb.append("groupName:");
+ if (this.groupName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.groupName);
+ }
+ first = false;
+ }
+ if (!first) sb.append(", ");
+ sb.append("component:");
+ if (this.component == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.component);
+ }
+ 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 (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetComponent()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TListSentryRolesRequestStandardSchemeFactory implements SchemeFactory {
+ public TListSentryRolesRequestStandardScheme getScheme() {
+ return new TListSentryRolesRequestStandardScheme();
+ }
+ }
+
+ private static class TListSentryRolesRequestStandardScheme extends StandardScheme<TListSentryRolesRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryRolesRequest 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: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // GROUP_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.groupName = iprot.readString();
+ struct.setGroupNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // COMPONENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(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, TListSentryRolesRequest 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();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.groupName != null) {
+ if (struct.isSetGroupName()) {
+ oprot.writeFieldBegin(GROUP_NAME_FIELD_DESC);
+ oprot.writeString(struct.groupName);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.component != null) {
+ oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
+ oprot.writeString(struct.component);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TListSentryRolesRequestTupleSchemeFactory implements SchemeFactory {
+ public TListSentryRolesRequestTupleScheme getScheme() {
+ return new TListSentryRolesRequestTupleScheme();
+ }
+ }
+
+ private static class TListSentryRolesRequestTupleScheme extends TupleScheme<TListSentryRolesRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeString(struct.component);
+ BitSet optionals = new BitSet();
+ if (struct.isSetGroupName()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetGroupName()) {
+ oprot.writeString(struct.groupName);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.groupName = iprot.readString();
+ struct.setGroupNameIsSet(true);
+ }
+ }
+ }
+
+}
+
[09/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleAddGroupsRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleAddGroupsRequest.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleAddGroupsRequest.java
new file mode 100644
index 0000000..01c6f88
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleAddGroupsRequest.java
@@ -0,0 +1,842 @@
+/**
+ * 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.generic.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 TAlterSentryRoleAddGroupsRequest implements org.apache.thrift.TBase<TAlterSentryRoleAddGroupsRequest, TAlterSentryRoleAddGroupsRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleAddGroupsRequest> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleAddGroupsRequest");
+
+ 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
+ private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)5);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAlterSentryRoleAddGroupsRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAlterSentryRoleAddGroupsRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String roleName; // required
+ private String component; // required
+ private Set<String> groups; // 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"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ ROLE_NAME((short)3, "roleName"),
+ COMPONENT((short)4, "component"),
+ GROUPS((short)5, "groups");
+
+ 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: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // ROLE_NAME
+ return ROLE_NAME;
+ case 4: // COMPONENT
+ return COMPONENT;
+ case 5: // GROUPS
+ return GROUPS;
+ 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleAddGroupsRequest.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleAddGroupsRequest() {
+ this.protocol_version = 2;
+
+ }
+
+ public TAlterSentryRoleAddGroupsRequest(
+ int protocol_version,
+ String requestorUserName,
+ String roleName,
+ String component,
+ Set<String> groups)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.roleName = roleName;
+ this.component = component;
+ this.groups = groups;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleAddGroupsRequest(TAlterSentryRoleAddGroupsRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetRoleName()) {
+ this.roleName = other.roleName;
+ }
+ if (other.isSetComponent()) {
+ this.component = other.component;
+ }
+ if (other.isSetGroups()) {
+ Set<String> __this__groups = new HashSet<String>(other.groups);
+ this.groups = __this__groups;
+ }
+ }
+
+ public TAlterSentryRoleAddGroupsRequest deepCopy() {
+ return new TAlterSentryRoleAddGroupsRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 2;
+
+ this.requestorUserName = null;
+ this.roleName = null;
+ this.component = null;
+ this.groups = 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 String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public String getRoleName() {
+ return this.roleName;
+ }
+
+ public void setRoleName(String roleName) {
+ this.roleName = roleName;
+ }
+
+ public void unsetRoleName() {
+ this.roleName = null;
+ }
+
+ /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRoleName() {
+ return this.roleName != null;
+ }
+
+ public void setRoleNameIsSet(boolean value) {
+ if (!value) {
+ this.roleName = null;
+ }
+ }
+
+ public String getComponent() {
+ return this.component;
+ }
+
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ public void unsetComponent() {
+ this.component = null;
+ }
+
+ /** Returns true if field component is set (has been assigned a value) and false otherwise */
+ public boolean isSetComponent() {
+ return this.component != null;
+ }
+
+ public void setComponentIsSet(boolean value) {
+ if (!value) {
+ this.component = null;
+ }
+ }
+
+ public int getGroupsSize() {
+ return (this.groups == null) ? 0 : this.groups.size();
+ }
+
+ public java.util.Iterator<String> getGroupsIterator() {
+ return (this.groups == null) ? null : this.groups.iterator();
+ }
+
+ public void addToGroups(String elem) {
+ if (this.groups == null) {
+ this.groups = new HashSet<String>();
+ }
+ this.groups.add(elem);
+ }
+
+ public Set<String> getGroups() {
+ return this.groups;
+ }
+
+ public void setGroups(Set<String> groups) {
+ this.groups = groups;
+ }
+
+ public void unsetGroups() {
+ this.groups = null;
+ }
+
+ /** Returns true if field groups is set (has been assigned a value) and false otherwise */
+ public boolean isSetGroups() {
+ return this.groups != null;
+ }
+
+ public void setGroupsIsSet(boolean value) {
+ if (!value) {
+ this.groups = 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 REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case ROLE_NAME:
+ if (value == null) {
+ unsetRoleName();
+ } else {
+ setRoleName((String)value);
+ }
+ break;
+
+ case COMPONENT:
+ if (value == null) {
+ unsetComponent();
+ } else {
+ setComponent((String)value);
+ }
+ break;
+
+ case GROUPS:
+ if (value == null) {
+ unsetGroups();
+ } else {
+ setGroups((Set<String>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return getProtocol_version();
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case ROLE_NAME:
+ return getRoleName();
+
+ case COMPONENT:
+ return getComponent();
+
+ case GROUPS:
+ return getGroups();
+
+ }
+ 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 REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case ROLE_NAME:
+ return isSetRoleName();
+ case COMPONENT:
+ return isSetComponent();
+ case GROUPS:
+ return isSetGroups();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleAddGroupsRequest)
+ return this.equals((TAlterSentryRoleAddGroupsRequest)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleAddGroupsRequest 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_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_roleName = true && this.isSetRoleName();
+ boolean that_present_roleName = true && that.isSetRoleName();
+ if (this_present_roleName || that_present_roleName) {
+ if (!(this_present_roleName && that_present_roleName))
+ return false;
+ if (!this.roleName.equals(that.roleName))
+ return false;
+ }
+
+ boolean this_present_component = true && this.isSetComponent();
+ boolean that_present_component = true && that.isSetComponent();
+ if (this_present_component || that_present_component) {
+ if (!(this_present_component && that_present_component))
+ return false;
+ if (!this.component.equals(that.component))
+ return false;
+ }
+
+ boolean this_present_groups = true && this.isSetGroups();
+ boolean that_present_groups = true && that.isSetGroups();
+ if (this_present_groups || that_present_groups) {
+ if (!(this_present_groups && that_present_groups))
+ return false;
+ if (!this.groups.equals(that.groups))
+ 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_requestorUserName = true && (isSetRequestorUserName());
+ list.add(present_requestorUserName);
+ if (present_requestorUserName)
+ list.add(requestorUserName);
+
+ boolean present_roleName = true && (isSetRoleName());
+ list.add(present_roleName);
+ if (present_roleName)
+ list.add(roleName);
+
+ boolean present_component = true && (isSetComponent());
+ list.add(present_component);
+ if (present_component)
+ list.add(component);
+
+ boolean present_groups = true && (isSetGroups());
+ list.add(present_groups);
+ if (present_groups)
+ list.add(groups);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TAlterSentryRoleAddGroupsRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetComponent()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGroups()).compareTo(other.isSetGroups());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGroups()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, other.groups);
+ 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("TAlterSentryRoleAddGroupsRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("roleName:");
+ if (this.roleName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roleName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("component:");
+ if (this.component == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.component);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("groups:");
+ if (this.groups == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.groups);
+ }
+ 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 (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRoleName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetComponent()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
+ }
+
+ if (!isSetGroups()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'groups' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TAlterSentryRoleAddGroupsRequestStandardSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleAddGroupsRequestStandardScheme getScheme() {
+ return new TAlterSentryRoleAddGroupsRequestStandardScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleAddGroupsRequestStandardScheme extends StandardScheme<TAlterSentryRoleAddGroupsRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleAddGroupsRequest 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: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // ROLE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // COMPONENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 5: // GROUPS
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set8 = iprot.readSetBegin();
+ struct.groups = new HashSet<String>(2*_set8.size);
+ String _elem9;
+ for (int _i10 = 0; _i10 < _set8.size; ++_i10)
+ {
+ _elem9 = iprot.readString();
+ struct.groups.add(_elem9);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setGroupsIsSet(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, TAlterSentryRoleAddGroupsRequest 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();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.roleName != null) {
+ oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
+ oprot.writeString(struct.roleName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.component != null) {
+ oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
+ oprot.writeString(struct.component);
+ oprot.writeFieldEnd();
+ }
+ if (struct.groups != null) {
+ oprot.writeFieldBegin(GROUPS_FIELD_DESC);
+ {
+ oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.groups.size()));
+ for (String _iter11 : struct.groups)
+ {
+ oprot.writeString(_iter11);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAlterSentryRoleAddGroupsRequestTupleSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleAddGroupsRequestTupleScheme getScheme() {
+ return new TAlterSentryRoleAddGroupsRequestTupleScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleAddGroupsRequestTupleScheme extends TupleScheme<TAlterSentryRoleAddGroupsRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeString(struct.roleName);
+ oprot.writeString(struct.component);
+ {
+ oprot.writeI32(struct.groups.size());
+ for (String _iter12 : struct.groups)
+ {
+ oprot.writeString(_iter12);
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ {
+ org.apache.thrift.protocol.TSet _set13 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.groups = new HashSet<String>(2*_set13.size);
+ String _elem14;
+ for (int _i15 = 0; _i15 < _set13.size; ++_i15)
+ {
+ _elem14 = iprot.readString();
+ struct.groups.add(_elem14);
+ }
+ }
+ struct.setGroupsIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleAddGroupsResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleAddGroupsResponse.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleAddGroupsResponse.java
new file mode 100644
index 0000000..842b191
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleAddGroupsResponse.java
@@ -0,0 +1,391 @@
+/**
+ * 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.generic.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 TAlterSentryRoleAddGroupsResponse implements org.apache.thrift.TBase<TAlterSentryRoleAddGroupsResponse, TAlterSentryRoleAddGroupsResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleAddGroupsResponse> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleAddGroupsResponse");
+
+ 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAlterSentryRoleAddGroupsResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAlterSentryRoleAddGroupsResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
+
+ 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;
+ 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleAddGroupsResponse.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleAddGroupsResponse() {
+ }
+
+ public TAlterSentryRoleAddGroupsResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleAddGroupsResponse(TAlterSentryRoleAddGroupsResponse other) {
+ if (other.isSetStatus()) {
+ this.status = other.status;
+ }
+ }
+
+ public TAlterSentryRoleAddGroupsResponse deepCopy() {
+ return new TAlterSentryRoleAddGroupsResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ }
+
+ 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 void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ }
+ 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();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleAddGroupsResponse)
+ return this.equals((TAlterSentryRoleAddGroupsResponse)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleAddGroupsResponse 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;
+ }
+
+ 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);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TAlterSentryRoleAddGroupsResponse 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;
+ }
+ }
+ 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("TAlterSentryRoleAddGroupsResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ 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());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TAlterSentryRoleAddGroupsResponseStandardSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleAddGroupsResponseStandardScheme getScheme() {
+ return new TAlterSentryRoleAddGroupsResponseStandardScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleAddGroupsResponseStandardScheme extends StandardScheme<TAlterSentryRoleAddGroupsResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleAddGroupsResponse 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;
+ 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, TAlterSentryRoleAddGroupsResponse 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.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAlterSentryRoleAddGroupsResponseTupleSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleAddGroupsResponseTupleScheme getScheme() {
+ return new TAlterSentryRoleAddGroupsResponseTupleScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleAddGroupsResponseTupleScheme extends TupleScheme<TAlterSentryRoleAddGroupsResponse> {
+
+ @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);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsResponse 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);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleDeleteGroupsRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleDeleteGroupsRequest.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleDeleteGroupsRequest.java
new file mode 100644
index 0000000..5ae49e3
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleDeleteGroupsRequest.java
@@ -0,0 +1,842 @@
+/**
+ * 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.generic.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 TAlterSentryRoleDeleteGroupsRequest implements org.apache.thrift.TBase<TAlterSentryRoleDeleteGroupsRequest, TAlterSentryRoleDeleteGroupsRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleDeleteGroupsRequest> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleDeleteGroupsRequest");
+
+ 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
+ private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)5);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAlterSentryRoleDeleteGroupsRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAlterSentryRoleDeleteGroupsRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String roleName; // required
+ private String component; // required
+ private Set<String> groups; // 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"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ ROLE_NAME((short)3, "roleName"),
+ COMPONENT((short)4, "component"),
+ GROUPS((short)5, "groups");
+
+ 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: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // ROLE_NAME
+ return ROLE_NAME;
+ case 4: // COMPONENT
+ return COMPONENT;
+ case 5: // GROUPS
+ return GROUPS;
+ 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleDeleteGroupsRequest.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleDeleteGroupsRequest() {
+ this.protocol_version = 2;
+
+ }
+
+ public TAlterSentryRoleDeleteGroupsRequest(
+ int protocol_version,
+ String requestorUserName,
+ String roleName,
+ String component,
+ Set<String> groups)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.roleName = roleName;
+ this.component = component;
+ this.groups = groups;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleDeleteGroupsRequest(TAlterSentryRoleDeleteGroupsRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetRoleName()) {
+ this.roleName = other.roleName;
+ }
+ if (other.isSetComponent()) {
+ this.component = other.component;
+ }
+ if (other.isSetGroups()) {
+ Set<String> __this__groups = new HashSet<String>(other.groups);
+ this.groups = __this__groups;
+ }
+ }
+
+ public TAlterSentryRoleDeleteGroupsRequest deepCopy() {
+ return new TAlterSentryRoleDeleteGroupsRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 2;
+
+ this.requestorUserName = null;
+ this.roleName = null;
+ this.component = null;
+ this.groups = 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 String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public String getRoleName() {
+ return this.roleName;
+ }
+
+ public void setRoleName(String roleName) {
+ this.roleName = roleName;
+ }
+
+ public void unsetRoleName() {
+ this.roleName = null;
+ }
+
+ /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRoleName() {
+ return this.roleName != null;
+ }
+
+ public void setRoleNameIsSet(boolean value) {
+ if (!value) {
+ this.roleName = null;
+ }
+ }
+
+ public String getComponent() {
+ return this.component;
+ }
+
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ public void unsetComponent() {
+ this.component = null;
+ }
+
+ /** Returns true if field component is set (has been assigned a value) and false otherwise */
+ public boolean isSetComponent() {
+ return this.component != null;
+ }
+
+ public void setComponentIsSet(boolean value) {
+ if (!value) {
+ this.component = null;
+ }
+ }
+
+ public int getGroupsSize() {
+ return (this.groups == null) ? 0 : this.groups.size();
+ }
+
+ public java.util.Iterator<String> getGroupsIterator() {
+ return (this.groups == null) ? null : this.groups.iterator();
+ }
+
+ public void addToGroups(String elem) {
+ if (this.groups == null) {
+ this.groups = new HashSet<String>();
+ }
+ this.groups.add(elem);
+ }
+
+ public Set<String> getGroups() {
+ return this.groups;
+ }
+
+ public void setGroups(Set<String> groups) {
+ this.groups = groups;
+ }
+
+ public void unsetGroups() {
+ this.groups = null;
+ }
+
+ /** Returns true if field groups is set (has been assigned a value) and false otherwise */
+ public boolean isSetGroups() {
+ return this.groups != null;
+ }
+
+ public void setGroupsIsSet(boolean value) {
+ if (!value) {
+ this.groups = 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 REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case ROLE_NAME:
+ if (value == null) {
+ unsetRoleName();
+ } else {
+ setRoleName((String)value);
+ }
+ break;
+
+ case COMPONENT:
+ if (value == null) {
+ unsetComponent();
+ } else {
+ setComponent((String)value);
+ }
+ break;
+
+ case GROUPS:
+ if (value == null) {
+ unsetGroups();
+ } else {
+ setGroups((Set<String>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return getProtocol_version();
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case ROLE_NAME:
+ return getRoleName();
+
+ case COMPONENT:
+ return getComponent();
+
+ case GROUPS:
+ return getGroups();
+
+ }
+ 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 REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case ROLE_NAME:
+ return isSetRoleName();
+ case COMPONENT:
+ return isSetComponent();
+ case GROUPS:
+ return isSetGroups();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleDeleteGroupsRequest)
+ return this.equals((TAlterSentryRoleDeleteGroupsRequest)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleDeleteGroupsRequest 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_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_roleName = true && this.isSetRoleName();
+ boolean that_present_roleName = true && that.isSetRoleName();
+ if (this_present_roleName || that_present_roleName) {
+ if (!(this_present_roleName && that_present_roleName))
+ return false;
+ if (!this.roleName.equals(that.roleName))
+ return false;
+ }
+
+ boolean this_present_component = true && this.isSetComponent();
+ boolean that_present_component = true && that.isSetComponent();
+ if (this_present_component || that_present_component) {
+ if (!(this_present_component && that_present_component))
+ return false;
+ if (!this.component.equals(that.component))
+ return false;
+ }
+
+ boolean this_present_groups = true && this.isSetGroups();
+ boolean that_present_groups = true && that.isSetGroups();
+ if (this_present_groups || that_present_groups) {
+ if (!(this_present_groups && that_present_groups))
+ return false;
+ if (!this.groups.equals(that.groups))
+ 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_requestorUserName = true && (isSetRequestorUserName());
+ list.add(present_requestorUserName);
+ if (present_requestorUserName)
+ list.add(requestorUserName);
+
+ boolean present_roleName = true && (isSetRoleName());
+ list.add(present_roleName);
+ if (present_roleName)
+ list.add(roleName);
+
+ boolean present_component = true && (isSetComponent());
+ list.add(present_component);
+ if (present_component)
+ list.add(component);
+
+ boolean present_groups = true && (isSetGroups());
+ list.add(present_groups);
+ if (present_groups)
+ list.add(groups);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TAlterSentryRoleDeleteGroupsRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetComponent()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGroups()).compareTo(other.isSetGroups());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGroups()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, other.groups);
+ 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("TAlterSentryRoleDeleteGroupsRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("roleName:");
+ if (this.roleName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roleName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("component:");
+ if (this.component == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.component);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("groups:");
+ if (this.groups == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.groups);
+ }
+ 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 (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRoleName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetComponent()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
+ }
+
+ if (!isSetGroups()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'groups' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TAlterSentryRoleDeleteGroupsRequestStandardSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleDeleteGroupsRequestStandardScheme getScheme() {
+ return new TAlterSentryRoleDeleteGroupsRequestStandardScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleDeleteGroupsRequestStandardScheme extends StandardScheme<TAlterSentryRoleDeleteGroupsRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleDeleteGroupsRequest 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: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // ROLE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // COMPONENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 5: // GROUPS
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set16 = iprot.readSetBegin();
+ struct.groups = new HashSet<String>(2*_set16.size);
+ String _elem17;
+ for (int _i18 = 0; _i18 < _set16.size; ++_i18)
+ {
+ _elem17 = iprot.readString();
+ struct.groups.add(_elem17);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setGroupsIsSet(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, TAlterSentryRoleDeleteGroupsRequest 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();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.roleName != null) {
+ oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
+ oprot.writeString(struct.roleName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.component != null) {
+ oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
+ oprot.writeString(struct.component);
+ oprot.writeFieldEnd();
+ }
+ if (struct.groups != null) {
+ oprot.writeFieldBegin(GROUPS_FIELD_DESC);
+ {
+ oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.groups.size()));
+ for (String _iter19 : struct.groups)
+ {
+ oprot.writeString(_iter19);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAlterSentryRoleDeleteGroupsRequestTupleSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleDeleteGroupsRequestTupleScheme getScheme() {
+ return new TAlterSentryRoleDeleteGroupsRequestTupleScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleDeleteGroupsRequestTupleScheme extends TupleScheme<TAlterSentryRoleDeleteGroupsRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeString(struct.roleName);
+ oprot.writeString(struct.component);
+ {
+ oprot.writeI32(struct.groups.size());
+ for (String _iter20 : struct.groups)
+ {
+ oprot.writeString(_iter20);
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ {
+ org.apache.thrift.protocol.TSet _set21 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.groups = new HashSet<String>(2*_set21.size);
+ String _elem22;
+ for (int _i23 = 0; _i23 < _set21.size; ++_i23)
+ {
+ _elem22 = iprot.readString();
+ struct.groups.add(_elem22);
+ }
+ }
+ struct.setGroupsIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleDeleteGroupsResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleDeleteGroupsResponse.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleDeleteGroupsResponse.java
new file mode 100644
index 0000000..5040b4e
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleDeleteGroupsResponse.java
@@ -0,0 +1,391 @@
+/**
+ * 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.generic.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 TAlterSentryRoleDeleteGroupsResponse implements org.apache.thrift.TBase<TAlterSentryRoleDeleteGroupsResponse, TAlterSentryRoleDeleteGroupsResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleDeleteGroupsResponse> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleDeleteGroupsResponse");
+
+ 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAlterSentryRoleDeleteGroupsResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAlterSentryRoleDeleteGroupsResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
+
+ 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;
+ 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleDeleteGroupsResponse.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleDeleteGroupsResponse() {
+ }
+
+ public TAlterSentryRoleDeleteGroupsResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleDeleteGroupsResponse(TAlterSentryRoleDeleteGroupsResponse other) {
+ if (other.isSetStatus()) {
+ this.status = other.status;
+ }
+ }
+
+ public TAlterSentryRoleDeleteGroupsResponse deepCopy() {
+ return new TAlterSentryRoleDeleteGroupsResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ }
+
+ 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 void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ }
+ 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();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleDeleteGroupsResponse)
+ return this.equals((TAlterSentryRoleDeleteGroupsResponse)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleDeleteGroupsResponse 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;
+ }
+
+ 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);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TAlterSentryRoleDeleteGroupsResponse 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;
+ }
+ }
+ 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("TAlterSentryRoleDeleteGroupsResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ 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());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TAlterSentryRoleDeleteGroupsResponseStandardSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleDeleteGroupsResponseStandardScheme getScheme() {
+ return new TAlterSentryRoleDeleteGroupsResponseStandardScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleDeleteGroupsResponseStandardScheme extends StandardScheme<TAlterSentryRoleDeleteGroupsResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleDeleteGroupsResponse 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;
+ 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, TAlterSentryRoleDeleteGroupsResponse 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.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAlterSentryRoleDeleteGroupsResponseTupleSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleDeleteGroupsResponseTupleScheme getScheme() {
+ return new TAlterSentryRoleDeleteGroupsResponseTupleScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleDeleteGroupsResponseTupleScheme extends TupleScheme<TAlterSentryRoleDeleteGroupsResponse> {
+
+ @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 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);
+ }
+ }
+
+}
+
[25/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryMetrics.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryMetrics.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryMetrics.java
new file mode 100644
index 0000000..80a6343
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryMetrics.java
@@ -0,0 +1,413 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.service.thrift;
+
+import com.codahale.metrics.ConsoleReporter;
+import com.codahale.metrics.Counter;
+import com.codahale.metrics.Gauge;
+import com.codahale.metrics.Histogram;
+import com.codahale.metrics.JmxReporter;
+import com.codahale.metrics.Metric;
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.MetricSet;
+import com.codahale.metrics.Slf4jReporter;
+import com.codahale.metrics.Timer;
+import com.codahale.metrics.json.MetricsModule;
+import com.codahale.metrics.jvm.BufferPoolMetricSet;
+import com.codahale.metrics.jvm.GarbageCollectorMetricSet;
+import com.codahale.metrics.jvm.MemoryUsageGaugeSet;
+import com.codahale.metrics.jvm.ThreadStatesGaugeSet;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.sentry.provider.db.service.persistent.SentryStore;
+import org.apache.sentry.service.thrift.SentryService;
+import org.apache.sentry.api.common.SentryServiceUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.nio.file.attribute.FileAttribute;
+import java.nio.file.attribute.PosixFilePermission;
+import java.nio.file.attribute.PosixFilePermissions;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import static com.codahale.metrics.MetricRegistry.name;
+import static org.apache.sentry.api.service.thrift.SentryMetricsServletContextListener.METRIC_REGISTRY;
+import static org.apache.sentry.service.common.ServiceConstants.ServerConfig;
+
+/**
+ * A singleton class which holds metrics related utility functions as well as the list of metrics.
+ */
+public final class SentryMetrics {
+ public enum Reporting {
+ JMX,
+ CONSOLE,
+ LOG,
+ JSON,
+ }
+
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(SentryMetrics.class);
+
+ private static SentryMetrics sentryMetrics = null;
+ private final AtomicBoolean reportingInitialized = new AtomicBoolean();
+ private boolean gaugesAdded = false;
+ private boolean sentryServiceGaugesAdded = false;
+
+ final Timer createRoleTimer = METRIC_REGISTRY.timer(
+ name(SentryPolicyStoreProcessor.class, "create-role"));
+ final Timer dropRoleTimer = METRIC_REGISTRY.timer(
+ name(SentryPolicyStoreProcessor.class, "drop-role"));
+ final Timer grantRoleTimer = METRIC_REGISTRY.timer(
+ name(SentryPolicyStoreProcessor.class, "grant-role"));
+ final Timer revokeRoleTimer = METRIC_REGISTRY.timer(
+ name(SentryPolicyStoreProcessor.class, "revoke-role"));
+ final Timer grantTimer = METRIC_REGISTRY.timer(
+ name(SentryPolicyStoreProcessor.class, "grant-privilege"));
+ final Timer revokeTimer = METRIC_REGISTRY.timer(
+ name(SentryPolicyStoreProcessor.class, "revoke-privilege"));
+
+ final Timer dropPrivilegeTimer = METRIC_REGISTRY.timer(
+ name(SentryPolicyStoreProcessor.class, "drop-privilege"));
+ final Timer renamePrivilegeTimer = METRIC_REGISTRY.timer(
+ name(SentryPolicyStoreProcessor.class, "rename-privilege"));
+
+ final Timer listRolesByGroupTimer = METRIC_REGISTRY.timer(
+ name(SentryPolicyStoreProcessor.class, "list-roles-by-group"));
+ final Timer listPrivilegesByRoleTimer = METRIC_REGISTRY.timer(
+ name(SentryPolicyStoreProcessor.class, "list-privileges-by-role"));
+ final Timer listPrivilegesForProviderTimer = METRIC_REGISTRY.timer(
+ name(SentryPolicyStoreProcessor.class, "list-privileges-for-provider"));
+ final Timer listPrivilegesByAuthorizableTimer = METRIC_REGISTRY.timer(
+ name(SentryPolicyStoreProcessor.class, "list-privileges-by-authorizable"));
+
+ /**
+ * Return a Timer with name.
+ */
+ public Timer getTimer(String name) {
+ return METRIC_REGISTRY.timer(name);
+ }
+
+ /**
+ * Return a Histogram with name.
+ */
+ public Histogram getHistogram(String name) {
+ return METRIC_REGISTRY.histogram(name);
+ }
+
+ /**
+ * Return a Counter with name.
+ */
+ public Counter getCounter(String name) {
+ return METRIC_REGISTRY.counter(name);
+ }
+
+ private SentryMetrics() {
+ registerMetricSet("gc", new GarbageCollectorMetricSet(), METRIC_REGISTRY);
+ registerMetricSet("buffers",
+ new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()),
+ METRIC_REGISTRY);
+ registerMetricSet("memory", new MemoryUsageGaugeSet(), METRIC_REGISTRY);
+ registerMetricSet("threads", new ThreadStatesGaugeSet(), METRIC_REGISTRY);
+ }
+
+ /**
+ * Get singleton instance.
+ */
+ public static synchronized SentryMetrics getInstance() {
+ if (sentryMetrics == null) {
+ sentryMetrics = new SentryMetrics();
+ }
+ return sentryMetrics;
+ }
+
+ void addSentryStoreGauges(SentryStore sentryStore) {
+ if (!gaugesAdded) {
+ addGauge(SentryStore.class, "role_count", sentryStore.getRoleCountGauge());
+ addGauge(SentryStore.class, "privilege_count",
+ sentryStore.getPrivilegeCountGauge());
+ addGauge(SentryStore.class, "group_count", sentryStore.getGroupCountGauge());
+ addGauge(SentryStore.class, "hms.waiters", sentryStore.getHMSWaitersCountGauge());
+ addGauge(SentryStore.class, "hms.notification.id",
+ sentryStore.getLastNotificationIdGauge());
+ addGauge(SentryStore.class, "hms.snapshot.paths.id",
+ sentryStore.getLastPathsSnapshotIdGauge());
+ addGauge(SentryStore.class, "hms.perm.change.id",
+ sentryStore.getPermChangeIdGauge());
+ addGauge(SentryStore.class, "hms.psth.change.id",
+ sentryStore.getPathChangeIdGauge());
+ gaugesAdded = true;
+ }
+ }
+
+ /**
+ * Add gauges for the SentryService class.
+ * @param sentryservice
+ */
+ public void addSentryServiceGauges(SentryService sentryservice) {
+ if (!sentryServiceGaugesAdded) {
+ addGauge(SentryService.class, "is_active", sentryservice.getIsActiveGauge());
+ addGauge(SentryService.class, "activated", sentryservice.getBecomeActiveCount());
+ sentryServiceGaugesAdded = true;
+ }
+ }
+
+ /**
+ * Initialize reporters. Only initializes once.<p>
+ *
+ * Available reporters:
+ * <ul>
+ * <li>console</li>
+ * <li>log</li>
+ * <li>jmx</li>
+ * </ul>
+ *
+ * <p><For console reporter configre it to report every
+ * <em>SENTRY_REPORTER_INTERVAL_SEC</em> seconds.
+ *
+ * <p>Method is thread safe.
+ */
+ @SuppressWarnings("squid:S2095")
+ void initReporting(Configuration conf) {
+ final String reporter = conf.get(ServerConfig.SENTRY_REPORTER);
+ if ((reporter == null) || reporter.isEmpty() || reportingInitialized.getAndSet(true)) {
+ // Nothing to do, just return
+ return;
+ }
+
+ final int reportInterval =
+ conf.getInt(ServerConfig.SENTRY_REPORTER_INTERVAL_SEC,
+ ServerConfig.SENTRY_REPORTER_INTERVAL_DEFAULT);
+
+ // Get list of configured reporters
+ Set<String> reporters = new HashSet<>();
+ for (String r: reporter.split(",")) {
+ reporters.add(r.trim().toUpperCase());
+ }
+
+ // In case there are no reporters, configure JSON reporter
+ if (reporters.isEmpty()) {
+ reporters.add(Reporting.JSON.toString());
+ }
+
+ // Configure all reporters
+ for (String r: reporters) {
+ switch (SentryMetrics.Reporting.valueOf(r)) {
+ case CONSOLE:
+ LOGGER.info("Enabled console metrics reporter with {} seconds interval",
+ reportInterval);
+ final ConsoleReporter consoleReporter =
+ ConsoleReporter.forRegistry(METRIC_REGISTRY)
+ .convertRatesTo(TimeUnit.SECONDS)
+ .convertDurationsTo(TimeUnit.MILLISECONDS)
+ .build();
+ consoleReporter.start(reportInterval, TimeUnit.SECONDS);
+ break;
+ case JMX:
+ LOGGER.info("Enabled JMX metrics reporter");
+ final JmxReporter jmxReporter = JmxReporter.forRegistry(METRIC_REGISTRY)
+ .convertRatesTo(TimeUnit.SECONDS)
+ .convertDurationsTo(TimeUnit.MILLISECONDS)
+ .build();
+ jmxReporter.start();
+ break;
+ case LOG:
+ LOGGER.info("Enabled Log4J metrics reporter with {} seconds interval",
+ reportInterval);
+ final Slf4jReporter logReporter = Slf4jReporter.forRegistry(METRIC_REGISTRY)
+ .outputTo(LOGGER)
+ .convertRatesTo(TimeUnit.SECONDS)
+ .convertDurationsTo(TimeUnit.MILLISECONDS)
+ .build();
+ logReporter.start(reportInterval, TimeUnit.SECONDS);
+ break;
+ case JSON:
+ LOGGER.info("Enabled JSON metrics reporter with {} seconds interval", reportInterval);
+ JsonFileReporter jsonReporter = new JsonFileReporter(conf,
+ reportInterval, TimeUnit.SECONDS);
+ jsonReporter.start();
+ break;
+ default:
+ LOGGER.warn("Invalid metrics reporter {}", reporter);
+ break;
+ }
+ }
+ }
+
+ private <T, V> void addGauge(Class<T> tClass, String gaugeName, Gauge<V> gauge) {
+ METRIC_REGISTRY.register(
+ name(tClass, gaugeName), gauge);
+ }
+
+ private void registerMetricSet(String prefix, MetricSet metricSet, MetricRegistry registry) {
+ for (Map.Entry<String, Metric> entry : metricSet.getMetrics().entrySet()) {
+ if (entry.getValue() instanceof MetricSet) {
+ registerMetricSet(prefix + "." + entry.getKey(), (MetricSet) entry.getValue(), registry);
+ } else {
+ registry.register(prefix + "." + entry.getKey(), entry.getValue());
+ }
+ }
+ }
+
+ /**
+ * Custom reporter that writes metrics as a JSON file.
+ * This class originated from Apache Hive JSON reporter.
+ */
+ private static class JsonFileReporter implements AutoCloseable, Runnable {
+ //
+ // Implementation notes.
+ //
+ // 1. Since only local file systems are supported, there is no need to use Hadoop
+ // version of Path class.
+ // 2. java.nio package provides modern implementation of file and directory operations
+ // which is better then the traditional java.io, so we are using it here.
+ // In particular, it supports atomic creation of temporary files with specified
+ // permissions in the specified directory. This also avoids various attacks possible
+ // when temp file name is generated first, followed by file creation.
+ // See http://www.oracle.com/technetwork/articles/javase/nio-139333.html for
+ // the description of NIO API and
+ // http://docs.oracle.com/javase/tutorial/essential/io/legacy.html for the
+ // description of interoperability between legacy IO api vs NIO API.
+ // 3. To avoid race conditions with readers of the metrics file, the implementation
+ // dumps metrics to a temporary file in the same directory as the actual metrics
+ // file and then renames it to the destination. Since both are located on the same
+ // filesystem, this rename is likely to be atomic (as long as the underlying OS
+ // support atomic renames.
+ //
+
+ // Permissions for the metrics file
+ private static final FileAttribute<Set<PosixFilePermission>> FILE_ATTRS =
+ PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rw-r--r--"));
+ private static final String JSON_REPORTER_THREAD_NAME = "json-reporter";
+
+ private ScheduledExecutorService executor = null;
+ private final ObjectMapper jsonMapper =
+ new ObjectMapper().registerModule(new MetricsModule(TimeUnit.SECONDS,
+ TimeUnit.MILLISECONDS,
+ false));
+ private final Configuration conf;
+ /** Destination file name. */
+ // Location of JSON file
+ private final Path path;
+ // tmpdir is the dirname(path)
+ private final Path tmpDir;
+ private final long interval;
+ private final TimeUnit unit;
+
+ JsonFileReporter(Configuration conf, long interval, TimeUnit unit) {
+ this.conf = conf;
+ String pathString = conf.get(ServerConfig.SENTRY_JSON_REPORTER_FILE,
+ ServerConfig.SENTRY_JSON_REPORTER_FILE_DEFAULT);
+ path = Paths.get(pathString).toAbsolutePath();
+ LOGGER.info("Reporting metrics to {}", path);
+ // We want to use tmpDir i the same directory as the destination file to support atomic
+ // move of temp file to the destination metrics file
+ tmpDir = path.getParent();
+ this.interval = interval;
+ this.unit = unit;
+ }
+
+ private void start() {
+ executor = Executors.newScheduledThreadPool(1,
+ new ThreadFactoryBuilder().setNameFormat(JSON_REPORTER_THREAD_NAME).build());
+ executor.scheduleAtFixedRate(this, 0, interval, unit);
+ }
+
+ @Override
+ public void run() {
+ Path tmpFile = null;
+ try {
+ String json = null;
+ try {
+ json = jsonMapper.writerWithDefaultPrettyPrinter().writeValueAsString(METRIC_REGISTRY);
+ } catch (JsonProcessingException e) {
+ LOGGER.error("Error converting metrics to JSON", e);
+ return;
+ }
+ // Metrics are first dumped to a temp file which is then renamed to the destination
+ try {
+ tmpFile = Files.createTempFile(tmpDir, "smetrics", "json", FILE_ATTRS);
+ } catch (IOException e) {
+ LOGGER.error("failed to create temp file for JSON metrics", e);
+ return;
+ } catch (SecurityException e) {
+ // This shouldn't ever happen
+ LOGGER.error("failed to create temp file for JSON metrics: no permissions", e);
+ return;
+ } catch (UnsupportedOperationException e) {
+ // This shouldn't ever happen
+ LOGGER.error("failed to create temp file for JSON metrics: operartion not supported", e);
+ return;
+ }
+
+ try (BufferedWriter bw = new BufferedWriter(new FileWriter(tmpFile.toFile()))) {
+ bw.write(json);
+ }
+
+ // Move temp file to the destination file
+ try {
+ Files.move(tmpFile, path, StandardCopyOption.ATOMIC_MOVE);
+ } catch (Exception e) {
+ LOGGER.error("Failed to move temp metrics file to {}: {}", path, e.getMessage());
+ }
+ } catch (Throwable t) {
+ // catch all errors (throwable and execptions to prevent subsequent tasks from being suppressed)
+ LOGGER.error("Error executing scheduled task ", t);
+ } finally {
+ // If something happened and we were not able to rename the temp file, attempt to remove it
+ if (tmpFile != null && tmpFile.toFile().exists()) {
+ // Attempt to delete temp file, if this fails, not much can be done about it.
+ try {
+ Files.delete(tmpFile);
+ } catch (Exception e) {
+ LOGGER.error("failed to delete yemporary metrics file {}", tmpFile, e);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void close() {
+ if (executor != null) {
+ SentryServiceUtil.shutdownAndAwaitTermination(executor,
+ JSON_REPORTER_THREAD_NAME, 1, TimeUnit.MINUTES, LOGGER);
+ executor = null;
+ }
+ try {
+ Files.delete(path);
+ } catch (IOException e) {
+ LOGGER.error("Unable to delete {}", path, e);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryMetricsServletContextListener.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryMetricsServletContextListener.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryMetricsServletContextListener.java
new file mode 100644
index 0000000..253e54f
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryMetricsServletContextListener.java
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.service.thrift;
+
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.servlets.MetricsServlet;
+
+public class SentryMetricsServletContextListener extends MetricsServlet.ContextListener {
+
+ public static final MetricRegistry METRIC_REGISTRY = new MetricRegistry();
+
+ @Override
+ protected MetricRegistry getMetricRegistry() {
+ return METRIC_REGISTRY;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryPolicyStoreProcessor.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryPolicyStoreProcessor.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryPolicyStoreProcessor.java
new file mode 100644
index 0000000..816cfe1
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryPolicyStoreProcessor.java
@@ -0,0 +1,1236 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sentry.api.service.thrift;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeoutException;
+import java.util.regex.Pattern;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.sentry.api.common.ThriftConstants;
+import org.apache.sentry.core.common.exception.SentryUserException;
+import org.apache.sentry.core.common.exception.SentrySiteConfigurationException;
+import org.apache.sentry.core.model.db.AccessConstants;
+import org.apache.sentry.provider.common.GroupMappingService;
+import org.apache.sentry.core.common.utils.PolicyFileConstants;
+import org.apache.sentry.core.common.exception.SentryGroupNotFoundException;
+import org.apache.sentry.core.common.exception.SentryAccessDeniedException;
+import org.apache.sentry.core.common.exception.SentryAlreadyExistsException;
+import org.apache.sentry.core.common.exception.SentryInvalidInputException;
+import org.apache.sentry.core.common.exception.SentryNoSuchObjectException;
+import org.apache.sentry.provider.db.SentryPolicyStorePlugin;
+import org.apache.sentry.provider.db.SentryPolicyStorePlugin.SentryPluginException;
+import org.apache.sentry.core.common.exception.SentryThriftAPIMismatchException;
+import org.apache.sentry.provider.db.log.entity.JsonLogEntity;
+import org.apache.sentry.provider.db.log.entity.JsonLogEntityFactory;
+import org.apache.sentry.provider.db.log.util.Constants;
+import org.apache.sentry.provider.db.service.persistent.SentryStore;
+import org.apache.sentry.core.common.utils.PolicyStoreConstants.PolicyStoreServerConfig;
+import org.apache.sentry.api.service.thrift.validator.GrantPrivilegeRequestValidator;
+import org.apache.sentry.api.service.thrift.validator.RevokePrivilegeRequestValidator;
+import org.apache.sentry.api.common.SentryServiceUtil;
+import org.apache.sentry.service.common.ServiceConstants.ConfUtilties;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
+import org.apache.sentry.api.common.Status;
+import org.apache.sentry.service.thrift.TSentryResponseStatus;
+import org.apache.thrift.TException;
+import org.apache.log4j.Logger;
+
+import com.codahale.metrics.Timer;
+import static com.codahale.metrics.MetricRegistry.name;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+
+import static org.apache.sentry.hdfs.Updateable.Update;
+
+@SuppressWarnings("unused")
+public class SentryPolicyStoreProcessor implements SentryPolicyService.Iface {
+ private static final Logger LOGGER = Logger.getLogger(SentryPolicyStoreProcessor.class);
+ private static final Logger AUDIT_LOGGER = Logger.getLogger(Constants.AUDIT_LOGGER_NAME);
+
+ private final String name;
+ private final Configuration conf;
+ private final SentryStore sentryStore;
+ private final NotificationHandlerInvoker notificationHandlerInvoker;
+ private final ImmutableSet<String> adminGroups;
+ private SentryMetrics sentryMetrics;
+ private final Timer hmsWaitTimer =
+ SentryMetrics.getInstance().
+ getTimer(name(SentryPolicyStoreProcessor.class, "hms", "wait"));
+
+ private List<SentryPolicyStorePlugin> sentryPlugins = new LinkedList<SentryPolicyStorePlugin>();
+
+ SentryPolicyStoreProcessor(String name,
+ Configuration conf, SentryStore store) throws Exception {
+ super();
+ this.name = name;
+ this.conf = conf;
+ this.sentryStore = store;
+ this.notificationHandlerInvoker = new NotificationHandlerInvoker(conf,
+ createHandlers(conf));
+ adminGroups = ImmutableSet.copyOf(toTrimedLower(Sets.newHashSet(conf.getStrings(
+ ServerConfig.ADMIN_GROUPS, new String[]{}))));
+ Iterable<String> pluginClasses = ConfUtilties.CLASS_SPLITTER
+ .split(conf.get(ServerConfig.SENTRY_POLICY_STORE_PLUGINS,
+ ServerConfig.SENTRY_POLICY_STORE_PLUGINS_DEFAULT).trim());
+ for (String pluginClassStr : pluginClasses) {
+ Class<?> clazz = conf.getClassByName(pluginClassStr);
+ if (!SentryPolicyStorePlugin.class.isAssignableFrom(clazz)) {
+ throw new IllegalArgumentException("Sentry Plugin ["
+ + pluginClassStr + "] is not a "
+ + SentryPolicyStorePlugin.class.getName());
+ }
+ SentryPolicyStorePlugin plugin = (SentryPolicyStorePlugin)clazz.newInstance();
+ plugin.initialize(conf, sentryStore);
+ sentryPlugins.add(plugin);
+ }
+ initMetrics();
+ }
+
+ private void initMetrics() {
+ sentryMetrics = SentryMetrics.getInstance();
+ sentryMetrics.addSentryStoreGauges(sentryStore);
+ sentryMetrics.initReporting(conf);
+ }
+
+ public void stop() {
+ sentryStore.stop();
+ }
+
+ public void registerPlugin(SentryPolicyStorePlugin plugin) throws SentryPluginException {
+ plugin.initialize(conf, sentryStore);
+ sentryPlugins.add(plugin);
+ }
+
+ @VisibleForTesting
+ static List<NotificationHandler> createHandlers(Configuration conf)
+ throws SentrySiteConfigurationException {
+ List<NotificationHandler> handlers = Lists.newArrayList();
+ Iterable<String> notificationHandlers = Splitter.onPattern("[\\s,]").trimResults()
+ .omitEmptyStrings().split(conf.get(PolicyStoreServerConfig.NOTIFICATION_HANDLERS, ""));
+ for (String notificationHandler : notificationHandlers) {
+ Class<?> clazz = null;
+ try {
+ clazz = Class.forName(notificationHandler);
+ if (!NotificationHandler.class.isAssignableFrom(clazz)) {
+ throw new SentrySiteConfigurationException("Class " + notificationHandler + " is not a " +
+ NotificationHandler.class.getName());
+ }
+ } catch (ClassNotFoundException e) {
+ throw new SentrySiteConfigurationException("Value " + notificationHandler +
+ " is not a class", e);
+ }
+ Preconditions.checkNotNull(clazz, "Error class cannot be null");
+ try {
+ Constructor<?> constructor = clazz.getConstructor(Configuration.class);
+ handlers.add((NotificationHandler)constructor.newInstance(conf));
+ } catch (Exception e) {
+ throw new SentrySiteConfigurationException("Error attempting to create " + notificationHandler, e);
+ }
+ }
+ return handlers;
+ }
+
+ @VisibleForTesting
+ public Configuration getSentryStoreConf() {
+ return conf;
+ }
+
+ private static Set<String> toTrimedLower(Set<String> s) {
+ Set<String> result = Sets.newHashSet();
+ for (String v : s) {
+ result.add(v.trim().toLowerCase());
+ }
+ return result;
+ }
+
+ private boolean inAdminGroups(Set<String> requestorGroups) {
+ Set<String> trimmedRequestorGroups = toTrimedLower(requestorGroups);
+ return !Sets.intersection(adminGroups, trimmedRequestorGroups).isEmpty();
+ }
+
+ private void authorize(String requestorUser, Set<String> requestorGroups)
+ throws SentryAccessDeniedException {
+ if (!inAdminGroups(requestorGroups)) {
+ String msg = "User: " + requestorUser + " is part of " + requestorGroups +
+ " which does not, intersect admin groups " + adminGroups;
+ LOGGER.warn(msg);
+ throw new SentryAccessDeniedException("Access denied to " + requestorUser);
+ }
+ }
+
+ @Override
+ public TCreateSentryRoleResponse create_sentry_role(
+ TCreateSentryRoleRequest request) throws TException {
+ final Timer.Context timerContext = sentryMetrics.createRoleTimer.time();
+ TCreateSentryRoleResponse response = new TCreateSentryRoleResponse();
+ try {
+ validateClientVersion(request.getProtocol_version());
+ authorize(request.getRequestorUserName(),
+ getRequestorGroups(request.getRequestorUserName()));
+ sentryStore.createSentryRole(request.getRoleName());
+ response.setStatus(Status.OK());
+ notificationHandlerInvoker.create_sentry_role(request, response);
+ } catch (SentryAlreadyExistsException e) {
+ String msg = "Role: " + request + " already exists.";
+ LOGGER.error(msg, e);
+ response.setStatus(Status.AlreadyExists(e.getMessage(), e));
+ } catch (SentryAccessDeniedException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryGroupNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryThriftAPIMismatchException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
+ } catch (Exception e) {
+ String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setStatus(Status.RuntimeError(msg, e));
+ } finally {
+ timerContext.stop();
+ }
+
+ try {
+ AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
+ .createJsonLogEntity(request, response, conf).toJsonFormatLog());
+ } catch (Exception e) {
+ // if any exception, log the exception.
+ String msg = "Error creating audit log for create role: " + e.getMessage();
+ LOGGER.error(msg, e);
+ }
+ return response;
+ }
+
+ @Override
+ public TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege
+ (TAlterSentryRoleGrantPrivilegeRequest request) throws TException {
+ final Timer.Context timerContext = sentryMetrics.grantTimer.time();
+ TAlterSentryRoleGrantPrivilegeResponse response = new TAlterSentryRoleGrantPrivilegeResponse();
+ try {
+ validateClientVersion(request.getProtocol_version());
+ // There should only one field be set
+ if ( !(request.isSetPrivileges()^request.isSetPrivilege()) ) {
+ throw new SentryUserException("SENTRY API version is not right!");
+ }
+ // Maintain compatibility for old API: Set privilege field to privileges field
+ if (request.isSetPrivilege()) {
+ request.setPrivileges(Sets.newHashSet(request.getPrivilege()));
+ }
+ // TODO: now only has SentryPlugin. Once add more SentryPolicyStorePlugins,
+ // TODO: need to differentiate the updates for different Plugins.
+ Preconditions.checkState(sentryPlugins.size() <= 1);
+ Map<TSentryPrivilege, Update> privilegesUpdateMap = new HashMap<>();
+ for (SentryPolicyStorePlugin plugin : sentryPlugins) {
+ plugin.onAlterSentryRoleGrantPrivilege(request, privilegesUpdateMap);
+ }
+
+ if (!privilegesUpdateMap.isEmpty()) {
+ sentryStore.alterSentryRoleGrantPrivileges(request.getRequestorUserName(),
+ request.getRoleName(), request.getPrivileges(), privilegesUpdateMap);
+ } else {
+ sentryStore.alterSentryRoleGrantPrivileges(request.getRequestorUserName(),
+ request.getRoleName(), request.getPrivileges());
+ }
+ GrantPrivilegeRequestValidator.validate(request);
+ response.setStatus(Status.OK());
+ response.setPrivileges(request.getPrivileges());
+ // Maintain compatibility for old API: Set privilege field to response
+ if (response.isSetPrivileges() && response.getPrivileges().size() == 1) {
+ response.setPrivilege(response.getPrivileges().iterator().next());
+ }
+ notificationHandlerInvoker.alter_sentry_role_grant_privilege(request,
+ response);
+ } catch (SentryNoSuchObjectException e) {
+ String msg = "Role: " + request.getRoleName() + " doesn't exist";
+ LOGGER.error(msg, e);
+ response.setStatus(Status.NoSuchObject(msg, e));
+ } catch (SentryInvalidInputException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.InvalidInput(e.getMessage(), e));
+ } catch (SentryAccessDeniedException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryGroupNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryThriftAPIMismatchException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
+ } catch (Exception e) {
+ String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setStatus(Status.RuntimeError(msg, e));
+ } finally {
+ timerContext.stop();
+ }
+
+ try {
+ Set<JsonLogEntity> jsonLogEntitys = JsonLogEntityFactory.getInstance().createJsonLogEntitys(
+ request, response, conf);
+ for (JsonLogEntity jsonLogEntity : jsonLogEntitys) {
+ AUDIT_LOGGER.info(jsonLogEntity.toJsonFormatLog());
+ }
+ } catch (Exception e) {
+ // if any exception, log the exception.
+ String msg = "Error creating audit log for grant privilege to role: " + e.getMessage();
+ LOGGER.error(msg, e);
+ }
+ return response;
+ }
+
+ @Override
+ public TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege
+ (TAlterSentryRoleRevokePrivilegeRequest request) throws TException {
+ final Timer.Context timerContext = sentryMetrics.revokeTimer.time();
+ TAlterSentryRoleRevokePrivilegeResponse response = new TAlterSentryRoleRevokePrivilegeResponse();
+ try {
+ validateClientVersion(request.getProtocol_version());
+ // There should only one field be set
+ if ( !(request.isSetPrivileges()^request.isSetPrivilege()) ) {
+ throw new SentryUserException("SENTRY API version is not right!");
+ }
+ // Maintain compatibility for old API: Set privilege field to privileges field
+ if (request.isSetPrivilege()) {
+ request.setPrivileges(Sets.newHashSet(request.getPrivilege()));
+ }
+
+ // TODO: now only has SentryPlugin. Once add more SentryPolicyStorePlugins,
+ // TODO: need to differentiate the updates for different Plugins.
+ Preconditions.checkState(sentryPlugins.size() <= 1);
+ Map<TSentryPrivilege, Update> privilegesUpdateMap = new HashMap<>();
+ for (SentryPolicyStorePlugin plugin : sentryPlugins) {
+ plugin.onAlterSentryRoleRevokePrivilege(request, privilegesUpdateMap);
+ }
+
+ if (!privilegesUpdateMap.isEmpty()) {
+ sentryStore.alterSentryRoleRevokePrivileges(request.getRequestorUserName(),
+ request.getRoleName(), request.getPrivileges(), privilegesUpdateMap);
+ } else {
+ sentryStore.alterSentryRoleRevokePrivileges(request.getRequestorUserName(),
+ request.getRoleName(), request.getPrivileges());
+ }
+ RevokePrivilegeRequestValidator.validate(request);
+ response.setStatus(Status.OK());
+ notificationHandlerInvoker.alter_sentry_role_revoke_privilege(request,
+ response);
+ } catch (SentryNoSuchObjectException e) {
+ StringBuilder msg = new StringBuilder();
+ if (request.getPrivileges().size() > 0) {
+ for (TSentryPrivilege privilege : request.getPrivileges()) {
+ msg.append("Privilege: [server=");
+ msg.append(privilege.getServerName());
+ msg.append(",db=");
+ msg.append(privilege.getDbName());
+ msg.append(",table=");
+ msg.append(privilege.getTableName());
+ msg.append(",URI=");
+ msg.append(privilege.getURI());
+ msg.append(",action=");
+ msg.append(privilege.getAction());
+ msg.append("] ");
+ }
+ msg.append("doesn't exist.");
+ }
+ LOGGER.error(msg.toString(), e);
+ response.setStatus(Status.NoSuchObject(msg.toString(), e));
+ } catch (SentryInvalidInputException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.InvalidInput(e.getMessage(), e));
+ } catch (SentryAccessDeniedException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryGroupNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryThriftAPIMismatchException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
+ } catch (Exception e) {
+ String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setStatus(Status.RuntimeError(msg, e));
+ } finally {
+ timerContext.stop();
+ }
+
+ try {
+ Set<JsonLogEntity> jsonLogEntitys = JsonLogEntityFactory.getInstance().createJsonLogEntitys(
+ request, response, conf);
+ for (JsonLogEntity jsonLogEntity : jsonLogEntitys) {
+ AUDIT_LOGGER.info(jsonLogEntity.toJsonFormatLog());
+ }
+ } catch (Exception e) {
+ // if any exception, log the exception.
+ String msg = "Error creating audit log for revoke privilege from role: " + e.getMessage();
+ LOGGER.error(msg, e);
+ }
+ return response;
+ }
+
+ @Override
+ public TDropSentryRoleResponse drop_sentry_role(
+ TDropSentryRoleRequest request) throws TException {
+ final Timer.Context timerContext = sentryMetrics.dropRoleTimer.time();
+ TDropSentryRoleResponse response = new TDropSentryRoleResponse();
+ TSentryResponseStatus status;
+ try {
+ validateClientVersion(request.getProtocol_version());
+ authorize(request.getRequestorUserName(),
+ getRequestorGroups(request.getRequestorUserName()));
+
+ // TODO: now only has SentryPlugin. Once add more SentryPolicyStorePlugins,
+ // TODO: need to differentiate the updates for different Plugins.
+ Preconditions.checkState(sentryPlugins.size() <= 1);
+ Update update = null;
+ for (SentryPolicyStorePlugin plugin : sentryPlugins) {
+ update = plugin.onDropSentryRole(request);
+ }
+
+ if (update != null) {
+ sentryStore.dropSentryRole(request.getRoleName(), update);
+ } else {
+ sentryStore.dropSentryRole(request.getRoleName());
+ }
+ response.setStatus(Status.OK());
+ notificationHandlerInvoker.drop_sentry_role(request, response);
+ } catch (SentryNoSuchObjectException e) {
+ String msg = "Role :" + request + " doesn't exist";
+ LOGGER.error(msg, e);
+ response.setStatus(Status.NoSuchObject(msg, e));
+ } catch (SentryAccessDeniedException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryGroupNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryThriftAPIMismatchException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
+ } catch (Exception e) {
+ String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setStatus(Status.RuntimeError(msg, e));
+ } finally {
+ timerContext.stop();
+ }
+
+ try {
+ AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
+ .createJsonLogEntity(request, response, conf).toJsonFormatLog());
+ } catch (Exception e) {
+ // if any exception, log the exception.
+ String msg = "Error creating audit log for drop role: " + e.getMessage();
+ LOGGER.error(msg, e);
+ }
+ return response;
+ }
+
+ @Override
+ public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(
+ TAlterSentryRoleAddGroupsRequest request) throws TException {
+ final Timer.Context timerContext = sentryMetrics.grantRoleTimer.time();
+ TAlterSentryRoleAddGroupsResponse response = new TAlterSentryRoleAddGroupsResponse();
+ try {
+ validateClientVersion(request.getProtocol_version());
+ authorize(request.getRequestorUserName(),
+ getRequestorGroups(request.getRequestorUserName()));
+
+ // TODO: now only has SentryPlugin. Once add more SentryPolicyStorePlugins,
+ // TODO: need to differentiate the updates for different Plugins.
+ Preconditions.checkState(sentryPlugins.size() <= 1);
+ Update update = null;
+ for (SentryPolicyStorePlugin plugin : sentryPlugins) {
+ update = plugin.onAlterSentryRoleAddGroups(request);
+ }
+ if (update != null) {
+ sentryStore.alterSentryRoleAddGroups(request.getRequestorUserName(),
+ request.getRoleName(), request.getGroups(), update);
+ } else {
+ sentryStore.alterSentryRoleAddGroups(request.getRequestorUserName(),
+ request.getRoleName(), request.getGroups());
+ }
+ response.setStatus(Status.OK());
+ notificationHandlerInvoker.alter_sentry_role_add_groups(request,
+ response);
+ } catch (SentryNoSuchObjectException e) {
+ String msg = "Role: " + request + " doesn't exist";
+ LOGGER.error(msg, e);
+ response.setStatus(Status.NoSuchObject(msg, e));
+ } catch (SentryAccessDeniedException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryGroupNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryThriftAPIMismatchException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
+ } catch (Exception e) {
+ String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setStatus(Status.RuntimeError(msg, e));
+ } finally {
+ timerContext.stop();
+ }
+
+ try {
+ AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
+ .createJsonLogEntity(request, response, conf).toJsonFormatLog());
+ } catch (Exception e) {
+ // if any exception, log the exception.
+ String msg = "Error creating audit log for add role to group: " + e.getMessage();
+ LOGGER.error(msg, e);
+ }
+ return response;
+ }
+
+ @Override
+ public TAlterSentryRoleAddUsersResponse alter_sentry_role_add_users(
+ TAlterSentryRoleAddUsersRequest request) throws TException {
+ final Timer.Context timerContext = sentryMetrics.grantRoleTimer.time();
+ TAlterSentryRoleAddUsersResponse response = new TAlterSentryRoleAddUsersResponse();
+ try {
+ validateClientVersion(request.getProtocol_version());
+ authorize(request.getRequestorUserName(), getRequestorGroups(request.getRequestorUserName()));
+ sentryStore.alterSentryRoleAddUsers(request.getRoleName(), request.getUsers());
+ response.setStatus(Status.OK());
+ notificationHandlerInvoker.alter_sentry_role_add_users(request, response);
+ } catch (SentryNoSuchObjectException e) {
+ String msg = "Role: " + request + " does not exist.";
+ LOGGER.error(msg, e);
+ response.setStatus(Status.NoSuchObject(msg, e));
+ } catch (SentryAccessDeniedException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryGroupNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryThriftAPIMismatchException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
+ } catch (Exception e) {
+ String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setStatus(Status.RuntimeError(msg, e));
+ } finally {
+ timerContext.stop();
+ }
+
+ try {
+ AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
+ .createJsonLogEntity(request, response, conf).toJsonFormatLog());
+ } catch (Exception e) {
+ // if any exception, log the exception.
+ String msg = "Error creating audit log for add role to user: " + e.getMessage();
+ LOGGER.error(msg, e);
+ }
+ return response;
+ }
+
+ @Override
+ public TAlterSentryRoleDeleteUsersResponse alter_sentry_role_delete_users(
+ TAlterSentryRoleDeleteUsersRequest request) throws TException {
+ final Timer.Context timerContext = sentryMetrics.grantRoleTimer.time();
+ TAlterSentryRoleDeleteUsersResponse response = new TAlterSentryRoleDeleteUsersResponse();
+ try {
+ validateClientVersion(request.getProtocol_version());
+ authorize(request.getRequestorUserName(), getRequestorGroups(request.getRequestorUserName()));
+ sentryStore.alterSentryRoleDeleteUsers(request.getRoleName(),
+ request.getUsers());
+ response.setStatus(Status.OK());
+ notificationHandlerInvoker.alter_sentry_role_delete_users(request, response);
+ } catch (SentryNoSuchObjectException e) {
+ String msg = "Role: " + request + " does not exist.";
+ LOGGER.error(msg, e);
+ response.setStatus(Status.NoSuchObject(msg, e));
+ } catch (SentryAccessDeniedException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryGroupNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryThriftAPIMismatchException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
+ } catch (Exception e) {
+ String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setStatus(Status.RuntimeError(msg, e));
+ } finally {
+ timerContext.stop();
+ }
+
+ try {
+ AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
+ .createJsonLogEntity(request, response, conf).toJsonFormatLog());
+ } catch (Exception e) {
+ // if any exception, log the exception.
+ String msg = "Error creating audit log for delete role from user: " + e.getMessage();
+ LOGGER.error(msg, e);
+ }
+ return response;
+ }
+
+ @Override
+ public TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(
+ TAlterSentryRoleDeleteGroupsRequest request) throws TException {
+ final Timer.Context timerContext = sentryMetrics.revokeRoleTimer.time();
+ TAlterSentryRoleDeleteGroupsResponse response = new TAlterSentryRoleDeleteGroupsResponse();
+ try {
+ validateClientVersion(request.getProtocol_version());
+ authorize(request.getRequestorUserName(),
+ getRequestorGroups(request.getRequestorUserName()));
+
+ // TODO: now only has SentryPlugin. Once add more SentryPolicyStorePlugins,
+ // TODO: need to differentiate the updates for different Plugins.
+ Preconditions.checkState(sentryPlugins.size() <= 1);
+ Update update = null;
+ for (SentryPolicyStorePlugin plugin : sentryPlugins) {
+ update = plugin.onAlterSentryRoleDeleteGroups(request);
+ }
+
+ if (update != null) {
+ sentryStore.alterSentryRoleDeleteGroups(request.getRoleName(),
+ request.getGroups(), update);
+ } else {
+ sentryStore.alterSentryRoleDeleteGroups(request.getRoleName(),
+ request.getGroups());
+ }
+ response.setStatus(Status.OK());
+ notificationHandlerInvoker.alter_sentry_role_delete_groups(request,
+ response);
+ } catch (SentryNoSuchObjectException e) {
+ String msg = "Role: " + request + " does not exist.";
+ LOGGER.error(msg, e);
+ response.setStatus(Status.NoSuchObject(msg, e));
+ } catch (SentryAccessDeniedException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryGroupNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryThriftAPIMismatchException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
+ } catch (Exception e) {
+ String msg = "Unknown error adding groups to role: " + request;
+ LOGGER.error(msg, e);
+ response.setStatus(Status.RuntimeError(msg, e));
+ } finally {
+ timerContext.stop();
+ }
+
+ try {
+ AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
+ .createJsonLogEntity(request, response, conf).toJsonFormatLog());
+ } catch (Exception e) {
+ // if any exception, log the exception.
+ String msg = "Error creating audit log for delete role from group: " + e.getMessage();
+ LOGGER.error(msg, e);
+ }
+ return response;
+ }
+
+ @Override
+ public TListSentryRolesResponse list_sentry_roles_by_group(
+ TListSentryRolesRequest request) throws TException {
+ final Timer.Context timerContext = sentryMetrics.listRolesByGroupTimer.time();
+ TListSentryRolesResponse response = new TListSentryRolesResponse();
+ TSentryResponseStatus status;
+ Set<TSentryRole> roleSet = new HashSet<TSentryRole>();
+ String subject = request.getRequestorUserName();
+ boolean checkAllGroups = false;
+ try {
+ validateClientVersion(request.getProtocol_version());
+ Set<String> groups = getRequestorGroups(subject);
+ // Don't check admin permissions for listing requestor's own roles
+ if (AccessConstants.ALL.equalsIgnoreCase(request.getGroupName())) {
+ checkAllGroups = true;
+ } else {
+ boolean admin = inAdminGroups(groups);
+ //Only admin users can list all roles in the system ( groupname = null)
+ //Non admin users are only allowed to list only groups which they belong to
+ if(!admin && (request.getGroupName() == null || !groups.contains(request.getGroupName()))) {
+ throw new SentryAccessDeniedException("Access denied to " + subject);
+ } else {
+ groups.clear();
+ groups.add(request.getGroupName());
+ }
+ }
+ roleSet = sentryStore.getTSentryRolesByGroupName(groups, checkAllGroups);
+ response.setRoles(roleSet);
+ response.setStatus(Status.OK());
+ } catch (SentryNoSuchObjectException e) {
+ response.setRoles(roleSet);
+ String msg = "Request: " + request + " couldn't be completed, message: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setStatus(Status.NoSuchObject(msg, e));
+ } catch (SentryAccessDeniedException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryGroupNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryThriftAPIMismatchException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
+ } catch (Exception e) {
+ String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setStatus(Status.RuntimeError(msg, e));
+ } finally {
+ timerContext.stop();
+ }
+ return response;
+ }
+
+ public TListSentryRolesResponse list_sentry_roles_by_user(TListSentryRolesForUserRequest request)
+ throws TException {
+ final Timer.Context timerContext = sentryMetrics.listRolesByGroupTimer.time();
+ TListSentryRolesResponse response = new TListSentryRolesResponse();
+ TSentryResponseStatus status;
+ Set<TSentryRole> roleSet = new HashSet<TSentryRole>();
+ String requestor = request.getRequestorUserName();
+ String userName = request.getUserName();
+ boolean checkAllGroups = false;
+ try {
+ validateClientVersion(request.getProtocol_version());
+ // userName can't be empty
+ if (StringUtils.isEmpty(userName)) {
+ throw new SentryAccessDeniedException("The user name can't be empty.");
+ }
+
+ Set<String> requestorGroups;
+ try {
+ requestorGroups = getRequestorGroups(requestor);
+ } catch (SentryGroupNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ return response;
+ }
+
+ Set<String> userGroups;
+ try {
+ userGroups = getRequestorGroups(userName);
+ } catch (SentryGroupNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ String msg = "Groups for user " + userName + " do not exist: " + e.getMessage();
+ response.setStatus(Status.AccessDenied(msg, e));
+ return response;
+ }
+ boolean isAdmin = inAdminGroups(requestorGroups);
+
+ // Only admin users can list other user's roles in the system
+ // Non admin users are only allowed to list only their own roles related user and group
+ if (!isAdmin && !userName.equals(requestor)) {
+ throw new SentryAccessDeniedException("Access denied to list the roles for " + userName);
+ }
+ roleSet = sentryStore.getTSentryRolesByUserNames(Sets.newHashSet(userName));
+ response.setRoles(roleSet);
+ response.setStatus(Status.OK());
+ } catch (SentryNoSuchObjectException e) {
+ response.setRoles(roleSet);
+ String msg = "Role: " + request + " couldn't be retrieved.";
+ LOGGER.error(msg, e);
+ response.setStatus(Status.NoSuchObject(msg, e));
+ } catch (SentryAccessDeniedException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryThriftAPIMismatchException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
+ } catch (Exception e) {
+ String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setStatus(Status.RuntimeError(msg, e));
+ } finally {
+ timerContext.stop();
+ }
+ return response;
+ }
+
+ @Override
+ public TListSentryPrivilegesResponse list_sentry_privileges_by_role(
+ TListSentryPrivilegesRequest request) throws TException {
+ final Timer.Context timerContext = sentryMetrics.listPrivilegesByRoleTimer.time();
+ TListSentryPrivilegesResponse response = new TListSentryPrivilegesResponse();
+ TSentryResponseStatus status;
+ Set<TSentryPrivilege> privilegeSet = new HashSet<TSentryPrivilege>();
+ String subject = request.getRequestorUserName();
+ try {
+ validateClientVersion(request.getProtocol_version());
+ Set<String> groups = getRequestorGroups(subject);
+ Boolean admin = inAdminGroups(groups);
+ if(!admin) {
+ Set<String> roleNamesForGroups = toTrimedLower(sentryStore.getRoleNamesForGroups(groups));
+ if(!roleNamesForGroups.contains(request.getRoleName().trim().toLowerCase())) {
+ throw new SentryAccessDeniedException("Access denied to " + subject);
+ }
+ }
+ if (request.isSetAuthorizableHierarchy()) {
+ TSentryAuthorizable authorizableHierarchy = request.getAuthorizableHierarchy();
+ privilegeSet = sentryStore.getTSentryPrivileges(Sets.newHashSet(request.getRoleName()), authorizableHierarchy);
+ } else {
+ privilegeSet = sentryStore.getAllTSentryPrivilegesByRoleName(request.getRoleName());
+ }
+ response.setPrivileges(privilegeSet);
+ response.setStatus(Status.OK());
+ } catch (SentryNoSuchObjectException e) {
+ response.setPrivileges(privilegeSet);
+ String msg = "Privilege: " + request + " couldn't be retrieved.";
+ LOGGER.error(msg, e);
+ response.setStatus(Status.NoSuchObject(msg, e));
+ } catch (SentryAccessDeniedException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryGroupNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryThriftAPIMismatchException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
+ } catch (Exception e) {
+ String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setStatus(Status.RuntimeError(msg, e));
+ } finally {
+ timerContext.stop();
+ }
+ return response;
+ }
+
+ /**
+ * This method was created specifically for ProviderBackend.getPrivileges() and is not meant
+ * to be used for general privilege retrieval. More details in the .thrift file.
+ */
+ @Override
+ public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(
+ TListSentryPrivilegesForProviderRequest request) throws TException {
+ final Timer.Context timerContext = sentryMetrics.listPrivilegesForProviderTimer.time();
+ TListSentryPrivilegesForProviderResponse response = new TListSentryPrivilegesForProviderResponse();
+ response.setPrivileges(new HashSet<String>());
+ try {
+ validateClientVersion(request.getProtocol_version());
+ Set<String> privilegesForProvider =
+ sentryStore.listSentryPrivilegesForProvider(request.getGroups(), request.getUsers(),
+ request.getRoleSet(), request.getAuthorizableHierarchy());
+ response.setPrivileges(privilegesForProvider);
+ if (privilegesForProvider == null
+ || privilegesForProvider.size() == 0
+ && request.getAuthorizableHierarchy() != null
+ && sentryStore.hasAnyServerPrivileges(request.getGroups(), request.getUsers(),
+ request.getRoleSet(), request.getAuthorizableHierarchy().getServer())) {
+
+ // REQUIRED for ensuring 'default' Db is accessible by any user
+ // with privileges to atleast 1 object with the specific server as root
+
+ // Need some way to specify that even though user has no privilege
+ // For the specific AuthorizableHierarchy.. he has privilege on
+ // atleast 1 object in the server hierarchy
+ HashSet<String> serverPriv = Sets.newHashSet("server=+");
+ response.setPrivileges(serverPriv);
+ }
+ response.setStatus(Status.OK());
+ } catch (SentryThriftAPIMismatchException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
+ } catch (Exception e) {
+ String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setStatus(Status.RuntimeError(msg, e));
+ } finally {
+ timerContext.stop();
+ }
+ return response;
+ }
+
+ // retrieve the group mapping for the given user name
+ private Set<String> getRequestorGroups(String userName)
+ throws SentryUserException {
+ return getGroupsFromUserName(this.conf, userName);
+ }
+
+ public static Set<String> getGroupsFromUserName(Configuration conf,
+ String userName) throws SentryUserException {
+ String groupMapping = conf.get(ServerConfig.SENTRY_STORE_GROUP_MAPPING,
+ ServerConfig.SENTRY_STORE_GROUP_MAPPING_DEFAULT);
+ String authResoruce = conf
+ .get(ServerConfig.SENTRY_STORE_GROUP_MAPPING_RESOURCE);
+
+ // load the group mapping provider class
+ GroupMappingService groupMappingService;
+ try {
+ Constructor<?> constrctor = Class.forName(groupMapping)
+ .getDeclaredConstructor(Configuration.class, String.class);
+ constrctor.setAccessible(true);
+ groupMappingService = (GroupMappingService) constrctor
+ .newInstance(new Object[] { conf, authResoruce });
+ } catch (NoSuchMethodException e) {
+ throw new SentryUserException("Unable to instantiate group mapping", e);
+ } catch (SecurityException e) {
+ throw new SentryUserException("Unable to instantiate group mapping", e);
+ } catch (ClassNotFoundException e) {
+ throw new SentryUserException("Unable to instantiate group mapping", e);
+ } catch (InstantiationException e) {
+ throw new SentryUserException("Unable to instantiate group mapping", e);
+ } catch (IllegalAccessException e) {
+ throw new SentryUserException("Unable to instantiate group mapping", e);
+ } catch (IllegalArgumentException e) {
+ throw new SentryUserException("Unable to instantiate group mapping", e);
+ } catch (InvocationTargetException e) {
+ throw new SentryUserException("Unable to instantiate group mapping", e);
+ }
+ return groupMappingService.getGroups(userName);
+ }
+
+ @Override
+ public TDropPrivilegesResponse drop_sentry_privilege(
+ TDropPrivilegesRequest request) throws TException {
+ final Timer.Context timerContext = sentryMetrics.dropPrivilegeTimer.time();
+ TDropPrivilegesResponse response = new TDropPrivilegesResponse();
+ try {
+ validateClientVersion(request.getProtocol_version());
+ authorize(request.getRequestorUserName(), adminGroups);
+
+ // TODO: now only has SentryPlugin. Once add more SentryPolicyStorePlugins,
+ // TODO: need to differentiate the updates for different Plugins.
+ Preconditions.checkState(sentryPlugins.size() <= 1);
+ Update update = null;
+ for (SentryPolicyStorePlugin plugin : sentryPlugins) {
+ update = plugin.onDropSentryPrivilege(request);
+ }
+ if (update != null) {
+ sentryStore.dropPrivilege(request.getAuthorizable(), update);
+ } else {
+ sentryStore.dropPrivilege(request.getAuthorizable());
+ }
+ response.setStatus(Status.OK());
+ } catch (SentryAccessDeniedException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryGroupNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryThriftAPIMismatchException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
+ } catch (Exception e) {
+ String msg = "Unknown error for request: " + request + ", message: "
+ + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setStatus(Status.RuntimeError(msg, e));
+ } finally {
+ timerContext.stop();
+ }
+ return response;
+ }
+
+ @Override
+ public TRenamePrivilegesResponse rename_sentry_privilege(
+ TRenamePrivilegesRequest request) throws TException {
+ final Timer.Context timerContext = sentryMetrics.renamePrivilegeTimer.time();
+ TRenamePrivilegesResponse response = new TRenamePrivilegesResponse();
+ try {
+ validateClientVersion(request.getProtocol_version());
+ authorize(request.getRequestorUserName(), adminGroups);
+
+ // TODO: now only has SentryPlugin. Once add more SentryPolicyStorePlugins,
+ // TODO: need to differentiate the updates for different Plugins.
+ Preconditions.checkState(sentryPlugins.size() <= 1);
+ Update update = null;
+ for (SentryPolicyStorePlugin plugin : sentryPlugins) {
+ update = plugin.onRenameSentryPrivilege(request);
+ }
+ if (update != null) {
+ sentryStore.renamePrivilege(request.getOldAuthorizable(),
+ request.getNewAuthorizable(), update);
+ } else {
+ sentryStore.renamePrivilege(request.getOldAuthorizable(),
+ request.getNewAuthorizable());
+ }
+ response.setStatus(Status.OK());
+ } catch (SentryAccessDeniedException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryGroupNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryThriftAPIMismatchException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
+ } catch (SentryInvalidInputException e) {
+ response.setStatus(Status.InvalidInput(e.getMessage(), e));
+ }
+ catch (Exception e) {
+ String msg = "Unknown error for request: " + request + ", message: "
+ + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setStatus(Status.RuntimeError(msg, e));
+ } finally {
+ timerContext.close();
+ }
+ return response;
+ }
+
+ @Override
+ public TListSentryPrivilegesByAuthResponse list_sentry_privileges_by_authorizable(
+ TListSentryPrivilegesByAuthRequest request) throws TException {
+ final Timer.Context timerContext = sentryMetrics.listPrivilegesByAuthorizableTimer.time();
+ TListSentryPrivilegesByAuthResponse response = new TListSentryPrivilegesByAuthResponse();
+ Map<TSentryAuthorizable, TSentryPrivilegeMap> authRoleMap = Maps.newHashMap();
+ String subject = request.getRequestorUserName();
+ Set<String> requestedGroups = request.getGroups();
+ TSentryActiveRoleSet requestedRoleSet = request.getRoleSet();
+ try {
+ validateClientVersion(request.getProtocol_version());
+ Set<String> memberGroups = getRequestorGroups(subject);
+ if(!inAdminGroups(memberGroups)) {
+ // disallow non-admin to lookup groups that they are not part of
+ if (requestedGroups != null && !requestedGroups.isEmpty()) {
+ for (String requestedGroup : requestedGroups) {
+ if (!memberGroups.contains(requestedGroup)) {
+ // if user doesn't belong to one of the requested group then raise error
+ throw new SentryAccessDeniedException("Access denied to " + subject);
+ }
+ }
+ } else {
+ // non-admin's search is limited to it's own groups
+ requestedGroups = memberGroups;
+ }
+
+ // disallow non-admin to lookup roles that they are not part of
+ if (requestedRoleSet != null && !requestedRoleSet.isAll()) {
+ Set<String> roles = toTrimedLower(sentryStore
+ .getRoleNamesForGroups(memberGroups));
+ for (String role : toTrimedLower(requestedRoleSet.getRoles())) {
+ if (!roles.contains(role)) {
+ throw new SentryAccessDeniedException("Access denied to "
+ + subject);
+ }
+ }
+ }
+ }
+
+ // If user is not part of any group.. return empty response
+ for (TSentryAuthorizable authorizable : request.getAuthorizableSet()) {
+ authRoleMap.put(authorizable, sentryStore
+ .listSentryPrivilegesByAuthorizable(requestedGroups,
+ request.getRoleSet(), authorizable, inAdminGroups(memberGroups)));
+ }
+ response.setPrivilegesMapByAuth(authRoleMap);
+ response.setStatus(Status.OK());
+ // TODO : Sentry - HDFS : Have to handle this
+ } catch (SentryAccessDeniedException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryGroupNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryThriftAPIMismatchException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
+ } catch (Exception e) {
+ String msg = "Unknown error for request: " + request + ", message: "
+ + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setStatus(Status.RuntimeError(msg, e));
+ } finally {
+ timerContext.stop();
+ }
+ return response;
+ }
+
+ /**
+ * Respond to a request for a config value in the sentry server. The client
+ * can request any config value that starts with "sentry." and doesn't contain
+ * "keytab".
+ * @param request Contains config parameter sought and default if not found
+ * @return The response, containing the value and status
+ * @throws TException
+ */
+ @Override
+ public TSentryConfigValueResponse get_sentry_config_value(
+ TSentryConfigValueRequest request) throws TException {
+
+ final String requirePattern = "^sentry\\..*";
+ final String excludePattern = ".*keytab.*|.*\\.jdbc\\..*|.*password.*";
+
+ TSentryConfigValueResponse response = new TSentryConfigValueResponse();
+ String attr = request.getPropertyName();
+
+ try {
+ validateClientVersion(request.getProtocol_version());
+ } catch (SentryThriftAPIMismatchException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
+ }
+ // Only allow config parameters like...
+ if (!Pattern.matches(requirePattern, attr) ||
+ Pattern.matches(excludePattern, attr)) {
+ String msg = "Attempted access of the configuration property " + attr +
+ " was denied";
+ LOGGER.error(msg);
+ response.setStatus(Status.AccessDenied(msg,
+ new SentryAccessDeniedException(msg)));
+ return response;
+ }
+
+ response.setValue(conf.get(attr,request.getDefaultValue()));
+ response.setStatus(Status.OK());
+ return response;
+ }
+
+ @VisibleForTesting
+ static void validateClientVersion(int protocolVersion) throws SentryThriftAPIMismatchException {
+ if (ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT != protocolVersion) {
+ String msg = "Sentry thrift API protocol version mismatch: Client thrift version " +
+ "is: " + protocolVersion + " , server thrift verion " +
+ "is " + ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT;
+ throw new SentryThriftAPIMismatchException(msg);
+ }
+ }
+
+ // get the sentry mapping data and return the data with map structure
+ @Override
+ public TSentryExportMappingDataResponse export_sentry_mapping_data(
+ TSentryExportMappingDataRequest request) throws TException {
+ TSentryExportMappingDataResponse response = new TSentryExportMappingDataResponse();
+ try {
+ String requestor = request.getRequestorUserName();
+ Set<String> memberGroups = getRequestorGroups(requestor);
+ String objectPath = request.getObjectPath();
+ String databaseName = null;
+ String tableName = null;
+
+ Map<String, String> objectMap =
+ SentryServiceUtil.parseObjectPath(objectPath);
+ databaseName = objectMap.get(PolicyFileConstants.PRIVILEGE_DATABASE_NAME);
+ tableName = objectMap.get(PolicyFileConstants.PRIVILEGE_TABLE_NAME);
+
+ if (!inAdminGroups(memberGroups)) {
+ // disallow non-admin to import the metadata of sentry
+ throw new SentryAccessDeniedException("Access denied to " + requestor
+ + " for export the metadata of sentry.");
+ }
+ TSentryMappingData tSentryMappingData = new TSentryMappingData();
+ Map<String, Set<TSentryPrivilege>> rolePrivileges =
+ sentryStore.getRoleNameTPrivilegesMap(databaseName, tableName);
+ tSentryMappingData.setRolePrivilegesMap(rolePrivileges);
+ Set<String> roleNames = rolePrivileges.keySet();
+ // roleNames should be null if databaseName == null and tableName == null
+ if (databaseName == null && tableName == null) {
+ roleNames = null;
+ }
+ List<Map<String, Set<String>>> mapList = sentryStore.getGroupUserRoleMapList(
+ roleNames);
+ tSentryMappingData.setGroupRolesMap(mapList.get(
+ SentryStore.INDEX_GROUP_ROLES_MAP));
+ tSentryMappingData.setUserRolesMap(mapList.get(SentryStore.INDEX_USER_ROLES_MAP));
+
+ response.setMappingData(tSentryMappingData);
+ response.setStatus(Status.OK());
+ } catch (SentryAccessDeniedException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryGroupNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (Exception e) {
+ String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setMappingData(new TSentryMappingData());
+ response.setStatus(Status.RuntimeError(msg, e));
+ }
+ return response;
+ }
+
+ // import the sentry mapping data
+ @Override
+ public TSentryImportMappingDataResponse import_sentry_mapping_data(
+ TSentryImportMappingDataRequest request) throws TException {
+ TSentryImportMappingDataResponse response = new TSentryImportMappingDataResponse();
+ try {
+ String requestor = request.getRequestorUserName();
+ Set<String> memberGroups = getRequestorGroups(requestor);
+ if (!inAdminGroups(memberGroups)) {
+ // disallow non-admin to import the metadata of sentry
+ throw new SentryAccessDeniedException("Access denied to " + requestor
+ + " for import the metadata of sentry.");
+ }
+ sentryStore.importSentryMetaData(request.getMappingData(), request.isOverwriteRole());
+ response.setStatus(Status.OK());
+ } catch (SentryAccessDeniedException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryGroupNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryInvalidInputException e) {
+ String msg = "Invalid input privilege object";
+ LOGGER.error(msg, e);
+ response.setStatus(Status.InvalidInput(msg, e));
+ } catch (Exception e) {
+ String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setStatus(Status.RuntimeError(msg, e));
+ }
+ return response;
+ }
+
+ @Override
+ public TSentrySyncIDResponse sentry_sync_notifications(TSentrySyncIDRequest request)
+ throws TException {
+ TSentrySyncIDResponse response = new TSentrySyncIDResponse();
+ try (Timer.Context timerContext = hmsWaitTimer.time()) {
+ // Wait until Sentry Server processes specified HMS Notification ID.
+ response.setId(sentryStore.getCounterWait().waitFor(request.getId()));
+ response.setStatus(Status.OK());
+ } catch (InterruptedException e) {
+ String msg = String.format("wait request for id %d is interrupted",
+ request.getId());
+ LOGGER.error(msg, e);
+ response.setId(0);
+ response.setStatus(Status.RuntimeError(msg, e));
+ Thread.currentThread().interrupt();
+ } catch (TimeoutException e) {
+ String msg = String.format("timed out wait request for id %d", request.getId());
+ LOGGER.warn(msg, e);
+ response.setId(0);
+ response.setStatus(Status.RuntimeError(msg, e));
+ }
+ return response;
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryPolicyStoreProcessorFactory.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryPolicyStoreProcessorFactory.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryPolicyStoreProcessorFactory.java
new file mode 100644
index 0000000..fd209b7
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryPolicyStoreProcessorFactory.java
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.service.thrift;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.sentry.api.common.ApiConstants.SentryPolicyServiceConstants;
+import org.apache.sentry.provider.db.service.persistent.SentryStore;
+import org.apache.sentry.service.thrift.ProcessorFactory;
+import org.apache.thrift.TMultiplexedProcessor;
+import org.apache.thrift.TProcessor;
+
+public class SentryPolicyStoreProcessorFactory extends ProcessorFactory {
+ public SentryPolicyStoreProcessorFactory(Configuration conf) {
+ super(conf);
+ }
+
+ public boolean register(TMultiplexedProcessor multiplexedProcessor,
+ SentryStore sentryStore) throws Exception {
+ SentryPolicyStoreProcessor sentryServiceHandler =
+ new SentryPolicyStoreProcessor(SentryPolicyServiceConstants.SENTRY_POLICY_SERVICE_NAME,
+ conf, sentryStore);
+ TProcessor processor =
+ new SentryProcessorWrapper<SentryPolicyService.Iface>(sentryServiceHandler);
+ multiplexedProcessor.registerProcessor(
+ SentryPolicyServiceConstants.SENTRY_POLICY_SERVICE_NAME, processor);
+ return true;
+ }
+}
[32/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesRequest.java
deleted file mode 100644
index a05843b..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesRequest.java
+++ /dev/null
@@ -1,706 +0,0 @@
-/**
- * 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.provider.db.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 TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TListSentryPrivilegesRequest, TListSentryPrivilegesRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)4);
- private static final org.apache.thrift.protocol.TField AUTHORIZABLE_HIERARCHY_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizableHierarchy", org.apache.thrift.protocol.TType.STRUCT, (short)5);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryPrivilegesRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryPrivilegesRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private TSentryAuthorizable authorizableHierarchy; // optional
-
- /** 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)4, "roleName"),
- AUTHORIZABLE_HIERARCHY((short)5, "authorizableHierarchy");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 4: // ROLE_NAME
- return ROLE_NAME;
- case 5: // AUTHORIZABLE_HIERARCHY
- return AUTHORIZABLE_HIERARCHY;
- 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 byte __isset_bitfield = 0;
- private static final _Fields optionals[] = {_Fields.AUTHORIZABLE_HIERARCHY};
- 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.AUTHORIZABLE_HIERARCHY, new org.apache.thrift.meta_data.FieldMetaData("authorizableHierarchy", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- 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(TListSentryPrivilegesRequest.class, metaDataMap);
- }
-
- public TListSentryPrivilegesRequest() {
- this.protocol_version = 2;
-
- }
-
- public TListSentryPrivilegesRequest(
- int protocol_version,
- String requestorUserName,
- String roleName)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryPrivilegesRequest(TListSentryPrivilegesRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetAuthorizableHierarchy()) {
- this.authorizableHierarchy = new TSentryAuthorizable(other.authorizableHierarchy);
- }
- }
-
- public TListSentryPrivilegesRequest deepCopy() {
- return new TListSentryPrivilegesRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.authorizableHierarchy = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public TSentryAuthorizable getAuthorizableHierarchy() {
- return this.authorizableHierarchy;
- }
-
- public void setAuthorizableHierarchy(TSentryAuthorizable authorizableHierarchy) {
- this.authorizableHierarchy = authorizableHierarchy;
- }
-
- public void unsetAuthorizableHierarchy() {
- this.authorizableHierarchy = null;
- }
-
- /** Returns true if field authorizableHierarchy is set (has been assigned a value) and false otherwise */
- public boolean isSetAuthorizableHierarchy() {
- return this.authorizableHierarchy != null;
- }
-
- public void setAuthorizableHierarchyIsSet(boolean value) {
- if (!value) {
- this.authorizableHierarchy = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case AUTHORIZABLE_HIERARCHY:
- if (value == null) {
- unsetAuthorizableHierarchy();
- } else {
- setAuthorizableHierarchy((TSentryAuthorizable)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case AUTHORIZABLE_HIERARCHY:
- return getAuthorizableHierarchy();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case AUTHORIZABLE_HIERARCHY:
- return isSetAuthorizableHierarchy();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryPrivilegesRequest)
- return this.equals((TListSentryPrivilegesRequest)that);
- return false;
- }
-
- public boolean equals(TListSentryPrivilegesRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- boolean this_present_authorizableHierarchy = true && this.isSetAuthorizableHierarchy();
- boolean that_present_authorizableHierarchy = true && that.isSetAuthorizableHierarchy();
- if (this_present_authorizableHierarchy || that_present_authorizableHierarchy) {
- if (!(this_present_authorizableHierarchy && that_present_authorizableHierarchy))
- return false;
- if (!this.authorizableHierarchy.equals(that.authorizableHierarchy))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- boolean present_authorizableHierarchy = true && (isSetAuthorizableHierarchy());
- list.add(present_authorizableHierarchy);
- if (present_authorizableHierarchy)
- list.add(authorizableHierarchy);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TListSentryPrivilegesRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetAuthorizableHierarchy()).compareTo(other.isSetAuthorizableHierarchy());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAuthorizableHierarchy()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizableHierarchy, other.authorizableHierarchy);
- 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("TListSentryPrivilegesRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (isSetAuthorizableHierarchy()) {
- if (!first) sb.append(", ");
- sb.append("authorizableHierarchy:");
- if (this.authorizableHierarchy == null) {
- sb.append("null");
- } else {
- sb.append(this.authorizableHierarchy);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (authorizableHierarchy != null) {
- authorizableHierarchy.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 TListSentryPrivilegesRequestStandardSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesRequestStandardScheme getScheme() {
- return new TListSentryPrivilegesRequestStandardScheme();
- }
- }
-
- private static class TListSentryPrivilegesRequestStandardScheme extends StandardScheme<TListSentryPrivilegesRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // AUTHORIZABLE_HIERARCHY
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.authorizableHierarchy = new TSentryAuthorizable();
- struct.authorizableHierarchy.read(iprot);
- struct.setAuthorizableHierarchyIsSet(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, TListSentryPrivilegesRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.authorizableHierarchy != null) {
- if (struct.isSetAuthorizableHierarchy()) {
- oprot.writeFieldBegin(AUTHORIZABLE_HIERARCHY_FIELD_DESC);
- struct.authorizableHierarchy.write(oprot);
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryPrivilegesRequestTupleSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesRequestTupleScheme getScheme() {
- return new TListSentryPrivilegesRequestTupleScheme();
- }
- }
-
- private static class TListSentryPrivilegesRequestTupleScheme extends TupleScheme<TListSentryPrivilegesRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- BitSet optionals = new BitSet();
- if (struct.isSetAuthorizableHierarchy()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetAuthorizableHierarchy()) {
- struct.authorizableHierarchy.write(oprot);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.authorizableHierarchy = new TSentryAuthorizable();
- struct.authorizableHierarchy.read(iprot);
- struct.setAuthorizableHierarchyIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesResponse.java
deleted file mode 100644
index 969ea40..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesResponse.java
+++ /dev/null
@@ -1,558 +0,0 @@
-/**
- * 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.provider.db.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 TListSentryPrivilegesResponse implements org.apache.thrift.TBase<TListSentryPrivilegesResponse, TListSentryPrivilegesResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesResponse");
-
- 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 PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryPrivilegesResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryPrivilegesResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
- private Set<TSentryPrivilege> privileges; // optional
-
- /** 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"),
- PRIVILEGES((short)2, "privileges");
-
- 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: // PRIVILEGES
- return PRIVILEGES;
- 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 _Fields optionals[] = {_Fields.PRIVILEGES};
- 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.PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("privileges", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesResponse.class, metaDataMap);
- }
-
- public TListSentryPrivilegesResponse() {
- }
-
- public TListSentryPrivilegesResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryPrivilegesResponse(TListSentryPrivilegesResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- if (other.isSetPrivileges()) {
- Set<TSentryPrivilege> __this__privileges = new HashSet<TSentryPrivilege>(other.privileges.size());
- for (TSentryPrivilege other_element : other.privileges) {
- __this__privileges.add(new TSentryPrivilege(other_element));
- }
- this.privileges = __this__privileges;
- }
- }
-
- public TListSentryPrivilegesResponse deepCopy() {
- return new TListSentryPrivilegesResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- this.privileges = null;
- }
-
- 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 int getPrivilegesSize() {
- return (this.privileges == null) ? 0 : this.privileges.size();
- }
-
- public java.util.Iterator<TSentryPrivilege> getPrivilegesIterator() {
- return (this.privileges == null) ? null : this.privileges.iterator();
- }
-
- public void addToPrivileges(TSentryPrivilege elem) {
- if (this.privileges == null) {
- this.privileges = new HashSet<TSentryPrivilege>();
- }
- this.privileges.add(elem);
- }
-
- public Set<TSentryPrivilege> getPrivileges() {
- return this.privileges;
- }
-
- public void setPrivileges(Set<TSentryPrivilege> privileges) {
- this.privileges = privileges;
- }
-
- public void unsetPrivileges() {
- this.privileges = null;
- }
-
- /** Returns true if field privileges is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivileges() {
- return this.privileges != null;
- }
-
- public void setPrivilegesIsSet(boolean value) {
- if (!value) {
- this.privileges = null;
- }
- }
-
- 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 PRIVILEGES:
- if (value == null) {
- unsetPrivileges();
- } else {
- setPrivileges((Set<TSentryPrivilege>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- case PRIVILEGES:
- return getPrivileges();
-
- }
- 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 PRIVILEGES:
- return isSetPrivileges();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryPrivilegesResponse)
- return this.equals((TListSentryPrivilegesResponse)that);
- return false;
- }
-
- public boolean equals(TListSentryPrivilegesResponse 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_privileges = true && this.isSetPrivileges();
- boolean that_present_privileges = true && that.isSetPrivileges();
- if (this_present_privileges || that_present_privileges) {
- if (!(this_present_privileges && that_present_privileges))
- return false;
- if (!this.privileges.equals(that.privileges))
- 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_privileges = true && (isSetPrivileges());
- list.add(present_privileges);
- if (present_privileges)
- list.add(privileges);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TListSentryPrivilegesResponse 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(isSetPrivileges()).compareTo(other.isSetPrivileges());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivileges()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, other.privileges);
- 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("TListSentryPrivilegesResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- if (isSetPrivileges()) {
- if (!first) sb.append(", ");
- sb.append("privileges:");
- if (this.privileges == null) {
- sb.append("null");
- } else {
- sb.append(this.privileges);
- }
- 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());
- }
-
- // 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 {
- 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 TListSentryPrivilegesResponseStandardSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesResponseStandardScheme getScheme() {
- return new TListSentryPrivilegesResponseStandardScheme();
- }
- }
-
- private static class TListSentryPrivilegesResponseStandardScheme extends StandardScheme<TListSentryPrivilegesResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesResponse 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: // PRIVILEGES
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set72 = iprot.readSetBegin();
- struct.privileges = new HashSet<TSentryPrivilege>(2*_set72.size);
- TSentryPrivilege _elem73;
- for (int _i74 = 0; _i74 < _set72.size; ++_i74)
- {
- _elem73 = new TSentryPrivilege();
- _elem73.read(iprot);
- struct.privileges.add(_elem73);
- }
- iprot.readSetEnd();
- }
- struct.setPrivilegesIsSet(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, TListSentryPrivilegesResponse 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();
- }
- if (struct.privileges != null) {
- if (struct.isSetPrivileges()) {
- oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.privileges.size()));
- for (TSentryPrivilege _iter75 : struct.privileges)
- {
- _iter75.write(oprot);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryPrivilegesResponseTupleSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesResponseTupleScheme getScheme() {
- return new TListSentryPrivilegesResponseTupleScheme();
- }
- }
-
- private static class TListSentryPrivilegesResponseTupleScheme extends TupleScheme<TListSentryPrivilegesResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- BitSet optionals = new BitSet();
- if (struct.isSetPrivileges()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetPrivileges()) {
- {
- oprot.writeI32(struct.privileges.size());
- for (TSentryPrivilege _iter76 : struct.privileges)
- {
- _iter76.write(oprot);
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesResponse 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);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- {
- org.apache.thrift.protocol.TSet _set77 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.privileges = new HashSet<TSentryPrivilege>(2*_set77.size);
- TSentryPrivilege _elem78;
- for (int _i79 = 0; _i79 < _set77.size; ++_i79)
- {
- _elem78 = new TSentryPrivilege();
- _elem78.read(iprot);
- struct.privileges.add(_elem78);
- }
- }
- struct.setPrivilegesIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesForUserRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesForUserRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesForUserRequest.java
deleted file mode 100644
index f15edfd..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesForUserRequest.java
+++ /dev/null
@@ -1,591 +0,0 @@
-/**
- * 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.provider.db.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 TListSentryRolesForUserRequest implements org.apache.thrift.TBase<TListSentryRolesForUserRequest, TListSentryRolesForUserRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryRolesForUserRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryRolesForUserRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", org.apache.thrift.protocol.TType.STRING, (short)3);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryRolesForUserRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryRolesForUserRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String userName; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- USER_NAME((short)3, "userName");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // USER_NAME
- return USER_NAME;
- 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("userName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryRolesForUserRequest.class, metaDataMap);
- }
-
- public TListSentryRolesForUserRequest() {
- this.protocol_version = 1;
-
- }
-
- public TListSentryRolesForUserRequest(
- int protocol_version,
- String requestorUserName,
- String userName)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.userName = userName;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryRolesForUserRequest(TListSentryRolesForUserRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetUserName()) {
- this.userName = other.userName;
- }
- }
-
- public TListSentryRolesForUserRequest deepCopy() {
- return new TListSentryRolesForUserRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 1;
-
- this.requestorUserName = null;
- this.userName = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getUserName() {
- return this.userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public void unsetUserName() {
- this.userName = null;
- }
-
- /** Returns true if field userName is set (has been assigned a value) and false otherwise */
- public boolean isSetUserName() {
- return this.userName != null;
- }
-
- public void setUserNameIsSet(boolean value) {
- if (!value) {
- this.userName = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case USER_NAME:
- if (value == null) {
- unsetUserName();
- } else {
- setUserName((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case USER_NAME:
- return getUserName();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case USER_NAME:
- return isSetUserName();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryRolesForUserRequest)
- return this.equals((TListSentryRolesForUserRequest)that);
- return false;
- }
-
- public boolean equals(TListSentryRolesForUserRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_userName = true && this.isSetUserName();
- boolean that_present_userName = true && that.isSetUserName();
- if (this_present_userName || that_present_userName) {
- if (!(this_present_userName && that_present_userName))
- return false;
- if (!this.userName.equals(that.userName))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_userName = true && (isSetUserName());
- list.add(present_userName);
- if (present_userName)
- list.add(userName);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TListSentryRolesForUserRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetUserName()).compareTo(other.isSetUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userName, other.userName);
- 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("TListSentryRolesForUserRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("userName:");
- if (this.userName == null) {
- sb.append("null");
- } else {
- sb.append(this.userName);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'userName' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TListSentryRolesForUserRequestStandardSchemeFactory implements SchemeFactory {
- public TListSentryRolesForUserRequestStandardScheme getScheme() {
- return new TListSentryRolesForUserRequestStandardScheme();
- }
- }
-
- private static class TListSentryRolesForUserRequestStandardScheme extends StandardScheme<TListSentryRolesForUserRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryRolesForUserRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.userName = iprot.readString();
- struct.setUserNameIsSet(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, TListSentryRolesForUserRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.userName != null) {
- oprot.writeFieldBegin(USER_NAME_FIELD_DESC);
- oprot.writeString(struct.userName);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryRolesForUserRequestTupleSchemeFactory implements SchemeFactory {
- public TListSentryRolesForUserRequestTupleScheme getScheme() {
- return new TListSentryRolesForUserRequestTupleScheme();
- }
- }
-
- private static class TListSentryRolesForUserRequestTupleScheme extends TupleScheme<TListSentryRolesForUserRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesForUserRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.userName);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesForUserRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.userName = iprot.readString();
- struct.setUserNameIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesRequest.java
deleted file mode 100644
index 0d2a33e..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesRequest.java
+++ /dev/null
@@ -1,600 +0,0 @@
-/**
- * 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.provider.db.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 TListSentryRolesRequest implements org.apache.thrift.TBase<TListSentryRolesRequest, TListSentryRolesRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryRolesRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryRolesRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField GROUP_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("groupName", org.apache.thrift.protocol.TType.STRING, (short)3);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryRolesRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryRolesRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String groupName; // optional
-
- /** 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- GROUP_NAME((short)3, "groupName");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // GROUP_NAME
- return GROUP_NAME;
- 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 byte __isset_bitfield = 0;
- private static final _Fields optionals[] = {_Fields.GROUP_NAME};
- 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.GROUP_NAME, new org.apache.thrift.meta_data.FieldMetaData("groupName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryRolesRequest.class, metaDataMap);
- }
-
- public TListSentryRolesRequest() {
- this.protocol_version = 2;
-
- }
-
- public TListSentryRolesRequest(
- int protocol_version,
- String requestorUserName)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryRolesRequest(TListSentryRolesRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetGroupName()) {
- this.groupName = other.groupName;
- }
- }
-
- public TListSentryRolesRequest deepCopy() {
- return new TListSentryRolesRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.groupName = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getGroupName() {
- return this.groupName;
- }
-
- public void setGroupName(String groupName) {
- this.groupName = groupName;
- }
-
- public void unsetGroupName() {
- this.groupName = null;
- }
-
- /** Returns true if field groupName is set (has been assigned a value) and false otherwise */
- public boolean isSetGroupName() {
- return this.groupName != null;
- }
-
- public void setGroupNameIsSet(boolean value) {
- if (!value) {
- this.groupName = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case GROUP_NAME:
- if (value == null) {
- unsetGroupName();
- } else {
- setGroupName((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case GROUP_NAME:
- return getGroupName();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case GROUP_NAME:
- return isSetGroupName();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryRolesRequest)
- return this.equals((TListSentryRolesRequest)that);
- return false;
- }
-
- public boolean equals(TListSentryRolesRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_groupName = true && this.isSetGroupName();
- boolean that_present_groupName = true && that.isSetGroupName();
- if (this_present_groupName || that_present_groupName) {
- if (!(this_present_groupName && that_present_groupName))
- return false;
- if (!this.groupName.equals(that.groupName))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_groupName = true && (isSetGroupName());
- list.add(present_groupName);
- if (present_groupName)
- list.add(groupName);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TListSentryRolesRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGroupName()).compareTo(other.isSetGroupName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroupName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groupName, other.groupName);
- 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("TListSentryRolesRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (isSetGroupName()) {
- if (!first) sb.append(", ");
- sb.append("groupName:");
- if (this.groupName == null) {
- sb.append("null");
- } else {
- sb.append(this.groupName);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TListSentryRolesRequestStandardSchemeFactory implements SchemeFactory {
- public TListSentryRolesRequestStandardScheme getScheme() {
- return new TListSentryRolesRequestStandardScheme();
- }
- }
-
- private static class TListSentryRolesRequestStandardScheme extends StandardScheme<TListSentryRolesRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryRolesRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // GROUP_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.groupName = iprot.readString();
- struct.setGroupNameIsSet(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, TListSentryRolesRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.groupName != null) {
- if (struct.isSetGroupName()) {
- oprot.writeFieldBegin(GROUP_NAME_FIELD_DESC);
- oprot.writeString(struct.groupName);
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryRolesRequestTupleSchemeFactory implements SchemeFactory {
- public TListSentryRolesRequestTupleScheme getScheme() {
- return new TListSentryRolesRequestTupleScheme();
- }
- }
-
- private static class TListSentryRolesRequestTupleScheme extends TupleScheme<TListSentryRolesRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- BitSet optionals = new BitSet();
- if (struct.isSetGroupName()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetGroupName()) {
- oprot.writeString(struct.groupName);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.groupName = iprot.readString();
- struct.setGroupNameIsSet(true);
- }
- }
- }
-
-}
-
[41/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryRolesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryRolesResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryRolesResponse.java
deleted file mode 100644
index ec359ba..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryRolesResponse.java
+++ /dev/null
@@ -1,555 +0,0 @@
-/**
- * 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.provider.db.generic.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 TListSentryRolesResponse implements org.apache.thrift.TBase<TListSentryRolesResponse, TListSentryRolesResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryRolesResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryRolesResponse");
-
- 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 ROLES_FIELD_DESC = new org.apache.thrift.protocol.TField("roles", org.apache.thrift.protocol.TType.SET, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryRolesResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryRolesResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
- private Set<TSentryRole> roles; // optional
-
- /** 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"),
- ROLES((short)2, "roles");
-
- 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: // ROLES
- return ROLES;
- 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 _Fields optionals[] = {_Fields.ROLES};
- 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.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
- tmpMap.put(_Fields.ROLES, new org.apache.thrift.meta_data.FieldMetaData("roles", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryRole.class))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryRolesResponse.class, metaDataMap);
- }
-
- public TListSentryRolesResponse() {
- }
-
- public TListSentryRolesResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryRolesResponse(TListSentryRolesResponse other) {
- if (other.isSetStatus()) {
- this.status = other.status;
- }
- if (other.isSetRoles()) {
- Set<TSentryRole> __this__roles = new HashSet<TSentryRole>(other.roles.size());
- for (TSentryRole other_element : other.roles) {
- __this__roles.add(new TSentryRole(other_element));
- }
- this.roles = __this__roles;
- }
- }
-
- public TListSentryRolesResponse deepCopy() {
- return new TListSentryRolesResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- this.roles = null;
- }
-
- 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 int getRolesSize() {
- return (this.roles == null) ? 0 : this.roles.size();
- }
-
- public java.util.Iterator<TSentryRole> getRolesIterator() {
- return (this.roles == null) ? null : this.roles.iterator();
- }
-
- public void addToRoles(TSentryRole elem) {
- if (this.roles == null) {
- this.roles = new HashSet<TSentryRole>();
- }
- this.roles.add(elem);
- }
-
- public Set<TSentryRole> getRoles() {
- return this.roles;
- }
-
- public void setRoles(Set<TSentryRole> roles) {
- this.roles = roles;
- }
-
- public void unsetRoles() {
- this.roles = null;
- }
-
- /** Returns true if field roles is set (has been assigned a value) and false otherwise */
- public boolean isSetRoles() {
- return this.roles != null;
- }
-
- public void setRolesIsSet(boolean value) {
- if (!value) {
- this.roles = null;
- }
- }
-
- 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 ROLES:
- if (value == null) {
- unsetRoles();
- } else {
- setRoles((Set<TSentryRole>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- case ROLES:
- return getRoles();
-
- }
- 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 ROLES:
- return isSetRoles();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryRolesResponse)
- return this.equals((TListSentryRolesResponse)that);
- return false;
- }
-
- public boolean equals(TListSentryRolesResponse 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_roles = true && this.isSetRoles();
- boolean that_present_roles = true && that.isSetRoles();
- if (this_present_roles || that_present_roles) {
- if (!(this_present_roles && that_present_roles))
- return false;
- if (!this.roles.equals(that.roles))
- 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_roles = true && (isSetRoles());
- list.add(present_roles);
- if (present_roles)
- list.add(roles);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TListSentryRolesResponse 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(isSetRoles()).compareTo(other.isSetRoles());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoles()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roles, other.roles);
- 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("TListSentryRolesResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- if (isSetRoles()) {
- if (!first) sb.append(", ");
- sb.append("roles:");
- if (this.roles == null) {
- sb.append("null");
- } else {
- sb.append(this.roles);
- }
- 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());
- }
-
- // check for sub-struct validity
- }
-
- 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 TListSentryRolesResponseStandardSchemeFactory implements SchemeFactory {
- public TListSentryRolesResponseStandardScheme getScheme() {
- return new TListSentryRolesResponseStandardScheme();
- }
- }
-
- private static class TListSentryRolesResponseStandardScheme extends StandardScheme<TListSentryRolesResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryRolesResponse 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: // ROLES
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set32 = iprot.readSetBegin();
- struct.roles = new HashSet<TSentryRole>(2*_set32.size);
- TSentryRole _elem33;
- for (int _i34 = 0; _i34 < _set32.size; ++_i34)
- {
- _elem33 = new TSentryRole();
- _elem33.read(iprot);
- struct.roles.add(_elem33);
- }
- iprot.readSetEnd();
- }
- struct.setRolesIsSet(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, TListSentryRolesResponse 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();
- }
- if (struct.roles != null) {
- if (struct.isSetRoles()) {
- oprot.writeFieldBegin(ROLES_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.roles.size()));
- for (TSentryRole _iter35 : struct.roles)
- {
- _iter35.write(oprot);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryRolesResponseTupleSchemeFactory implements SchemeFactory {
- public TListSentryRolesResponseTupleScheme getScheme() {
- return new TListSentryRolesResponseTupleScheme();
- }
- }
-
- private static class TListSentryRolesResponseTupleScheme extends TupleScheme<TListSentryRolesResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- BitSet optionals = new BitSet();
- if (struct.isSetRoles()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetRoles()) {
- {
- oprot.writeI32(struct.roles.size());
- for (TSentryRole _iter36 : struct.roles)
- {
- _iter36.write(oprot);
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesResponse 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);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- {
- org.apache.thrift.protocol.TSet _set37 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.roles = new HashSet<TSentryRole>(2*_set37.size);
- TSentryRole _elem38;
- for (int _i39 = 0; _i39 < _set37.size; ++_i39)
- {
- _elem38 = new TSentryRole();
- _elem38.read(iprot);
- struct.roles.add(_elem38);
- }
- }
- struct.setRolesIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TRenamePrivilegesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TRenamePrivilegesRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TRenamePrivilegesRequest.java
deleted file mode 100644
index 8a640bd..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TRenamePrivilegesRequest.java
+++ /dev/null
@@ -1,1002 +0,0 @@
-/**
- * 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.provider.db.generic.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 TRenamePrivilegesRequest implements org.apache.thrift.TBase<TRenamePrivilegesRequest, TRenamePrivilegesRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TRenamePrivilegesRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRenamePrivilegesRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField SERVICE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("serviceName", org.apache.thrift.protocol.TType.STRING, (short)4);
- private static final org.apache.thrift.protocol.TField OLD_AUTHORIZABLES_FIELD_DESC = new org.apache.thrift.protocol.TField("oldAuthorizables", org.apache.thrift.protocol.TType.LIST, (short)5);
- private static final org.apache.thrift.protocol.TField NEW_AUTHORIZABLES_FIELD_DESC = new org.apache.thrift.protocol.TField("newAuthorizables", org.apache.thrift.protocol.TType.LIST, (short)6);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TRenamePrivilegesRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TRenamePrivilegesRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String component; // required
- private String serviceName; // required
- private List<TAuthorizable> oldAuthorizables; // required
- private List<TAuthorizable> newAuthorizables; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- COMPONENT((short)3, "component"),
- SERVICE_NAME((short)4, "serviceName"),
- OLD_AUTHORIZABLES((short)5, "oldAuthorizables"),
- NEW_AUTHORIZABLES((short)6, "newAuthorizables");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // COMPONENT
- return COMPONENT;
- case 4: // SERVICE_NAME
- return SERVICE_NAME;
- case 5: // OLD_AUTHORIZABLES
- return OLD_AUTHORIZABLES;
- case 6: // NEW_AUTHORIZABLES
- return NEW_AUTHORIZABLES;
- 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.SERVICE_NAME, new org.apache.thrift.meta_data.FieldMetaData("serviceName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.OLD_AUTHORIZABLES, new org.apache.thrift.meta_data.FieldMetaData("oldAuthorizables", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAuthorizable.class))));
- tmpMap.put(_Fields.NEW_AUTHORIZABLES, new org.apache.thrift.meta_data.FieldMetaData("newAuthorizables", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAuthorizable.class))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TRenamePrivilegesRequest.class, metaDataMap);
- }
-
- public TRenamePrivilegesRequest() {
- this.protocol_version = 2;
-
- }
-
- public TRenamePrivilegesRequest(
- int protocol_version,
- String requestorUserName,
- String component,
- String serviceName,
- List<TAuthorizable> oldAuthorizables,
- List<TAuthorizable> newAuthorizables)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.component = component;
- this.serviceName = serviceName;
- this.oldAuthorizables = oldAuthorizables;
- this.newAuthorizables = newAuthorizables;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TRenamePrivilegesRequest(TRenamePrivilegesRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetComponent()) {
- this.component = other.component;
- }
- if (other.isSetServiceName()) {
- this.serviceName = other.serviceName;
- }
- if (other.isSetOldAuthorizables()) {
- List<TAuthorizable> __this__oldAuthorizables = new ArrayList<TAuthorizable>(other.oldAuthorizables.size());
- for (TAuthorizable other_element : other.oldAuthorizables) {
- __this__oldAuthorizables.add(new TAuthorizable(other_element));
- }
- this.oldAuthorizables = __this__oldAuthorizables;
- }
- if (other.isSetNewAuthorizables()) {
- List<TAuthorizable> __this__newAuthorizables = new ArrayList<TAuthorizable>(other.newAuthorizables.size());
- for (TAuthorizable other_element : other.newAuthorizables) {
- __this__newAuthorizables.add(new TAuthorizable(other_element));
- }
- this.newAuthorizables = __this__newAuthorizables;
- }
- }
-
- public TRenamePrivilegesRequest deepCopy() {
- return new TRenamePrivilegesRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.component = null;
- this.serviceName = null;
- this.oldAuthorizables = null;
- this.newAuthorizables = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getComponent() {
- return this.component;
- }
-
- public void setComponent(String component) {
- this.component = component;
- }
-
- public void unsetComponent() {
- this.component = null;
- }
-
- /** Returns true if field component is set (has been assigned a value) and false otherwise */
- public boolean isSetComponent() {
- return this.component != null;
- }
-
- public void setComponentIsSet(boolean value) {
- if (!value) {
- this.component = null;
- }
- }
-
- public String getServiceName() {
- return this.serviceName;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- public void unsetServiceName() {
- this.serviceName = null;
- }
-
- /** Returns true if field serviceName is set (has been assigned a value) and false otherwise */
- public boolean isSetServiceName() {
- return this.serviceName != null;
- }
-
- public void setServiceNameIsSet(boolean value) {
- if (!value) {
- this.serviceName = null;
- }
- }
-
- public int getOldAuthorizablesSize() {
- return (this.oldAuthorizables == null) ? 0 : this.oldAuthorizables.size();
- }
-
- public java.util.Iterator<TAuthorizable> getOldAuthorizablesIterator() {
- return (this.oldAuthorizables == null) ? null : this.oldAuthorizables.iterator();
- }
-
- public void addToOldAuthorizables(TAuthorizable elem) {
- if (this.oldAuthorizables == null) {
- this.oldAuthorizables = new ArrayList<TAuthorizable>();
- }
- this.oldAuthorizables.add(elem);
- }
-
- public List<TAuthorizable> getOldAuthorizables() {
- return this.oldAuthorizables;
- }
-
- public void setOldAuthorizables(List<TAuthorizable> oldAuthorizables) {
- this.oldAuthorizables = oldAuthorizables;
- }
-
- public void unsetOldAuthorizables() {
- this.oldAuthorizables = null;
- }
-
- /** Returns true if field oldAuthorizables is set (has been assigned a value) and false otherwise */
- public boolean isSetOldAuthorizables() {
- return this.oldAuthorizables != null;
- }
-
- public void setOldAuthorizablesIsSet(boolean value) {
- if (!value) {
- this.oldAuthorizables = null;
- }
- }
-
- public int getNewAuthorizablesSize() {
- return (this.newAuthorizables == null) ? 0 : this.newAuthorizables.size();
- }
-
- public java.util.Iterator<TAuthorizable> getNewAuthorizablesIterator() {
- return (this.newAuthorizables == null) ? null : this.newAuthorizables.iterator();
- }
-
- public void addToNewAuthorizables(TAuthorizable elem) {
- if (this.newAuthorizables == null) {
- this.newAuthorizables = new ArrayList<TAuthorizable>();
- }
- this.newAuthorizables.add(elem);
- }
-
- public List<TAuthorizable> getNewAuthorizables() {
- return this.newAuthorizables;
- }
-
- public void setNewAuthorizables(List<TAuthorizable> newAuthorizables) {
- this.newAuthorizables = newAuthorizables;
- }
-
- public void unsetNewAuthorizables() {
- this.newAuthorizables = null;
- }
-
- /** Returns true if field newAuthorizables is set (has been assigned a value) and false otherwise */
- public boolean isSetNewAuthorizables() {
- return this.newAuthorizables != null;
- }
-
- public void setNewAuthorizablesIsSet(boolean value) {
- if (!value) {
- this.newAuthorizables = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case COMPONENT:
- if (value == null) {
- unsetComponent();
- } else {
- setComponent((String)value);
- }
- break;
-
- case SERVICE_NAME:
- if (value == null) {
- unsetServiceName();
- } else {
- setServiceName((String)value);
- }
- break;
-
- case OLD_AUTHORIZABLES:
- if (value == null) {
- unsetOldAuthorizables();
- } else {
- setOldAuthorizables((List<TAuthorizable>)value);
- }
- break;
-
- case NEW_AUTHORIZABLES:
- if (value == null) {
- unsetNewAuthorizables();
- } else {
- setNewAuthorizables((List<TAuthorizable>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case COMPONENT:
- return getComponent();
-
- case SERVICE_NAME:
- return getServiceName();
-
- case OLD_AUTHORIZABLES:
- return getOldAuthorizables();
-
- case NEW_AUTHORIZABLES:
- return getNewAuthorizables();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case COMPONENT:
- return isSetComponent();
- case SERVICE_NAME:
- return isSetServiceName();
- case OLD_AUTHORIZABLES:
- return isSetOldAuthorizables();
- case NEW_AUTHORIZABLES:
- return isSetNewAuthorizables();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TRenamePrivilegesRequest)
- return this.equals((TRenamePrivilegesRequest)that);
- return false;
- }
-
- public boolean equals(TRenamePrivilegesRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_component = true && this.isSetComponent();
- boolean that_present_component = true && that.isSetComponent();
- if (this_present_component || that_present_component) {
- if (!(this_present_component && that_present_component))
- return false;
- if (!this.component.equals(that.component))
- return false;
- }
-
- boolean this_present_serviceName = true && this.isSetServiceName();
- boolean that_present_serviceName = true && that.isSetServiceName();
- if (this_present_serviceName || that_present_serviceName) {
- if (!(this_present_serviceName && that_present_serviceName))
- return false;
- if (!this.serviceName.equals(that.serviceName))
- return false;
- }
-
- boolean this_present_oldAuthorizables = true && this.isSetOldAuthorizables();
- boolean that_present_oldAuthorizables = true && that.isSetOldAuthorizables();
- if (this_present_oldAuthorizables || that_present_oldAuthorizables) {
- if (!(this_present_oldAuthorizables && that_present_oldAuthorizables))
- return false;
- if (!this.oldAuthorizables.equals(that.oldAuthorizables))
- return false;
- }
-
- boolean this_present_newAuthorizables = true && this.isSetNewAuthorizables();
- boolean that_present_newAuthorizables = true && that.isSetNewAuthorizables();
- if (this_present_newAuthorizables || that_present_newAuthorizables) {
- if (!(this_present_newAuthorizables && that_present_newAuthorizables))
- return false;
- if (!this.newAuthorizables.equals(that.newAuthorizables))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_component = true && (isSetComponent());
- list.add(present_component);
- if (present_component)
- list.add(component);
-
- boolean present_serviceName = true && (isSetServiceName());
- list.add(present_serviceName);
- if (present_serviceName)
- list.add(serviceName);
-
- boolean present_oldAuthorizables = true && (isSetOldAuthorizables());
- list.add(present_oldAuthorizables);
- if (present_oldAuthorizables)
- list.add(oldAuthorizables);
-
- boolean present_newAuthorizables = true && (isSetNewAuthorizables());
- list.add(present_newAuthorizables);
- if (present_newAuthorizables)
- list.add(newAuthorizables);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TRenamePrivilegesRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetComponent()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetServiceName()).compareTo(other.isSetServiceName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetServiceName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serviceName, other.serviceName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetOldAuthorizables()).compareTo(other.isSetOldAuthorizables());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetOldAuthorizables()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.oldAuthorizables, other.oldAuthorizables);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetNewAuthorizables()).compareTo(other.isSetNewAuthorizables());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetNewAuthorizables()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.newAuthorizables, other.newAuthorizables);
- 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("TRenamePrivilegesRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("component:");
- if (this.component == null) {
- sb.append("null");
- } else {
- sb.append(this.component);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("serviceName:");
- if (this.serviceName == null) {
- sb.append("null");
- } else {
- sb.append(this.serviceName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("oldAuthorizables:");
- if (this.oldAuthorizables == null) {
- sb.append("null");
- } else {
- sb.append(this.oldAuthorizables);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("newAuthorizables:");
- if (this.newAuthorizables == null) {
- sb.append("null");
- } else {
- sb.append(this.newAuthorizables);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetComponent()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
- }
-
- if (!isSetServiceName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'serviceName' is unset! Struct:" + toString());
- }
-
- if (!isSetOldAuthorizables()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'oldAuthorizables' is unset! Struct:" + toString());
- }
-
- if (!isSetNewAuthorizables()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'newAuthorizables' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TRenamePrivilegesRequestStandardSchemeFactory implements SchemeFactory {
- public TRenamePrivilegesRequestStandardScheme getScheme() {
- return new TRenamePrivilegesRequestStandardScheme();
- }
- }
-
- private static class TRenamePrivilegesRequestStandardScheme extends StandardScheme<TRenamePrivilegesRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TRenamePrivilegesRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // COMPONENT
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // SERVICE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.serviceName = iprot.readString();
- struct.setServiceNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // OLD_AUTHORIZABLES
- if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list56 = iprot.readListBegin();
- struct.oldAuthorizables = new ArrayList<TAuthorizable>(_list56.size);
- TAuthorizable _elem57;
- for (int _i58 = 0; _i58 < _list56.size; ++_i58)
- {
- _elem57 = new TAuthorizable();
- _elem57.read(iprot);
- struct.oldAuthorizables.add(_elem57);
- }
- iprot.readListEnd();
- }
- struct.setOldAuthorizablesIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 6: // NEW_AUTHORIZABLES
- if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list59 = iprot.readListBegin();
- struct.newAuthorizables = new ArrayList<TAuthorizable>(_list59.size);
- TAuthorizable _elem60;
- for (int _i61 = 0; _i61 < _list59.size; ++_i61)
- {
- _elem60 = new TAuthorizable();
- _elem60.read(iprot);
- struct.newAuthorizables.add(_elem60);
- }
- iprot.readListEnd();
- }
- struct.setNewAuthorizablesIsSet(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, TRenamePrivilegesRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.component != null) {
- oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
- oprot.writeString(struct.component);
- oprot.writeFieldEnd();
- }
- if (struct.serviceName != null) {
- oprot.writeFieldBegin(SERVICE_NAME_FIELD_DESC);
- oprot.writeString(struct.serviceName);
- oprot.writeFieldEnd();
- }
- if (struct.oldAuthorizables != null) {
- oprot.writeFieldBegin(OLD_AUTHORIZABLES_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.oldAuthorizables.size()));
- for (TAuthorizable _iter62 : struct.oldAuthorizables)
- {
- _iter62.write(oprot);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- if (struct.newAuthorizables != null) {
- oprot.writeFieldBegin(NEW_AUTHORIZABLES_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.newAuthorizables.size()));
- for (TAuthorizable _iter63 : struct.newAuthorizables)
- {
- _iter63.write(oprot);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TRenamePrivilegesRequestTupleSchemeFactory implements SchemeFactory {
- public TRenamePrivilegesRequestTupleScheme getScheme() {
- return new TRenamePrivilegesRequestTupleScheme();
- }
- }
-
- private static class TRenamePrivilegesRequestTupleScheme extends TupleScheme<TRenamePrivilegesRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.component);
- oprot.writeString(struct.serviceName);
- {
- oprot.writeI32(struct.oldAuthorizables.size());
- for (TAuthorizable _iter64 : struct.oldAuthorizables)
- {
- _iter64.write(oprot);
- }
- }
- {
- oprot.writeI32(struct.newAuthorizables.size());
- for (TAuthorizable _iter65 : struct.newAuthorizables)
- {
- _iter65.write(oprot);
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- struct.serviceName = iprot.readString();
- struct.setServiceNameIsSet(true);
- {
- org.apache.thrift.protocol.TList _list66 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.oldAuthorizables = new ArrayList<TAuthorizable>(_list66.size);
- TAuthorizable _elem67;
- for (int _i68 = 0; _i68 < _list66.size; ++_i68)
- {
- _elem67 = new TAuthorizable();
- _elem67.read(iprot);
- struct.oldAuthorizables.add(_elem67);
- }
- }
- struct.setOldAuthorizablesIsSet(true);
- {
- org.apache.thrift.protocol.TList _list69 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.newAuthorizables = new ArrayList<TAuthorizable>(_list69.size);
- TAuthorizable _elem70;
- for (int _i71 = 0; _i71 < _list69.size; ++_i71)
- {
- _elem70 = new TAuthorizable();
- _elem70.read(iprot);
- struct.newAuthorizables.add(_elem70);
- }
- }
- struct.setNewAuthorizablesIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TRenamePrivilegesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TRenamePrivilegesResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TRenamePrivilegesResponse.java
deleted file mode 100644
index 85cf6f0..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TRenamePrivilegesResponse.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/**
- * 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.provider.db.generic.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 TRenamePrivilegesResponse implements org.apache.thrift.TBase<TRenamePrivilegesResponse, TRenamePrivilegesResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TRenamePrivilegesResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRenamePrivilegesResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TRenamePrivilegesResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TRenamePrivilegesResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TRenamePrivilegesResponse.class, metaDataMap);
- }
-
- public TRenamePrivilegesResponse() {
- }
-
- public TRenamePrivilegesResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TRenamePrivilegesResponse(TRenamePrivilegesResponse other) {
- if (other.isSetStatus()) {
- this.status = other.status;
- }
- }
-
- public TRenamePrivilegesResponse deepCopy() {
- return new TRenamePrivilegesResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TRenamePrivilegesResponse)
- return this.equals((TRenamePrivilegesResponse)that);
- return false;
- }
-
- public boolean equals(TRenamePrivilegesResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TRenamePrivilegesResponse 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;
- }
- }
- 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("TRenamePrivilegesResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // check for sub-struct validity
- }
-
- 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 TRenamePrivilegesResponseStandardSchemeFactory implements SchemeFactory {
- public TRenamePrivilegesResponseStandardScheme getScheme() {
- return new TRenamePrivilegesResponseStandardScheme();
- }
- }
-
- private static class TRenamePrivilegesResponseStandardScheme extends StandardScheme<TRenamePrivilegesResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TRenamePrivilegesResponse 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;
- 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, TRenamePrivilegesResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TRenamePrivilegesResponseTupleSchemeFactory implements SchemeFactory {
- public TRenamePrivilegesResponseTupleScheme getScheme() {
- return new TRenamePrivilegesResponseTupleScheme();
- }
- }
-
- private static class TRenamePrivilegesResponseTupleScheme extends TupleScheme<TRenamePrivilegesResponse> {
-
- @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 read(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesResponse 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);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryActiveRoleSet.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryActiveRoleSet.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryActiveRoleSet.java
deleted file mode 100644
index 92ef233..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryActiveRoleSet.java
+++ /dev/null
@@ -1,537 +0,0 @@
-/**
- * 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.provider.db.generic.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 TSentryActiveRoleSet implements org.apache.thrift.TBase<TSentryActiveRoleSet, TSentryActiveRoleSet._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryActiveRoleSet> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryActiveRoleSet");
-
- private static final org.apache.thrift.protocol.TField ALL_FIELD_DESC = new org.apache.thrift.protocol.TField("all", org.apache.thrift.protocol.TType.BOOL, (short)1);
- private static final org.apache.thrift.protocol.TField ROLES_FIELD_DESC = new org.apache.thrift.protocol.TField("roles", org.apache.thrift.protocol.TType.SET, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryActiveRoleSetStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryActiveRoleSetTupleSchemeFactory());
- }
-
- private boolean all; // required
- private Set<String> roles; // 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 {
- ALL((short)1, "all"),
- ROLES((short)2, "roles");
-
- 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: // ALL
- return ALL;
- case 2: // ROLES
- return ROLES;
- 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 __ALL_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.ALL, new org.apache.thrift.meta_data.FieldMetaData("all", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
- tmpMap.put(_Fields.ROLES, new org.apache.thrift.meta_data.FieldMetaData("roles", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryActiveRoleSet.class, metaDataMap);
- }
-
- public TSentryActiveRoleSet() {
- }
-
- public TSentryActiveRoleSet(
- boolean all,
- Set<String> roles)
- {
- this();
- this.all = all;
- setAllIsSet(true);
- this.roles = roles;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryActiveRoleSet(TSentryActiveRoleSet other) {
- __isset_bitfield = other.__isset_bitfield;
- this.all = other.all;
- if (other.isSetRoles()) {
- Set<String> __this__roles = new HashSet<String>(other.roles);
- this.roles = __this__roles;
- }
- }
-
- public TSentryActiveRoleSet deepCopy() {
- return new TSentryActiveRoleSet(this);
- }
-
- @Override
- public void clear() {
- setAllIsSet(false);
- this.all = false;
- this.roles = null;
- }
-
- public boolean isAll() {
- return this.all;
- }
-
- public void setAll(boolean all) {
- this.all = all;
- setAllIsSet(true);
- }
-
- public void unsetAll() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ALL_ISSET_ID);
- }
-
- /** Returns true if field all is set (has been assigned a value) and false otherwise */
- public boolean isSetAll() {
- return EncodingUtils.testBit(__isset_bitfield, __ALL_ISSET_ID);
- }
-
- public void setAllIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ALL_ISSET_ID, value);
- }
-
- public int getRolesSize() {
- return (this.roles == null) ? 0 : this.roles.size();
- }
-
- public java.util.Iterator<String> getRolesIterator() {
- return (this.roles == null) ? null : this.roles.iterator();
- }
-
- public void addToRoles(String elem) {
- if (this.roles == null) {
- this.roles = new HashSet<String>();
- }
- this.roles.add(elem);
- }
-
- public Set<String> getRoles() {
- return this.roles;
- }
-
- public void setRoles(Set<String> roles) {
- this.roles = roles;
- }
-
- public void unsetRoles() {
- this.roles = null;
- }
-
- /** Returns true if field roles is set (has been assigned a value) and false otherwise */
- public boolean isSetRoles() {
- return this.roles != null;
- }
-
- public void setRolesIsSet(boolean value) {
- if (!value) {
- this.roles = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case ALL:
- if (value == null) {
- unsetAll();
- } else {
- setAll((Boolean)value);
- }
- break;
-
- case ROLES:
- if (value == null) {
- unsetRoles();
- } else {
- setRoles((Set<String>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case ALL:
- return isAll();
-
- case ROLES:
- return getRoles();
-
- }
- 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 ALL:
- return isSetAll();
- case ROLES:
- return isSetRoles();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryActiveRoleSet)
- return this.equals((TSentryActiveRoleSet)that);
- return false;
- }
-
- public boolean equals(TSentryActiveRoleSet that) {
- if (that == null)
- return false;
-
- boolean this_present_all = true;
- boolean that_present_all = true;
- if (this_present_all || that_present_all) {
- if (!(this_present_all && that_present_all))
- return false;
- if (this.all != that.all)
- return false;
- }
-
- boolean this_present_roles = true && this.isSetRoles();
- boolean that_present_roles = true && that.isSetRoles();
- if (this_present_roles || that_present_roles) {
- if (!(this_present_roles && that_present_roles))
- return false;
- if (!this.roles.equals(that.roles))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List<Object> list = new ArrayList<Object>();
-
- boolean present_all = true;
- list.add(present_all);
- if (present_all)
- list.add(all);
-
- boolean present_roles = true && (isSetRoles());
- list.add(present_roles);
- if (present_roles)
- list.add(roles);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryActiveRoleSet other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetAll()).compareTo(other.isSetAll());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAll()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.all, other.all);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoles()).compareTo(other.isSetRoles());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoles()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roles, other.roles);
- 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("TSentryActiveRoleSet(");
- boolean first = true;
-
- sb.append("all:");
- sb.append(this.all);
- first = false;
- if (!first) sb.append(", ");
- sb.append("roles:");
- if (this.roles == null) {
- sb.append("null");
- } else {
- sb.append(this.roles);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetAll()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'all' is unset! Struct:" + toString());
- }
-
- if (!isSetRoles()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roles' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TSentryActiveRoleSetStandardSchemeFactory implements SchemeFactory {
- public TSentryActiveRoleSetStandardScheme getScheme() {
- return new TSentryActiveRoleSetStandardScheme();
- }
- }
-
- private static class TSentryActiveRoleSetStandardScheme extends StandardScheme<TSentryActiveRoleSet> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryActiveRoleSet 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: // ALL
- if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
- struct.all = iprot.readBool();
- struct.setAllIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // ROLES
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set72 = iprot.readSetBegin();
- struct.roles = new HashSet<String>(2*_set72.size);
- String _elem73;
- for (int _i74 = 0; _i74 < _set72.size; ++_i74)
- {
- _elem73 = iprot.readString();
- struct.roles.add(_elem73);
- }
- iprot.readSetEnd();
- }
- struct.setRolesIsSet(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, TSentryActiveRoleSet struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(ALL_FIELD_DESC);
- oprot.writeBool(struct.all);
- oprot.writeFieldEnd();
- if (struct.roles != null) {
- oprot.writeFieldBegin(ROLES_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.roles.size()));
- for (String _iter75 : struct.roles)
- {
- oprot.writeString(_iter75);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryActiveRoleSetTupleSchemeFactory implements SchemeFactory {
- public TSentryActiveRoleSetTupleScheme getScheme() {
- return new TSentryActiveRoleSetTupleScheme();
- }
- }
-
- private static class TSentryActiveRoleSetTupleScheme extends TupleScheme<TSentryActiveRoleSet> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryActiveRoleSet struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeBool(struct.all);
- {
- oprot.writeI32(struct.roles.size());
- for (String _iter76 : struct.roles)
- {
- oprot.writeString(_iter76);
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryActiveRoleSet struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.all = iprot.readBool();
- struct.setAllIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set77 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.roles = new HashSet<String>(2*_set77.size);
- String _elem78;
- for (int _i79 = 0; _i79 < _set77.size; ++_i79)
- {
- _elem78 = iprot.readString();
- struct.roles.add(_elem78);
- }
- }
- struct.setRolesIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryGrantOption.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryGrantOption.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryGrantOption.java
deleted file mode 100644
index 9898c08..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryGrantOption.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.provider.db.generic.service.thrift;
-
-
-import java.util.Map;
-import java.util.HashMap;
-import org.apache.thrift.TEnum;
-
-public enum TSentryGrantOption implements org.apache.thrift.TEnum {
- TRUE(1),
- FALSE(0),
- UNSET(-1);
-
- private final int value;
-
- private TSentryGrantOption(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 TSentryGrantOption findByValue(int value) {
- switch (value) {
- case 1:
- return TRUE;
- case 0:
- return FALSE;
- case -1:
- return UNSET;
- default:
- return null;
- }
- }
-}
[39/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/SentryPolicyService.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/SentryPolicyService.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/SentryPolicyService.java
deleted file mode 100644
index 050a9b4..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/SentryPolicyService.java
+++ /dev/null
@@ -1,16422 +0,0 @@
-/**
- * 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.provider.db.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 SentryPolicyService {
-
- public interface Iface {
-
- public TCreateSentryRoleResponse create_sentry_role(TCreateSentryRoleRequest request) throws org.apache.thrift.TException;
-
- public TDropSentryRoleResponse drop_sentry_role(TDropSentryRoleRequest request) throws org.apache.thrift.TException;
-
- public TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request) throws org.apache.thrift.TException;
-
- public TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request) throws org.apache.thrift.TException;
-
- public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request) throws org.apache.thrift.TException;
-
- public TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request) throws org.apache.thrift.TException;
-
- public TAlterSentryRoleAddUsersResponse alter_sentry_role_add_users(TAlterSentryRoleAddUsersRequest request) throws org.apache.thrift.TException;
-
- public TAlterSentryRoleDeleteUsersResponse alter_sentry_role_delete_users(TAlterSentryRoleDeleteUsersRequest request) throws org.apache.thrift.TException;
-
- public TListSentryRolesResponse list_sentry_roles_by_group(TListSentryRolesRequest request) throws org.apache.thrift.TException;
-
- public TListSentryRolesResponse list_sentry_roles_by_user(TListSentryRolesForUserRequest request) throws org.apache.thrift.TException;
-
- public TListSentryPrivilegesResponse list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException;
-
- public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException;
-
- public TDropPrivilegesResponse drop_sentry_privilege(TDropPrivilegesRequest request) throws org.apache.thrift.TException;
-
- public TRenamePrivilegesResponse rename_sentry_privilege(TRenamePrivilegesRequest request) throws org.apache.thrift.TException;
-
- public TListSentryPrivilegesByAuthResponse list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request) throws org.apache.thrift.TException;
-
- public TSentryConfigValueResponse get_sentry_config_value(TSentryConfigValueRequest request) throws org.apache.thrift.TException;
-
- public TSentryExportMappingDataResponse export_sentry_mapping_data(TSentryExportMappingDataRequest request) throws org.apache.thrift.TException;
-
- public TSentryImportMappingDataResponse import_sentry_mapping_data(TSentryImportMappingDataRequest request) throws org.apache.thrift.TException;
-
- public TSentrySyncIDResponse sentry_sync_notifications(TSentrySyncIDRequest request) throws org.apache.thrift.TException;
-
- }
-
- public interface AsyncIface {
-
- public void create_sentry_role(TCreateSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void drop_sentry_role(TDropSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void alter_sentry_role_add_users(TAlterSentryRoleAddUsersRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void alter_sentry_role_delete_users(TAlterSentryRoleDeleteUsersRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void list_sentry_roles_by_group(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void list_sentry_roles_by_user(TListSentryRolesForUserRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void list_sentry_privileges_by_role(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void drop_sentry_privilege(TDropPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void rename_sentry_privilege(TRenamePrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void get_sentry_config_value(TSentryConfigValueRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void export_sentry_mapping_data(TSentryExportMappingDataRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void import_sentry_mapping_data(TSentryImportMappingDataRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void sentry_sync_notifications(TSentrySyncIDRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- }
-
- public static class Client extends org.apache.thrift.TServiceClient implements Iface {
- public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
- public Factory() {}
- public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
- return new Client(prot);
- }
- public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
- return new Client(iprot, oprot);
- }
- }
-
- public Client(org.apache.thrift.protocol.TProtocol prot)
- {
- super(prot, prot);
- }
-
- public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
- super(iprot, oprot);
- }
-
- public TCreateSentryRoleResponse create_sentry_role(TCreateSentryRoleRequest request) throws org.apache.thrift.TException
- {
- send_create_sentry_role(request);
- return recv_create_sentry_role();
- }
-
- public void send_create_sentry_role(TCreateSentryRoleRequest request) throws org.apache.thrift.TException
- {
- create_sentry_role_args args = new create_sentry_role_args();
- args.setRequest(request);
- sendBase("create_sentry_role", args);
- }
-
- public TCreateSentryRoleResponse recv_create_sentry_role() throws org.apache.thrift.TException
- {
- create_sentry_role_result result = new create_sentry_role_result();
- receiveBase(result, "create_sentry_role");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "create_sentry_role failed: unknown result");
- }
-
- public TDropSentryRoleResponse drop_sentry_role(TDropSentryRoleRequest request) throws org.apache.thrift.TException
- {
- send_drop_sentry_role(request);
- return recv_drop_sentry_role();
- }
-
- public void send_drop_sentry_role(TDropSentryRoleRequest request) throws org.apache.thrift.TException
- {
- drop_sentry_role_args args = new drop_sentry_role_args();
- args.setRequest(request);
- sendBase("drop_sentry_role", args);
- }
-
- public TDropSentryRoleResponse recv_drop_sentry_role() throws org.apache.thrift.TException
- {
- drop_sentry_role_result result = new drop_sentry_role_result();
- receiveBase(result, "drop_sentry_role");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "drop_sentry_role failed: unknown result");
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request) throws org.apache.thrift.TException
- {
- send_alter_sentry_role_grant_privilege(request);
- return recv_alter_sentry_role_grant_privilege();
- }
-
- public void send_alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request) throws org.apache.thrift.TException
- {
- alter_sentry_role_grant_privilege_args args = new alter_sentry_role_grant_privilege_args();
- args.setRequest(request);
- sendBase("alter_sentry_role_grant_privilege", args);
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse recv_alter_sentry_role_grant_privilege() throws org.apache.thrift.TException
- {
- alter_sentry_role_grant_privilege_result result = new alter_sentry_role_grant_privilege_result();
- receiveBase(result, "alter_sentry_role_grant_privilege");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_grant_privilege failed: unknown result");
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request) throws org.apache.thrift.TException
- {
- send_alter_sentry_role_revoke_privilege(request);
- return recv_alter_sentry_role_revoke_privilege();
- }
-
- public void send_alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request) throws org.apache.thrift.TException
- {
- alter_sentry_role_revoke_privilege_args args = new alter_sentry_role_revoke_privilege_args();
- args.setRequest(request);
- sendBase("alter_sentry_role_revoke_privilege", args);
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse recv_alter_sentry_role_revoke_privilege() throws org.apache.thrift.TException
- {
- alter_sentry_role_revoke_privilege_result result = new alter_sentry_role_revoke_privilege_result();
- receiveBase(result, "alter_sentry_role_revoke_privilege");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_revoke_privilege failed: unknown result");
- }
-
- public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request) throws org.apache.thrift.TException
- {
- send_alter_sentry_role_add_groups(request);
- return recv_alter_sentry_role_add_groups();
- }
-
- public void send_alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request) throws org.apache.thrift.TException
- {
- alter_sentry_role_add_groups_args args = new alter_sentry_role_add_groups_args();
- args.setRequest(request);
- sendBase("alter_sentry_role_add_groups", args);
- }
-
- public TAlterSentryRoleAddGroupsResponse recv_alter_sentry_role_add_groups() throws org.apache.thrift.TException
- {
- alter_sentry_role_add_groups_result result = new alter_sentry_role_add_groups_result();
- receiveBase(result, "alter_sentry_role_add_groups");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_add_groups failed: unknown result");
- }
-
- public TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request) throws org.apache.thrift.TException
- {
- send_alter_sentry_role_delete_groups(request);
- return recv_alter_sentry_role_delete_groups();
- }
-
- public void send_alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request) throws org.apache.thrift.TException
- {
- alter_sentry_role_delete_groups_args args = new alter_sentry_role_delete_groups_args();
- args.setRequest(request);
- sendBase("alter_sentry_role_delete_groups", args);
- }
-
- public TAlterSentryRoleDeleteGroupsResponse recv_alter_sentry_role_delete_groups() throws org.apache.thrift.TException
- {
- alter_sentry_role_delete_groups_result result = new alter_sentry_role_delete_groups_result();
- receiveBase(result, "alter_sentry_role_delete_groups");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_delete_groups failed: unknown result");
- }
-
- public TAlterSentryRoleAddUsersResponse alter_sentry_role_add_users(TAlterSentryRoleAddUsersRequest request) throws org.apache.thrift.TException
- {
- send_alter_sentry_role_add_users(request);
- return recv_alter_sentry_role_add_users();
- }
-
- public void send_alter_sentry_role_add_users(TAlterSentryRoleAddUsersRequest request) throws org.apache.thrift.TException
- {
- alter_sentry_role_add_users_args args = new alter_sentry_role_add_users_args();
- args.setRequest(request);
- sendBase("alter_sentry_role_add_users", args);
- }
-
- public TAlterSentryRoleAddUsersResponse recv_alter_sentry_role_add_users() throws org.apache.thrift.TException
- {
- alter_sentry_role_add_users_result result = new alter_sentry_role_add_users_result();
- receiveBase(result, "alter_sentry_role_add_users");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_add_users failed: unknown result");
- }
-
- public TAlterSentryRoleDeleteUsersResponse alter_sentry_role_delete_users(TAlterSentryRoleDeleteUsersRequest request) throws org.apache.thrift.TException
- {
- send_alter_sentry_role_delete_users(request);
- return recv_alter_sentry_role_delete_users();
- }
-
- public void send_alter_sentry_role_delete_users(TAlterSentryRoleDeleteUsersRequest request) throws org.apache.thrift.TException
- {
- alter_sentry_role_delete_users_args args = new alter_sentry_role_delete_users_args();
- args.setRequest(request);
- sendBase("alter_sentry_role_delete_users", args);
- }
-
- public TAlterSentryRoleDeleteUsersResponse recv_alter_sentry_role_delete_users() throws org.apache.thrift.TException
- {
- alter_sentry_role_delete_users_result result = new alter_sentry_role_delete_users_result();
- receiveBase(result, "alter_sentry_role_delete_users");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_delete_users failed: unknown result");
- }
-
- public TListSentryRolesResponse list_sentry_roles_by_group(TListSentryRolesRequest request) throws org.apache.thrift.TException
- {
- send_list_sentry_roles_by_group(request);
- return recv_list_sentry_roles_by_group();
- }
-
- public void send_list_sentry_roles_by_group(TListSentryRolesRequest request) throws org.apache.thrift.TException
- {
- list_sentry_roles_by_group_args args = new list_sentry_roles_by_group_args();
- args.setRequest(request);
- sendBase("list_sentry_roles_by_group", args);
- }
-
- public TListSentryRolesResponse recv_list_sentry_roles_by_group() throws org.apache.thrift.TException
- {
- list_sentry_roles_by_group_result result = new list_sentry_roles_by_group_result();
- receiveBase(result, "list_sentry_roles_by_group");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_roles_by_group failed: unknown result");
- }
-
- public TListSentryRolesResponse list_sentry_roles_by_user(TListSentryRolesForUserRequest request) throws org.apache.thrift.TException
- {
- send_list_sentry_roles_by_user(request);
- return recv_list_sentry_roles_by_user();
- }
-
- public void send_list_sentry_roles_by_user(TListSentryRolesForUserRequest request) throws org.apache.thrift.TException
- {
- list_sentry_roles_by_user_args args = new list_sentry_roles_by_user_args();
- args.setRequest(request);
- sendBase("list_sentry_roles_by_user", args);
- }
-
- public TListSentryRolesResponse recv_list_sentry_roles_by_user() throws org.apache.thrift.TException
- {
- list_sentry_roles_by_user_result result = new list_sentry_roles_by_user_result();
- receiveBase(result, "list_sentry_roles_by_user");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_roles_by_user failed: unknown result");
- }
-
- public TListSentryPrivilegesResponse list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException
- {
- send_list_sentry_privileges_by_role(request);
- return recv_list_sentry_privileges_by_role();
- }
-
- public void send_list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException
- {
- list_sentry_privileges_by_role_args args = new list_sentry_privileges_by_role_args();
- args.setRequest(request);
- sendBase("list_sentry_privileges_by_role", args);
- }
-
- public TListSentryPrivilegesResponse recv_list_sentry_privileges_by_role() throws org.apache.thrift.TException
- {
- list_sentry_privileges_by_role_result result = new list_sentry_privileges_by_role_result();
- receiveBase(result, "list_sentry_privileges_by_role");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_privileges_by_role failed: unknown result");
- }
-
- public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException
- {
- send_list_sentry_privileges_for_provider(request);
- return recv_list_sentry_privileges_for_provider();
- }
-
- public void send_list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException
- {
- list_sentry_privileges_for_provider_args args = new list_sentry_privileges_for_provider_args();
- args.setRequest(request);
- sendBase("list_sentry_privileges_for_provider", args);
- }
-
- public TListSentryPrivilegesForProviderResponse recv_list_sentry_privileges_for_provider() throws org.apache.thrift.TException
- {
- list_sentry_privileges_for_provider_result result = new list_sentry_privileges_for_provider_result();
- receiveBase(result, "list_sentry_privileges_for_provider");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_privileges_for_provider failed: unknown result");
- }
-
- public TDropPrivilegesResponse drop_sentry_privilege(TDropPrivilegesRequest request) throws org.apache.thrift.TException
- {
- send_drop_sentry_privilege(request);
- return recv_drop_sentry_privilege();
- }
-
- public void send_drop_sentry_privilege(TDropPrivilegesRequest request) throws org.apache.thrift.TException
- {
- drop_sentry_privilege_args args = new drop_sentry_privilege_args();
- args.setRequest(request);
- sendBase("drop_sentry_privilege", args);
- }
-
- public TDropPrivilegesResponse recv_drop_sentry_privilege() throws org.apache.thrift.TException
- {
- drop_sentry_privilege_result result = new drop_sentry_privilege_result();
- receiveBase(result, "drop_sentry_privilege");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "drop_sentry_privilege failed: unknown result");
- }
-
- public TRenamePrivilegesResponse rename_sentry_privilege(TRenamePrivilegesRequest request) throws org.apache.thrift.TException
- {
- send_rename_sentry_privilege(request);
- return recv_rename_sentry_privilege();
- }
-
- public void send_rename_sentry_privilege(TRenamePrivilegesRequest request) throws org.apache.thrift.TException
- {
- rename_sentry_privilege_args args = new rename_sentry_privilege_args();
- args.setRequest(request);
- sendBase("rename_sentry_privilege", args);
- }
-
- public TRenamePrivilegesResponse recv_rename_sentry_privilege() throws org.apache.thrift.TException
- {
- rename_sentry_privilege_result result = new rename_sentry_privilege_result();
- receiveBase(result, "rename_sentry_privilege");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "rename_sentry_privilege failed: unknown result");
- }
-
- public TListSentryPrivilegesByAuthResponse list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request) throws org.apache.thrift.TException
- {
- send_list_sentry_privileges_by_authorizable(request);
- return recv_list_sentry_privileges_by_authorizable();
- }
-
- public void send_list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request) throws org.apache.thrift.TException
- {
- list_sentry_privileges_by_authorizable_args args = new list_sentry_privileges_by_authorizable_args();
- args.setRequest(request);
- sendBase("list_sentry_privileges_by_authorizable", args);
- }
-
- public TListSentryPrivilegesByAuthResponse recv_list_sentry_privileges_by_authorizable() throws org.apache.thrift.TException
- {
- list_sentry_privileges_by_authorizable_result result = new list_sentry_privileges_by_authorizable_result();
- receiveBase(result, "list_sentry_privileges_by_authorizable");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_privileges_by_authorizable failed: unknown result");
- }
-
- public TSentryConfigValueResponse get_sentry_config_value(TSentryConfigValueRequest request) throws org.apache.thrift.TException
- {
- send_get_sentry_config_value(request);
- return recv_get_sentry_config_value();
- }
-
- public void send_get_sentry_config_value(TSentryConfigValueRequest request) throws org.apache.thrift.TException
- {
- get_sentry_config_value_args args = new get_sentry_config_value_args();
- args.setRequest(request);
- sendBase("get_sentry_config_value", args);
- }
-
- public TSentryConfigValueResponse recv_get_sentry_config_value() throws org.apache.thrift.TException
- {
- get_sentry_config_value_result result = new get_sentry_config_value_result();
- receiveBase(result, "get_sentry_config_value");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "get_sentry_config_value failed: unknown result");
- }
-
- public TSentryExportMappingDataResponse export_sentry_mapping_data(TSentryExportMappingDataRequest request) throws org.apache.thrift.TException
- {
- send_export_sentry_mapping_data(request);
- return recv_export_sentry_mapping_data();
- }
-
- public void send_export_sentry_mapping_data(TSentryExportMappingDataRequest request) throws org.apache.thrift.TException
- {
- export_sentry_mapping_data_args args = new export_sentry_mapping_data_args();
- args.setRequest(request);
- sendBase("export_sentry_mapping_data", args);
- }
-
- public TSentryExportMappingDataResponse recv_export_sentry_mapping_data() throws org.apache.thrift.TException
- {
- export_sentry_mapping_data_result result = new export_sentry_mapping_data_result();
- receiveBase(result, "export_sentry_mapping_data");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "export_sentry_mapping_data failed: unknown result");
- }
-
- public TSentryImportMappingDataResponse import_sentry_mapping_data(TSentryImportMappingDataRequest request) throws org.apache.thrift.TException
- {
- send_import_sentry_mapping_data(request);
- return recv_import_sentry_mapping_data();
- }
-
- public void send_import_sentry_mapping_data(TSentryImportMappingDataRequest request) throws org.apache.thrift.TException
- {
- import_sentry_mapping_data_args args = new import_sentry_mapping_data_args();
- args.setRequest(request);
- sendBase("import_sentry_mapping_data", args);
- }
-
- public TSentryImportMappingDataResponse recv_import_sentry_mapping_data() throws org.apache.thrift.TException
- {
- import_sentry_mapping_data_result result = new import_sentry_mapping_data_result();
- receiveBase(result, "import_sentry_mapping_data");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "import_sentry_mapping_data failed: unknown result");
- }
-
- public TSentrySyncIDResponse sentry_sync_notifications(TSentrySyncIDRequest request) throws org.apache.thrift.TException
- {
- send_sentry_sync_notifications(request);
- return recv_sentry_sync_notifications();
- }
-
- public void send_sentry_sync_notifications(TSentrySyncIDRequest request) throws org.apache.thrift.TException
- {
- sentry_sync_notifications_args args = new sentry_sync_notifications_args();
- args.setRequest(request);
- sendBase("sentry_sync_notifications", args);
- }
-
- public TSentrySyncIDResponse recv_sentry_sync_notifications() throws org.apache.thrift.TException
- {
- sentry_sync_notifications_result result = new sentry_sync_notifications_result();
- receiveBase(result, "sentry_sync_notifications");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "sentry_sync_notifications 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> {
- private org.apache.thrift.async.TAsyncClientManager clientManager;
- private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
- public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
- this.clientManager = clientManager;
- this.protocolFactory = protocolFactory;
- }
- public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
- return new AsyncClient(protocolFactory, clientManager, transport);
- }
- }
-
- public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
- super(protocolFactory, clientManager, transport);
- }
-
- public void create_sentry_role(TCreateSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- create_sentry_role_call method_call = new create_sentry_role_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class create_sentry_role_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TCreateSentryRoleRequest request;
- public create_sentry_role_call(TCreateSentryRoleRequest 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("create_sentry_role", org.apache.thrift.protocol.TMessageType.CALL, 0));
- create_sentry_role_args args = new create_sentry_role_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TCreateSentryRoleResponse 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_create_sentry_role();
- }
- }
-
- public void drop_sentry_role(TDropSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- drop_sentry_role_call method_call = new drop_sentry_role_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class drop_sentry_role_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TDropSentryRoleRequest request;
- public drop_sentry_role_call(TDropSentryRoleRequest 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("drop_sentry_role", org.apache.thrift.protocol.TMessageType.CALL, 0));
- drop_sentry_role_args args = new drop_sentry_role_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TDropSentryRoleResponse 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_drop_sentry_role();
- }
- }
-
- public void alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- alter_sentry_role_grant_privilege_call method_call = new alter_sentry_role_grant_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class alter_sentry_role_grant_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TAlterSentryRoleGrantPrivilegeRequest request;
- public alter_sentry_role_grant_privilege_call(TAlterSentryRoleGrantPrivilegeRequest 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("alter_sentry_role_grant_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
- alter_sentry_role_grant_privilege_args args = new alter_sentry_role_grant_privilege_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse 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_alter_sentry_role_grant_privilege();
- }
- }
-
- public void alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- alter_sentry_role_revoke_privilege_call method_call = new alter_sentry_role_revoke_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class alter_sentry_role_revoke_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TAlterSentryRoleRevokePrivilegeRequest request;
- public alter_sentry_role_revoke_privilege_call(TAlterSentryRoleRevokePrivilegeRequest 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("alter_sentry_role_revoke_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
- alter_sentry_role_revoke_privilege_args args = new alter_sentry_role_revoke_privilege_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse 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_alter_sentry_role_revoke_privilege();
- }
- }
-
- public void alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- alter_sentry_role_add_groups_call method_call = new alter_sentry_role_add_groups_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class alter_sentry_role_add_groups_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TAlterSentryRoleAddGroupsRequest request;
- public alter_sentry_role_add_groups_call(TAlterSentryRoleAddGroupsRequest 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("alter_sentry_role_add_groups", org.apache.thrift.protocol.TMessageType.CALL, 0));
- alter_sentry_role_add_groups_args args = new alter_sentry_role_add_groups_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TAlterSentryRoleAddGroupsResponse 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_alter_sentry_role_add_groups();
- }
- }
-
- public void alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- alter_sentry_role_delete_groups_call method_call = new alter_sentry_role_delete_groups_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class alter_sentry_role_delete_groups_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TAlterSentryRoleDeleteGroupsRequest request;
- public alter_sentry_role_delete_groups_call(TAlterSentryRoleDeleteGroupsRequest 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("alter_sentry_role_delete_groups", org.apache.thrift.protocol.TMessageType.CALL, 0));
- alter_sentry_role_delete_groups_args args = new alter_sentry_role_delete_groups_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TAlterSentryRoleDeleteGroupsResponse 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_alter_sentry_role_delete_groups();
- }
- }
-
- public void alter_sentry_role_add_users(TAlterSentryRoleAddUsersRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- alter_sentry_role_add_users_call method_call = new alter_sentry_role_add_users_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class alter_sentry_role_add_users_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TAlterSentryRoleAddUsersRequest request;
- public alter_sentry_role_add_users_call(TAlterSentryRoleAddUsersRequest 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("alter_sentry_role_add_users", org.apache.thrift.protocol.TMessageType.CALL, 0));
- alter_sentry_role_add_users_args args = new alter_sentry_role_add_users_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TAlterSentryRoleAddUsersResponse 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_alter_sentry_role_add_users();
- }
- }
-
- public void alter_sentry_role_delete_users(TAlterSentryRoleDeleteUsersRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- alter_sentry_role_delete_users_call method_call = new alter_sentry_role_delete_users_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class alter_sentry_role_delete_users_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TAlterSentryRoleDeleteUsersRequest request;
- public alter_sentry_role_delete_users_call(TAlterSentryRoleDeleteUsersRequest 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("alter_sentry_role_delete_users", org.apache.thrift.protocol.TMessageType.CALL, 0));
- alter_sentry_role_delete_users_args args = new alter_sentry_role_delete_users_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TAlterSentryRoleDeleteUsersResponse 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_alter_sentry_role_delete_users();
- }
- }
-
- public void list_sentry_roles_by_group(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- list_sentry_roles_by_group_call method_call = new list_sentry_roles_by_group_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class list_sentry_roles_by_group_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TListSentryRolesRequest request;
- public list_sentry_roles_by_group_call(TListSentryRolesRequest 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("list_sentry_roles_by_group", org.apache.thrift.protocol.TMessageType.CALL, 0));
- list_sentry_roles_by_group_args args = new list_sentry_roles_by_group_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TListSentryRolesResponse 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_list_sentry_roles_by_group();
- }
- }
-
- public void list_sentry_roles_by_user(TListSentryRolesForUserRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- list_sentry_roles_by_user_call method_call = new list_sentry_roles_by_user_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class list_sentry_roles_by_user_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TListSentryRolesForUserRequest request;
- public list_sentry_roles_by_user_call(TListSentryRolesForUserRequest 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("list_sentry_roles_by_user", org.apache.thrift.protocol.TMessageType.CALL, 0));
- list_sentry_roles_by_user_args args = new list_sentry_roles_by_user_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TListSentryRolesResponse 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_list_sentry_roles_by_user();
- }
- }
-
- public void list_sentry_privileges_by_role(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- list_sentry_privileges_by_role_call method_call = new list_sentry_privileges_by_role_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class list_sentry_privileges_by_role_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TListSentryPrivilegesRequest request;
- public list_sentry_privileges_by_role_call(TListSentryPrivilegesRequest 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("list_sentry_privileges_by_role", org.apache.thrift.protocol.TMessageType.CALL, 0));
- list_sentry_privileges_by_role_args args = new list_sentry_privileges_by_role_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TListSentryPrivilegesResponse 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_list_sentry_privileges_by_role();
- }
- }
-
- public void list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- list_sentry_privileges_for_provider_call method_call = new list_sentry_privileges_for_provider_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class list_sentry_privileges_for_provider_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TListSentryPrivilegesForProviderRequest request;
- public list_sentry_privileges_for_provider_call(TListSentryPrivilegesForProviderRequest 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("list_sentry_privileges_for_provider", org.apache.thrift.protocol.TMessageType.CALL, 0));
- list_sentry_privileges_for_provider_args args = new list_sentry_privileges_for_provider_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TListSentryPrivilegesForProviderResponse 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_list_sentry_privileges_for_provider();
- }
- }
-
- public void drop_sentry_privilege(TDropPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- drop_sentry_privilege_call method_call = new drop_sentry_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class drop_sentry_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TDropPrivilegesRequest request;
- public drop_sentry_privilege_call(TDropPrivilegesRequest 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("drop_sentry_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
- drop_sentry_privilege_args args = new drop_sentry_privilege_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TDropPrivilegesResponse 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_drop_sentry_privilege();
- }
- }
-
- public void rename_sentry_privilege(TRenamePrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- rename_sentry_privilege_call method_call = new rename_sentry_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class rename_sentry_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TRenamePrivilegesRequest request;
- public rename_sentry_privilege_call(TRenamePrivilegesRequest 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("rename_sentry_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
- rename_sentry_privilege_args args = new rename_sentry_privilege_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TRenamePrivilegesResponse 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_rename_sentry_privilege();
- }
- }
-
- public void list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- list_sentry_privileges_by_authorizable_call method_call = new list_sentry_privileges_by_authorizable_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class list_sentry_privileges_by_authorizable_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TListSentryPrivilegesByAuthRequest request;
- public list_sentry_privileges_by_authorizable_call(TListSentryPrivilegesByAuthRequest 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("list_sentry_privileges_by_authorizable", org.apache.thrift.protocol.TMessageType.CALL, 0));
- list_sentry_privileges_by_authorizable_args args = new list_sentry_privileges_by_authorizable_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TListSentryPrivilegesByAuthResponse 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_list_sentry_privileges_by_authorizable();
- }
- }
-
- public void get_sentry_config_value(TSentryConfigValueRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- get_sentry_config_value_call method_call = new get_sentry_config_value_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class get_sentry_config_value_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TSentryConfigValueRequest request;
- public get_sentry_config_value_call(TSentryConfigValueRequest 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("get_sentry_config_value", org.apache.thrift.protocol.TMessageType.CALL, 0));
- get_sentry_config_value_args args = new get_sentry_config_value_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TSentryConfigValueResponse 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_get_sentry_config_value();
- }
- }
-
- public void export_sentry_mapping_data(TSentryExportMappingDataRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- export_sentry_mapping_data_call method_call = new export_sentry_mapping_data_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class export_sentry_mapping_data_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TSentryExportMappingDataRequest request;
- public export_sentry_mapping_data_call(TSentryExportMappingDataRequest 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("export_sentry_mapping_data", org.apache.thrift.protocol.TMessageType.CALL, 0));
- export_sentry_mapping_data_args args = new export_sentry_mapping_data_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TSentryExportMappingDataResponse 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_export_sentry_mapping_data();
- }
- }
-
- public void import_sentry_mapping_data(TSentryImportMappingDataRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- import_sentry_mapping_data_call method_call = new import_sentry_mapping_data_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class import_sentry_mapping_data_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TSentryImportMappingDataRequest request;
- public import_sentry_mapping_data_call(TSentryImportMappingDataRequest 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("import_sentry_mapping_data", org.apache.thrift.protocol.TMessageType.CALL, 0));
- import_sentry_mapping_data_args args = new import_sentry_mapping_data_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TSentryImportMappingDataResponse 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_import_sentry_mapping_data();
- }
- }
-
- public void sentry_sync_notifications(TSentrySyncIDRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- sentry_sync_notifications_call method_call = new sentry_sync_notifications_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class sentry_sync_notifications_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TSentrySyncIDRequest request;
- public sentry_sync_notifications_call(TSentrySyncIDRequest 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_sync_notifications", org.apache.thrift.protocol.TMessageType.CALL, 0));
- sentry_sync_notifications_args args = new sentry_sync_notifications_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TSentrySyncIDResponse 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_sync_notifications();
- }
- }
-
- }
-
- public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
- private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
- public Processor(I iface) {
- super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
- }
-
- protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
- super(iface, getProcessMap(processMap));
- }
-
- private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
- processMap.put("create_sentry_role", new create_sentry_role());
- processMap.put("drop_sentry_role", new drop_sentry_role());
- processMap.put("alter_sentry_role_grant_privilege", new alter_sentry_role_grant_privilege());
- processMap.put("alter_sentry_role_revoke_privilege", new alter_sentry_role_revoke_privilege());
- processMap.put("alter_sentry_role_add_groups", new alter_sentry_role_add_groups());
- processMap.put("alter_sentry_role_delete_groups", new alter_sentry_role_delete_groups());
- processMap.put("alter_sentry_role_add_users", new alter_sentry_role_add_users());
- processMap.put("alter_sentry_role_delete_users", new alter_sentry_role_delete_users());
- processMap.put("list_sentry_roles_by_group", new list_sentry_roles_by_group());
- processMap.put("list_sentry_roles_by_user", new list_sentry_roles_by_user());
- processMap.put("list_sentry_privileges_by_role", new list_sentry_privileges_by_role());
- processMap.put("list_sentry_privileges_for_provider", new list_sentry_privileges_for_provider());
- processMap.put("drop_sentry_privilege", new drop_sentry_privilege());
- processMap.put("rename_sentry_privilege", new rename_sentry_privilege());
- processMap.put("list_sentry_privileges_by_authorizable", new list_sentry_privileges_by_authorizable());
- processMap.put("get_sentry_config_value", new get_sentry_config_value());
- 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());
- return processMap;
- }
-
- public static class create_sentry_role<I extends Iface> extends org.apache.thrift.ProcessFunction<I, create_sentry_role_args> {
- public create_sentry_role() {
- super("create_sentry_role");
- }
-
- public create_sentry_role_args getEmptyArgsInstance() {
- return new create_sentry_role_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public create_sentry_role_result getResult(I iface, create_sentry_role_args args) throws org.apache.thrift.TException {
- create_sentry_role_result result = new create_sentry_role_result();
- result.success = iface.create_sentry_role(args.request);
- return result;
- }
- }
-
- public static class drop_sentry_role<I extends Iface> extends org.apache.thrift.ProcessFunction<I, drop_sentry_role_args> {
- public drop_sentry_role() {
- super("drop_sentry_role");
- }
-
- public drop_sentry_role_args getEmptyArgsInstance() {
- return new drop_sentry_role_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public drop_sentry_role_result getResult(I iface, drop_sentry_role_args args) throws org.apache.thrift.TException {
- drop_sentry_role_result result = new drop_sentry_role_result();
- result.success = iface.drop_sentry_role(args.request);
- return result;
- }
- }
-
- public static class alter_sentry_role_grant_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_grant_privilege_args> {
- public alter_sentry_role_grant_privilege() {
- super("alter_sentry_role_grant_privilege");
- }
-
- public alter_sentry_role_grant_privilege_args getEmptyArgsInstance() {
- return new alter_sentry_role_grant_privilege_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public alter_sentry_role_grant_privilege_result getResult(I iface, alter_sentry_role_grant_privilege_args args) throws org.apache.thrift.TException {
- alter_sentry_role_grant_privilege_result result = new alter_sentry_role_grant_privilege_result();
- result.success = iface.alter_sentry_role_grant_privilege(args.request);
- return result;
- }
- }
-
- public static class alter_sentry_role_revoke_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_revoke_privilege_args> {
- public alter_sentry_role_revoke_privilege() {
- super("alter_sentry_role_revoke_privilege");
- }
-
- public alter_sentry_role_revoke_privilege_args getEmptyArgsInstance() {
- return new alter_sentry_role_revoke_privilege_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public alter_sentry_role_revoke_privilege_result getResult(I iface, alter_sentry_role_revoke_privilege_args args) throws org.apache.thrift.TException {
- alter_sentry_role_revoke_privilege_result result = new alter_sentry_role_revoke_privilege_result();
- result.success = iface.alter_sentry_role_revoke_privilege(args.request);
- return result;
- }
- }
-
- public static class alter_sentry_role_add_groups<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_add_groups_args> {
- public alter_sentry_role_add_groups() {
- super("alter_sentry_role_add_groups");
- }
-
- public alter_sentry_role_add_groups_args getEmptyArgsInstance() {
- return new alter_sentry_role_add_groups_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public alter_sentry_role_add_groups_result getResult(I iface, alter_sentry_role_add_groups_args args) throws org.apache.thrift.TException {
- alter_sentry_role_add_groups_result result = new alter_sentry_role_add_groups_result();
- result.success = iface.alter_sentry_role_add_groups(args.request);
- return result;
- }
- }
-
- public static class alter_sentry_role_delete_groups<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_delete_groups_args> {
- public alter_sentry_role_delete_groups() {
- super("alter_sentry_role_delete_groups");
- }
-
- public alter_sentry_role_delete_groups_args getEmptyArgsInstance() {
- return new alter_sentry_role_delete_groups_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public alter_sentry_role_delete_groups_result getResult(I iface, alter_sentry_role_delete_groups_args args) throws org.apache.thrift.TException {
- alter_sentry_role_delete_groups_result result = new alter_sentry_role_delete_groups_result();
- result.success = iface.alter_sentry_role_delete_groups(args.request);
- return result;
- }
- }
-
- public static class alter_sentry_role_add_users<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_add_users_args> {
- public alter_sentry_role_add_users() {
- super("alter_sentry_role_add_users");
- }
-
- public alter_sentry_role_add_users_args getEmptyArgsInstance() {
- return new alter_sentry_role_add_users_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public alter_sentry_role_add_users_result getResult(I iface, alter_sentry_role_add_users_args args) throws org.apache.thrift.TException {
- alter_sentry_role_add_users_result result = new alter_sentry_role_add_users_result();
- result.success = iface.alter_sentry_role_add_users(args.request);
- return result;
- }
- }
-
- public static class alter_sentry_role_delete_users<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_delete_users_args> {
- public alter_sentry_role_delete_users() {
- super("alter_sentry_role_delete_users");
- }
-
- public alter_sentry_role_delete_users_args getEmptyArgsInstance() {
- return new alter_sentry_role_delete_users_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public alter_sentry_role_delete_users_result getResult(I iface, alter_sentry_role_delete_users_args args) throws org.apache.thrift.TException {
- alter_sentry_role_delete_users_result result = new alter_sentry_role_delete_users_result();
- result.success = iface.alter_sentry_role_delete_users(args.request);
- return result;
- }
- }
-
- public static class list_sentry_roles_by_group<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_roles_by_group_args> {
- public list_sentry_roles_by_group() {
- super("list_sentry_roles_by_group");
- }
-
- public list_sentry_roles_by_group_args getEmptyArgsInstance() {
- return new list_sentry_roles_by_group_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public list_sentry_roles_by_group_result getResult(I iface, list_sentry_roles_by_group_args args) throws org.apache.thrift.TException {
- list_sentry_roles_by_group_result result = new list_sentry_roles_by_group_result();
- result.success = iface.list_sentry_roles_by_group(args.request);
- return result;
- }
- }
-
- public static class list_sentry_roles_by_user<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_roles_by_user_args> {
- public list_sentry_roles_by_user() {
- super("list_sentry_roles_by_user");
- }
-
- public list_sentry_roles_by_user_args getEmptyArgsInstance() {
- return new list_sentry_roles_by_user_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public list_sentry_roles_by_user_result getResult(I iface, list_sentry_roles_by_user_args args) throws org.apache.thrift.TException {
- list_sentry_roles_by_user_result result = new list_sentry_roles_by_user_result();
- result.success = iface.list_sentry_roles_by_user(args.request);
- return result;
- }
- }
-
- public static class list_sentry_privileges_by_role<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_privileges_by_role_args> {
- public list_sentry_privileges_by_role() {
- super("list_sentry_privileges_by_role");
- }
-
- public list_sentry_privileges_by_role_args getEmptyArgsInstance() {
- return new list_sentry_privileges_by_role_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public list_sentry_privileges_by_role_result getResult(I iface, list_sentry_privileges_by_role_args args) throws org.apache.thrift.TException {
- list_sentry_privileges_by_role_result result = new list_sentry_privileges_by_role_result();
- result.success = iface.list_sentry_privileges_by_role(args.request);
- return result;
- }
- }
-
- public static class list_sentry_privileges_for_provider<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_privileges_for_provider_args> {
- public list_sentry_privileges_for_provider() {
- super("list_sentry_privileges_for_provider");
- }
-
- public list_sentry_privileges_for_provider_args getEmptyArgsInstance() {
- return new list_sentry_privileges_for_provider_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public list_sentry_privileges_for_provider_result getResult(I iface, list_sentry_privileges_for_provider_args args) throws org.apache.thrift.TException {
- list_sentry_privileges_for_provider_result result = new list_sentry_privileges_for_provider_result();
- result.success = iface.list_sentry_privileges_for_provider(args.request);
- return result;
- }
- }
-
- public static class drop_sentry_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, drop_sentry_privilege_args> {
- public drop_sentry_privilege() {
- super("drop_sentry_privilege");
- }
-
- public drop_sentry_privilege_args getEmptyArgsInstance() {
- return new drop_sentry_privilege_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public drop_sentry_privilege_result getResult(I iface, drop_sentry_privilege_args args) throws org.apache.thrift.TException {
- drop_sentry_privilege_result result = new drop_sentry_privilege_result();
- result.success = iface.drop_sentry_privilege(args.request);
- return result;
- }
- }
-
- public static class rename_sentry_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, rename_sentry_privilege_args> {
- public rename_sentry_privilege() {
- super("rename_sentry_privilege");
- }
-
- public rename_sentry_privilege_args getEmptyArgsInstance() {
- return new rename_sentry_privilege_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public rename_sentry_privilege_result getResult(I iface, rename_sentry_privilege_args args) throws org.apache.thrift.TException {
- rename_sentry_privilege_result result = new rename_sentry_privilege_result();
- result.success = iface.rename_sentry_privilege(args.request);
- return result;
- }
- }
-
- public static class list_sentry_privileges_by_authorizable<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_privileges_by_authorizable_args> {
- public list_sentry_privileges_by_authorizable() {
- super("list_sentry_privileges_by_authorizable");
- }
-
- public list_sentry_privileges_by_authorizable_args getEmptyArgsInstance() {
- return new list_sentry_privileges_by_authorizable_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public list_sentry_privileges_by_authorizable_result getResult(I iface, list_sentry_privileges_by_authorizable_args args) throws org.apache.thrift.TException {
- list_sentry_privileges_by_authorizable_result result = new list_sentry_privileges_by_authorizable_result();
- result.success = iface.list_sentry_privileges_by_authorizable(args.request);
- return result;
- }
- }
-
- public static class get_sentry_config_value<I extends Iface> extends org.apache.thrift.ProcessFunction<I, get_sentry_config_value_args> {
- public get_sentry_config_value() {
- super("get_sentry_config_value");
- }
-
- public get_sentry_config_value_args getEmptyArgsInstance() {
- return new get_sentry_config_value_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public get_sentry_config_value_result getResult(I iface, get_sentry_config_value_args args) throws org.apache.thrift.TException {
- get_sentry_config_value_result result = new get_sentry_config_value_result();
- result.success = iface.get_sentry_config_value(args.request);
- return result;
- }
- }
-
- public static class export_sentry_mapping_data<I extends Iface> extends org.apache.thrift.ProcessFunction<I, export_sentry_mapping_data_args> {
- public export_sentry_mapping_data() {
- super("export_sentry_mapping_data");
- }
-
- public export_sentry_mapping_data_args getEmptyArgsInstance() {
- return new export_sentry_mapping_data_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public export_sentry_mapping_data_result getResult(I iface, export_sentry_mapping_data_args args) throws org.apache.thrift.TException {
- export_sentry_mapping_data_result result = new export_sentry_mapping_data_result();
- result.success = iface.export_sentry_mapping_data(args.request);
- return result;
- }
- }
-
- public static class import_sentry_mapping_data<I extends Iface> extends org.apache.thrift.ProcessFunction<I, import_sentry_mapping_data_args> {
- public import_sentry_mapping_data() {
- super("import_sentry_mapping_data");
- }
-
- public import_sentry_mapping_data_args getEmptyArgsInstance() {
- return new import_sentry_ma
<TRUNCATED>
[40/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryPrivilege.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryPrivilege.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryPrivilege.java
deleted file mode 100644
index d20c4b1..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryPrivilege.java
+++ /dev/null
@@ -1,1080 +0,0 @@
-/**
- * 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.provider.db.generic.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 TSentryPrivilege implements org.apache.thrift.TBase<TSentryPrivilege, TSentryPrivilege._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryPrivilege> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryPrivilege");
-
- private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final org.apache.thrift.protocol.TField SERVICE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("serviceName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField AUTHORIZABLES_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizables", org.apache.thrift.protocol.TType.LIST, (short)3);
- private static final org.apache.thrift.protocol.TField ACTION_FIELD_DESC = new org.apache.thrift.protocol.TField("action", org.apache.thrift.protocol.TType.STRING, (short)4);
- private static final org.apache.thrift.protocol.TField CREATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("createTime", org.apache.thrift.protocol.TType.I64, (short)5);
- private static final org.apache.thrift.protocol.TField GRANTOR_PRINCIPAL_FIELD_DESC = new org.apache.thrift.protocol.TField("grantorPrincipal", org.apache.thrift.protocol.TType.STRING, (short)6);
- private static final org.apache.thrift.protocol.TField GRANT_OPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("grantOption", org.apache.thrift.protocol.TType.I32, (short)7);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryPrivilegeStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryPrivilegeTupleSchemeFactory());
- }
-
- private String component; // required
- private String serviceName; // required
- private List<TAuthorizable> authorizables; // required
- private String action; // required
- private long createTime; // optional
- private String grantorPrincipal; // optional
- private TSentryGrantOption grantOption; // optional
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- COMPONENT((short)1, "component"),
- SERVICE_NAME((short)2, "serviceName"),
- AUTHORIZABLES((short)3, "authorizables"),
- ACTION((short)4, "action"),
- CREATE_TIME((short)5, "createTime"),
- GRANTOR_PRINCIPAL((short)6, "grantorPrincipal"),
- /**
- *
- * @see TSentryGrantOption
- */
- GRANT_OPTION((short)7, "grantOption");
-
- 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: // COMPONENT
- return COMPONENT;
- case 2: // SERVICE_NAME
- return SERVICE_NAME;
- case 3: // AUTHORIZABLES
- return AUTHORIZABLES;
- case 4: // ACTION
- return ACTION;
- case 5: // CREATE_TIME
- return CREATE_TIME;
- case 6: // GRANTOR_PRINCIPAL
- return GRANTOR_PRINCIPAL;
- case 7: // GRANT_OPTION
- return GRANT_OPTION;
- 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 __CREATETIME_ISSET_ID = 0;
- private byte __isset_bitfield = 0;
- private static final _Fields optionals[] = {_Fields.CREATE_TIME,_Fields.GRANTOR_PRINCIPAL,_Fields.GRANT_OPTION};
- 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.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.SERVICE_NAME, new org.apache.thrift.meta_data.FieldMetaData("serviceName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.AUTHORIZABLES, new org.apache.thrift.meta_data.FieldMetaData("authorizables", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAuthorizable.class))));
- tmpMap.put(_Fields.ACTION, new org.apache.thrift.meta_data.FieldMetaData("action", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.CREATE_TIME, new org.apache.thrift.meta_data.FieldMetaData("createTime", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
- tmpMap.put(_Fields.GRANTOR_PRINCIPAL, new org.apache.thrift.meta_data.FieldMetaData("grantorPrincipal", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.GRANT_OPTION, new org.apache.thrift.meta_data.FieldMetaData("grantOption", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TSentryGrantOption.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryPrivilege.class, metaDataMap);
- }
-
- public TSentryPrivilege() {
- this.grantOption = org.apache.sentry.provider.db.generic.service.thrift.TSentryGrantOption.FALSE;
-
- }
-
- public TSentryPrivilege(
- String component,
- String serviceName,
- List<TAuthorizable> authorizables,
- String action)
- {
- this();
- this.component = component;
- this.serviceName = serviceName;
- this.authorizables = authorizables;
- this.action = action;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryPrivilege(TSentryPrivilege other) {
- __isset_bitfield = other.__isset_bitfield;
- if (other.isSetComponent()) {
- this.component = other.component;
- }
- if (other.isSetServiceName()) {
- this.serviceName = other.serviceName;
- }
- if (other.isSetAuthorizables()) {
- List<TAuthorizable> __this__authorizables = new ArrayList<TAuthorizable>(other.authorizables.size());
- for (TAuthorizable other_element : other.authorizables) {
- __this__authorizables.add(new TAuthorizable(other_element));
- }
- this.authorizables = __this__authorizables;
- }
- if (other.isSetAction()) {
- this.action = other.action;
- }
- this.createTime = other.createTime;
- if (other.isSetGrantorPrincipal()) {
- this.grantorPrincipal = other.grantorPrincipal;
- }
- if (other.isSetGrantOption()) {
- this.grantOption = other.grantOption;
- }
- }
-
- public TSentryPrivilege deepCopy() {
- return new TSentryPrivilege(this);
- }
-
- @Override
- public void clear() {
- this.component = null;
- this.serviceName = null;
- this.authorizables = null;
- this.action = null;
- setCreateTimeIsSet(false);
- this.createTime = 0;
- this.grantorPrincipal = null;
- this.grantOption = org.apache.sentry.provider.db.generic.service.thrift.TSentryGrantOption.FALSE;
-
- }
-
- public String getComponent() {
- return this.component;
- }
-
- public void setComponent(String component) {
- this.component = component;
- }
-
- public void unsetComponent() {
- this.component = null;
- }
-
- /** Returns true if field component is set (has been assigned a value) and false otherwise */
- public boolean isSetComponent() {
- return this.component != null;
- }
-
- public void setComponentIsSet(boolean value) {
- if (!value) {
- this.component = null;
- }
- }
-
- public String getServiceName() {
- return this.serviceName;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- public void unsetServiceName() {
- this.serviceName = null;
- }
-
- /** Returns true if field serviceName is set (has been assigned a value) and false otherwise */
- public boolean isSetServiceName() {
- return this.serviceName != null;
- }
-
- public void setServiceNameIsSet(boolean value) {
- if (!value) {
- this.serviceName = null;
- }
- }
-
- public int getAuthorizablesSize() {
- return (this.authorizables == null) ? 0 : this.authorizables.size();
- }
-
- public java.util.Iterator<TAuthorizable> getAuthorizablesIterator() {
- return (this.authorizables == null) ? null : this.authorizables.iterator();
- }
-
- public void addToAuthorizables(TAuthorizable elem) {
- if (this.authorizables == null) {
- this.authorizables = new ArrayList<TAuthorizable>();
- }
- this.authorizables.add(elem);
- }
-
- public List<TAuthorizable> getAuthorizables() {
- return this.authorizables;
- }
-
- public void setAuthorizables(List<TAuthorizable> authorizables) {
- this.authorizables = authorizables;
- }
-
- public void unsetAuthorizables() {
- this.authorizables = null;
- }
-
- /** Returns true if field authorizables is set (has been assigned a value) and false otherwise */
- public boolean isSetAuthorizables() {
- return this.authorizables != null;
- }
-
- public void setAuthorizablesIsSet(boolean value) {
- if (!value) {
- this.authorizables = null;
- }
- }
-
- public String getAction() {
- return this.action;
- }
-
- public void setAction(String action) {
- this.action = action;
- }
-
- public void unsetAction() {
- this.action = null;
- }
-
- /** Returns true if field action is set (has been assigned a value) and false otherwise */
- public boolean isSetAction() {
- return this.action != null;
- }
-
- public void setActionIsSet(boolean value) {
- if (!value) {
- this.action = null;
- }
- }
-
- public long getCreateTime() {
- return this.createTime;
- }
-
- public void setCreateTime(long createTime) {
- this.createTime = createTime;
- setCreateTimeIsSet(true);
- }
-
- public void unsetCreateTime() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CREATETIME_ISSET_ID);
- }
-
- /** Returns true if field createTime is set (has been assigned a value) and false otherwise */
- public boolean isSetCreateTime() {
- return EncodingUtils.testBit(__isset_bitfield, __CREATETIME_ISSET_ID);
- }
-
- public void setCreateTimeIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CREATETIME_ISSET_ID, value);
- }
-
- public String getGrantorPrincipal() {
- return this.grantorPrincipal;
- }
-
- public void setGrantorPrincipal(String grantorPrincipal) {
- this.grantorPrincipal = grantorPrincipal;
- }
-
- public void unsetGrantorPrincipal() {
- this.grantorPrincipal = null;
- }
-
- /** Returns true if field grantorPrincipal is set (has been assigned a value) and false otherwise */
- public boolean isSetGrantorPrincipal() {
- return this.grantorPrincipal != null;
- }
-
- public void setGrantorPrincipalIsSet(boolean value) {
- if (!value) {
- this.grantorPrincipal = null;
- }
- }
-
- /**
- *
- * @see TSentryGrantOption
- */
- public TSentryGrantOption getGrantOption() {
- return this.grantOption;
- }
-
- /**
- *
- * @see TSentryGrantOption
- */
- public void setGrantOption(TSentryGrantOption grantOption) {
- this.grantOption = grantOption;
- }
-
- public void unsetGrantOption() {
- this.grantOption = null;
- }
-
- /** Returns true if field grantOption is set (has been assigned a value) and false otherwise */
- public boolean isSetGrantOption() {
- return this.grantOption != null;
- }
-
- public void setGrantOptionIsSet(boolean value) {
- if (!value) {
- this.grantOption = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case COMPONENT:
- if (value == null) {
- unsetComponent();
- } else {
- setComponent((String)value);
- }
- break;
-
- case SERVICE_NAME:
- if (value == null) {
- unsetServiceName();
- } else {
- setServiceName((String)value);
- }
- break;
-
- case AUTHORIZABLES:
- if (value == null) {
- unsetAuthorizables();
- } else {
- setAuthorizables((List<TAuthorizable>)value);
- }
- break;
-
- case ACTION:
- if (value == null) {
- unsetAction();
- } else {
- setAction((String)value);
- }
- break;
-
- case CREATE_TIME:
- if (value == null) {
- unsetCreateTime();
- } else {
- setCreateTime((Long)value);
- }
- break;
-
- case GRANTOR_PRINCIPAL:
- if (value == null) {
- unsetGrantorPrincipal();
- } else {
- setGrantorPrincipal((String)value);
- }
- break;
-
- case GRANT_OPTION:
- if (value == null) {
- unsetGrantOption();
- } else {
- setGrantOption((TSentryGrantOption)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case COMPONENT:
- return getComponent();
-
- case SERVICE_NAME:
- return getServiceName();
-
- case AUTHORIZABLES:
- return getAuthorizables();
-
- case ACTION:
- return getAction();
-
- case CREATE_TIME:
- return getCreateTime();
-
- case GRANTOR_PRINCIPAL:
- return getGrantorPrincipal();
-
- case GRANT_OPTION:
- return getGrantOption();
-
- }
- 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 COMPONENT:
- return isSetComponent();
- case SERVICE_NAME:
- return isSetServiceName();
- case AUTHORIZABLES:
- return isSetAuthorizables();
- case ACTION:
- return isSetAction();
- case CREATE_TIME:
- return isSetCreateTime();
- case GRANTOR_PRINCIPAL:
- return isSetGrantorPrincipal();
- case GRANT_OPTION:
- return isSetGrantOption();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryPrivilege)
- return this.equals((TSentryPrivilege)that);
- return false;
- }
-
- public boolean equals(TSentryPrivilege that) {
- if (that == null)
- return false;
-
- boolean this_present_component = true && this.isSetComponent();
- boolean that_present_component = true && that.isSetComponent();
- if (this_present_component || that_present_component) {
- if (!(this_present_component && that_present_component))
- return false;
- if (!this.component.equals(that.component))
- return false;
- }
-
- boolean this_present_serviceName = true && this.isSetServiceName();
- boolean that_present_serviceName = true && that.isSetServiceName();
- if (this_present_serviceName || that_present_serviceName) {
- if (!(this_present_serviceName && that_present_serviceName))
- return false;
- if (!this.serviceName.equals(that.serviceName))
- return false;
- }
-
- boolean this_present_authorizables = true && this.isSetAuthorizables();
- boolean that_present_authorizables = true && that.isSetAuthorizables();
- if (this_present_authorizables || that_present_authorizables) {
- if (!(this_present_authorizables && that_present_authorizables))
- return false;
- if (!this.authorizables.equals(that.authorizables))
- return false;
- }
-
- boolean this_present_action = true && this.isSetAction();
- boolean that_present_action = true && that.isSetAction();
- if (this_present_action || that_present_action) {
- if (!(this_present_action && that_present_action))
- return false;
- if (!this.action.equals(that.action))
- return false;
- }
-
- boolean this_present_createTime = true && this.isSetCreateTime();
- boolean that_present_createTime = true && that.isSetCreateTime();
- if (this_present_createTime || that_present_createTime) {
- if (!(this_present_createTime && that_present_createTime))
- return false;
- if (this.createTime != that.createTime)
- return false;
- }
-
- boolean this_present_grantorPrincipal = true && this.isSetGrantorPrincipal();
- boolean that_present_grantorPrincipal = true && that.isSetGrantorPrincipal();
- if (this_present_grantorPrincipal || that_present_grantorPrincipal) {
- if (!(this_present_grantorPrincipal && that_present_grantorPrincipal))
- return false;
- if (!this.grantorPrincipal.equals(that.grantorPrincipal))
- return false;
- }
-
- boolean this_present_grantOption = true && this.isSetGrantOption();
- boolean that_present_grantOption = true && that.isSetGrantOption();
- if (this_present_grantOption || that_present_grantOption) {
- if (!(this_present_grantOption && that_present_grantOption))
- return false;
- if (!this.grantOption.equals(that.grantOption))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List<Object> list = new ArrayList<Object>();
-
- boolean present_component = true && (isSetComponent());
- list.add(present_component);
- if (present_component)
- list.add(component);
-
- boolean present_serviceName = true && (isSetServiceName());
- list.add(present_serviceName);
- if (present_serviceName)
- list.add(serviceName);
-
- boolean present_authorizables = true && (isSetAuthorizables());
- list.add(present_authorizables);
- if (present_authorizables)
- list.add(authorizables);
-
- boolean present_action = true && (isSetAction());
- list.add(present_action);
- if (present_action)
- list.add(action);
-
- boolean present_createTime = true && (isSetCreateTime());
- list.add(present_createTime);
- if (present_createTime)
- list.add(createTime);
-
- boolean present_grantorPrincipal = true && (isSetGrantorPrincipal());
- list.add(present_grantorPrincipal);
- if (present_grantorPrincipal)
- list.add(grantorPrincipal);
-
- boolean present_grantOption = true && (isSetGrantOption());
- list.add(present_grantOption);
- if (present_grantOption)
- list.add(grantOption.getValue());
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryPrivilege other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetComponent()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetServiceName()).compareTo(other.isSetServiceName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetServiceName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serviceName, other.serviceName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetAuthorizables()).compareTo(other.isSetAuthorizables());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAuthorizables()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizables, other.authorizables);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetAction()).compareTo(other.isSetAction());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAction()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.action, other.action);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetCreateTime()).compareTo(other.isSetCreateTime());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetCreateTime()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.createTime, other.createTime);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGrantorPrincipal()).compareTo(other.isSetGrantorPrincipal());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGrantorPrincipal()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.grantorPrincipal, other.grantorPrincipal);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGrantOption()).compareTo(other.isSetGrantOption());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGrantOption()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.grantOption, other.grantOption);
- 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("TSentryPrivilege(");
- boolean first = true;
-
- sb.append("component:");
- if (this.component == null) {
- sb.append("null");
- } else {
- sb.append(this.component);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("serviceName:");
- if (this.serviceName == null) {
- sb.append("null");
- } else {
- sb.append(this.serviceName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("authorizables:");
- if (this.authorizables == null) {
- sb.append("null");
- } else {
- sb.append(this.authorizables);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("action:");
- if (this.action == null) {
- sb.append("null");
- } else {
- sb.append(this.action);
- }
- first = false;
- if (isSetCreateTime()) {
- if (!first) sb.append(", ");
- sb.append("createTime:");
- sb.append(this.createTime);
- first = false;
- }
- if (isSetGrantorPrincipal()) {
- if (!first) sb.append(", ");
- sb.append("grantorPrincipal:");
- if (this.grantorPrincipal == null) {
- sb.append("null");
- } else {
- sb.append(this.grantorPrincipal);
- }
- first = false;
- }
- if (isSetGrantOption()) {
- if (!first) sb.append(", ");
- sb.append("grantOption:");
- if (this.grantOption == null) {
- sb.append("null");
- } else {
- sb.append(this.grantOption);
- }
- first = false;
- }
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetComponent()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
- }
-
- if (!isSetServiceName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'serviceName' is unset! Struct:" + toString());
- }
-
- if (!isSetAuthorizables()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'authorizables' is unset! Struct:" + toString());
- }
-
- if (!isSetAction()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'action' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TSentryPrivilegeStandardSchemeFactory implements SchemeFactory {
- public TSentryPrivilegeStandardScheme getScheme() {
- return new TSentryPrivilegeStandardScheme();
- }
- }
-
- private static class TSentryPrivilegeStandardScheme extends StandardScheme<TSentryPrivilege> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryPrivilege 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: // COMPONENT
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // SERVICE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.serviceName = iprot.readString();
- struct.setServiceNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // AUTHORIZABLES
- if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
- struct.authorizables = new ArrayList<TAuthorizable>(_list0.size);
- TAuthorizable _elem1;
- for (int _i2 = 0; _i2 < _list0.size; ++_i2)
- {
- _elem1 = new TAuthorizable();
- _elem1.read(iprot);
- struct.authorizables.add(_elem1);
- }
- iprot.readListEnd();
- }
- struct.setAuthorizablesIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // ACTION
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.action = iprot.readString();
- struct.setActionIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // CREATE_TIME
- if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
- struct.createTime = iprot.readI64();
- struct.setCreateTimeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 6: // GRANTOR_PRINCIPAL
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.grantorPrincipal = iprot.readString();
- struct.setGrantorPrincipalIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 7: // GRANT_OPTION
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.grantOption = org.apache.sentry.provider.db.generic.service.thrift.TSentryGrantOption.findByValue(iprot.readI32());
- struct.setGrantOptionIsSet(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, TSentryPrivilege struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.component != null) {
- oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
- oprot.writeString(struct.component);
- oprot.writeFieldEnd();
- }
- if (struct.serviceName != null) {
- oprot.writeFieldBegin(SERVICE_NAME_FIELD_DESC);
- oprot.writeString(struct.serviceName);
- oprot.writeFieldEnd();
- }
- if (struct.authorizables != null) {
- oprot.writeFieldBegin(AUTHORIZABLES_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.authorizables.size()));
- for (TAuthorizable _iter3 : struct.authorizables)
- {
- _iter3.write(oprot);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- if (struct.action != null) {
- oprot.writeFieldBegin(ACTION_FIELD_DESC);
- oprot.writeString(struct.action);
- oprot.writeFieldEnd();
- }
- if (struct.isSetCreateTime()) {
- oprot.writeFieldBegin(CREATE_TIME_FIELD_DESC);
- oprot.writeI64(struct.createTime);
- oprot.writeFieldEnd();
- }
- if (struct.grantorPrincipal != null) {
- if (struct.isSetGrantorPrincipal()) {
- oprot.writeFieldBegin(GRANTOR_PRINCIPAL_FIELD_DESC);
- oprot.writeString(struct.grantorPrincipal);
- oprot.writeFieldEnd();
- }
- }
- if (struct.grantOption != null) {
- if (struct.isSetGrantOption()) {
- oprot.writeFieldBegin(GRANT_OPTION_FIELD_DESC);
- oprot.writeI32(struct.grantOption.getValue());
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryPrivilegeTupleSchemeFactory implements SchemeFactory {
- public TSentryPrivilegeTupleScheme getScheme() {
- return new TSentryPrivilegeTupleScheme();
- }
- }
-
- private static class TSentryPrivilegeTupleScheme extends TupleScheme<TSentryPrivilege> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryPrivilege struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeString(struct.component);
- oprot.writeString(struct.serviceName);
- {
- oprot.writeI32(struct.authorizables.size());
- for (TAuthorizable _iter4 : struct.authorizables)
- {
- _iter4.write(oprot);
- }
- }
- oprot.writeString(struct.action);
- BitSet optionals = new BitSet();
- if (struct.isSetCreateTime()) {
- optionals.set(0);
- }
- if (struct.isSetGrantorPrincipal()) {
- optionals.set(1);
- }
- if (struct.isSetGrantOption()) {
- optionals.set(2);
- }
- oprot.writeBitSet(optionals, 3);
- if (struct.isSetCreateTime()) {
- oprot.writeI64(struct.createTime);
- }
- if (struct.isSetGrantorPrincipal()) {
- oprot.writeString(struct.grantorPrincipal);
- }
- if (struct.isSetGrantOption()) {
- oprot.writeI32(struct.grantOption.getValue());
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryPrivilege struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- struct.serviceName = iprot.readString();
- struct.setServiceNameIsSet(true);
- {
- org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.authorizables = new ArrayList<TAuthorizable>(_list5.size);
- TAuthorizable _elem6;
- for (int _i7 = 0; _i7 < _list5.size; ++_i7)
- {
- _elem6 = new TAuthorizable();
- _elem6.read(iprot);
- struct.authorizables.add(_elem6);
- }
- }
- struct.setAuthorizablesIsSet(true);
- struct.action = iprot.readString();
- struct.setActionIsSet(true);
- BitSet incoming = iprot.readBitSet(3);
- if (incoming.get(0)) {
- struct.createTime = iprot.readI64();
- struct.setCreateTimeIsSet(true);
- }
- if (incoming.get(1)) {
- struct.grantorPrincipal = iprot.readString();
- struct.setGrantorPrincipalIsSet(true);
- }
- if (incoming.get(2)) {
- struct.grantOption = org.apache.sentry.provider.db.generic.service.thrift.TSentryGrantOption.findByValue(iprot.readI32());
- struct.setGrantOptionIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryPrivilegeMap.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryPrivilegeMap.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryPrivilegeMap.java
deleted file mode 100644
index 951fdae..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryPrivilegeMap.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/**
- * 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.provider.db.generic.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 TSentryPrivilegeMap implements org.apache.thrift.TBase<TSentryPrivilegeMap, TSentryPrivilegeMap._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryPrivilegeMap> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryPrivilegeMap");
-
- private static final org.apache.thrift.protocol.TField PRIVILEGE_MAP_FIELD_DESC = new org.apache.thrift.protocol.TField("privilegeMap", org.apache.thrift.protocol.TType.MAP, (short)1);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryPrivilegeMapStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryPrivilegeMapTupleSchemeFactory());
- }
-
- private Map<String,Set<TSentryPrivilege>> privilegeMap; // 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 {
- PRIVILEGE_MAP((short)1, "privilegeMap");
-
- 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: // PRIVILEGE_MAP
- return PRIVILEGE_MAP;
- 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.PRIVILEGE_MAP, new org.apache.thrift.meta_data.FieldMetaData("privilegeMap", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class)))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryPrivilegeMap.class, metaDataMap);
- }
-
- public TSentryPrivilegeMap() {
- }
-
- public TSentryPrivilegeMap(
- Map<String,Set<TSentryPrivilege>> privilegeMap)
- {
- this();
- this.privilegeMap = privilegeMap;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryPrivilegeMap(TSentryPrivilegeMap other) {
- if (other.isSetPrivilegeMap()) {
- Map<String,Set<TSentryPrivilege>> __this__privilegeMap = new HashMap<String,Set<TSentryPrivilege>>(other.privilegeMap.size());
- for (Map.Entry<String, Set<TSentryPrivilege>> other_element : other.privilegeMap.entrySet()) {
-
- String other_element_key = other_element.getKey();
- Set<TSentryPrivilege> other_element_value = other_element.getValue();
-
- String __this__privilegeMap_copy_key = other_element_key;
-
- Set<TSentryPrivilege> __this__privilegeMap_copy_value = new HashSet<TSentryPrivilege>(other_element_value.size());
- for (TSentryPrivilege other_element_value_element : other_element_value) {
- __this__privilegeMap_copy_value.add(new TSentryPrivilege(other_element_value_element));
- }
-
- __this__privilegeMap.put(__this__privilegeMap_copy_key, __this__privilegeMap_copy_value);
- }
- this.privilegeMap = __this__privilegeMap;
- }
- }
-
- public TSentryPrivilegeMap deepCopy() {
- return new TSentryPrivilegeMap(this);
- }
-
- @Override
- public void clear() {
- this.privilegeMap = null;
- }
-
- public int getPrivilegeMapSize() {
- return (this.privilegeMap == null) ? 0 : this.privilegeMap.size();
- }
-
- public void putToPrivilegeMap(String key, Set<TSentryPrivilege> val) {
- if (this.privilegeMap == null) {
- this.privilegeMap = new HashMap<String,Set<TSentryPrivilege>>();
- }
- this.privilegeMap.put(key, val);
- }
-
- public Map<String,Set<TSentryPrivilege>> getPrivilegeMap() {
- return this.privilegeMap;
- }
-
- public void setPrivilegeMap(Map<String,Set<TSentryPrivilege>> privilegeMap) {
- this.privilegeMap = privilegeMap;
- }
-
- public void unsetPrivilegeMap() {
- this.privilegeMap = null;
- }
-
- /** Returns true if field privilegeMap is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivilegeMap() {
- return this.privilegeMap != null;
- }
-
- public void setPrivilegeMapIsSet(boolean value) {
- if (!value) {
- this.privilegeMap = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case PRIVILEGE_MAP:
- if (value == null) {
- unsetPrivilegeMap();
- } else {
- setPrivilegeMap((Map<String,Set<TSentryPrivilege>>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PRIVILEGE_MAP:
- return getPrivilegeMap();
-
- }
- 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 PRIVILEGE_MAP:
- return isSetPrivilegeMap();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryPrivilegeMap)
- return this.equals((TSentryPrivilegeMap)that);
- return false;
- }
-
- public boolean equals(TSentryPrivilegeMap that) {
- if (that == null)
- return false;
-
- boolean this_present_privilegeMap = true && this.isSetPrivilegeMap();
- boolean that_present_privilegeMap = true && that.isSetPrivilegeMap();
- if (this_present_privilegeMap || that_present_privilegeMap) {
- if (!(this_present_privilegeMap && that_present_privilegeMap))
- return false;
- if (!this.privilegeMap.equals(that.privilegeMap))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List<Object> list = new ArrayList<Object>();
-
- boolean present_privilegeMap = true && (isSetPrivilegeMap());
- list.add(present_privilegeMap);
- if (present_privilegeMap)
- list.add(privilegeMap);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryPrivilegeMap other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetPrivilegeMap()).compareTo(other.isSetPrivilegeMap());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivilegeMap()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilegeMap, other.privilegeMap);
- 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("TSentryPrivilegeMap(");
- boolean first = true;
-
- sb.append("privilegeMap:");
- if (this.privilegeMap == null) {
- sb.append("null");
- } else {
- sb.append(this.privilegeMap);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetPrivilegeMap()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilegeMap' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TSentryPrivilegeMapStandardSchemeFactory implements SchemeFactory {
- public TSentryPrivilegeMapStandardScheme getScheme() {
- return new TSentryPrivilegeMapStandardScheme();
- }
- }
-
- private static class TSentryPrivilegeMapStandardScheme extends StandardScheme<TSentryPrivilegeMap> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryPrivilegeMap 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: // PRIVILEGE_MAP
- if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
- {
- org.apache.thrift.protocol.TMap _map104 = iprot.readMapBegin();
- struct.privilegeMap = new HashMap<String,Set<TSentryPrivilege>>(2*_map104.size);
- String _key105;
- Set<TSentryPrivilege> _val106;
- for (int _i107 = 0; _i107 < _map104.size; ++_i107)
- {
- _key105 = iprot.readString();
- {
- org.apache.thrift.protocol.TSet _set108 = iprot.readSetBegin();
- _val106 = new HashSet<TSentryPrivilege>(2*_set108.size);
- TSentryPrivilege _elem109;
- for (int _i110 = 0; _i110 < _set108.size; ++_i110)
- {
- _elem109 = new TSentryPrivilege();
- _elem109.read(iprot);
- _val106.add(_elem109);
- }
- iprot.readSetEnd();
- }
- struct.privilegeMap.put(_key105, _val106);
- }
- iprot.readMapEnd();
- }
- struct.setPrivilegeMapIsSet(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, TSentryPrivilegeMap struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.privilegeMap != null) {
- oprot.writeFieldBegin(PRIVILEGE_MAP_FIELD_DESC);
- {
- oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.SET, struct.privilegeMap.size()));
- for (Map.Entry<String, Set<TSentryPrivilege>> _iter111 : struct.privilegeMap.entrySet())
- {
- oprot.writeString(_iter111.getKey());
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, _iter111.getValue().size()));
- for (TSentryPrivilege _iter112 : _iter111.getValue())
- {
- _iter112.write(oprot);
- }
- oprot.writeSetEnd();
- }
- }
- oprot.writeMapEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryPrivilegeMapTupleSchemeFactory implements SchemeFactory {
- public TSentryPrivilegeMapTupleScheme getScheme() {
- return new TSentryPrivilegeMapTupleScheme();
- }
- }
-
- private static class TSentryPrivilegeMapTupleScheme extends TupleScheme<TSentryPrivilegeMap> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryPrivilegeMap struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- {
- oprot.writeI32(struct.privilegeMap.size());
- for (Map.Entry<String, Set<TSentryPrivilege>> _iter113 : struct.privilegeMap.entrySet())
- {
- oprot.writeString(_iter113.getKey());
- {
- oprot.writeI32(_iter113.getValue().size());
- for (TSentryPrivilege _iter114 : _iter113.getValue())
- {
- _iter114.write(oprot);
- }
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryPrivilegeMap struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- {
- org.apache.thrift.protocol.TMap _map115 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.SET, iprot.readI32());
- struct.privilegeMap = new HashMap<String,Set<TSentryPrivilege>>(2*_map115.size);
- String _key116;
- Set<TSentryPrivilege> _val117;
- for (int _i118 = 0; _i118 < _map115.size; ++_i118)
- {
- _key116 = iprot.readString();
- {
- org.apache.thrift.protocol.TSet _set119 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- _val117 = new HashSet<TSentryPrivilege>(2*_set119.size);
- TSentryPrivilege _elem120;
- for (int _i121 = 0; _i121 < _set119.size; ++_i121)
- {
- _elem120 = new TSentryPrivilege();
- _elem120.read(iprot);
- _val117.add(_elem120);
- }
- }
- struct.privilegeMap.put(_key116, _val117);
- }
- }
- struct.setPrivilegeMapIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryRole.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryRole.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryRole.java
deleted file mode 100644
index 18d82a2..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TSentryRole.java
+++ /dev/null
@@ -1,539 +0,0 @@
-/**
- * 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.provider.db.generic.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 TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentryRole._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryRole> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryRole");
-
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryRoleStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryRoleTupleSchemeFactory());
- }
-
- private String roleName; // required
- private Set<String> groups; // 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 {
- ROLE_NAME((short)1, "roleName"),
- GROUPS((short)2, "groups");
-
- 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: // ROLE_NAME
- return ROLE_NAME;
- case 2: // GROUPS
- return GROUPS;
- 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.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryRole.class, metaDataMap);
- }
-
- public TSentryRole() {
- }
-
- public TSentryRole(
- String roleName,
- Set<String> groups)
- {
- this();
- this.roleName = roleName;
- this.groups = groups;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryRole(TSentryRole other) {
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetGroups()) {
- Set<String> __this__groups = new HashSet<String>(other.groups);
- this.groups = __this__groups;
- }
- }
-
- public TSentryRole deepCopy() {
- return new TSentryRole(this);
- }
-
- @Override
- public void clear() {
- this.roleName = null;
- this.groups = null;
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public int getGroupsSize() {
- return (this.groups == null) ? 0 : this.groups.size();
- }
-
- public java.util.Iterator<String> getGroupsIterator() {
- return (this.groups == null) ? null : this.groups.iterator();
- }
-
- public void addToGroups(String elem) {
- if (this.groups == null) {
- this.groups = new HashSet<String>();
- }
- this.groups.add(elem);
- }
-
- public Set<String> getGroups() {
- return this.groups;
- }
-
- public void setGroups(Set<String> groups) {
- this.groups = groups;
- }
-
- public void unsetGroups() {
- this.groups = null;
- }
-
- /** Returns true if field groups is set (has been assigned a value) and false otherwise */
- public boolean isSetGroups() {
- return this.groups != null;
- }
-
- public void setGroupsIsSet(boolean value) {
- if (!value) {
- this.groups = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case GROUPS:
- if (value == null) {
- unsetGroups();
- } else {
- setGroups((Set<String>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case ROLE_NAME:
- return getRoleName();
-
- case GROUPS:
- return getGroups();
-
- }
- 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 ROLE_NAME:
- return isSetRoleName();
- case GROUPS:
- return isSetGroups();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryRole)
- return this.equals((TSentryRole)that);
- return false;
- }
-
- public boolean equals(TSentryRole that) {
- if (that == null)
- return false;
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- boolean this_present_groups = true && this.isSetGroups();
- boolean that_present_groups = true && that.isSetGroups();
- if (this_present_groups || that_present_groups) {
- if (!(this_present_groups && that_present_groups))
- return false;
- if (!this.groups.equals(that.groups))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List<Object> list = new ArrayList<Object>();
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- boolean present_groups = true && (isSetGroups());
- list.add(present_groups);
- if (present_groups)
- list.add(groups);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryRole other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGroups()).compareTo(other.isSetGroups());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroups()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, other.groups);
- 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("TSentryRole(");
- boolean first = true;
-
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("groups:");
- if (this.groups == null) {
- sb.append("null");
- } else {
- sb.append(this.groups);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- if (!isSetGroups()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'groups' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TSentryRoleStandardSchemeFactory implements SchemeFactory {
- public TSentryRoleStandardScheme getScheme() {
- return new TSentryRoleStandardScheme();
- }
- }
-
- private static class TSentryRoleStandardScheme extends StandardScheme<TSentryRole> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryRole 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: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // GROUPS
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set24 = iprot.readSetBegin();
- struct.groups = new HashSet<String>(2*_set24.size);
- String _elem25;
- for (int _i26 = 0; _i26 < _set24.size; ++_i26)
- {
- _elem25 = iprot.readString();
- struct.groups.add(_elem25);
- }
- iprot.readSetEnd();
- }
- struct.setGroupsIsSet(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, TSentryRole struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.groups != null) {
- oprot.writeFieldBegin(GROUPS_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.groups.size()));
- for (String _iter27 : struct.groups)
- {
- oprot.writeString(_iter27);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryRoleTupleSchemeFactory implements SchemeFactory {
- public TSentryRoleTupleScheme getScheme() {
- return new TSentryRoleTupleScheme();
- }
- }
-
- private static class TSentryRoleTupleScheme extends TupleScheme<TSentryRole> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryRole struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeString(struct.roleName);
- {
- oprot.writeI32(struct.groups.size());
- for (String _iter28 : struct.groups)
- {
- oprot.writeString(_iter28);
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryRole struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set29 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.groups = new HashSet<String>(2*_set29.size);
- String _elem30;
- for (int _i31 = 0; _i31 < _set29.size; ++_i31)
- {
- _elem30 = iprot.readString();
- struct.groups.add(_elem30);
- }
- }
- struct.setGroupsIsSet(true);
- }
- }
-
-}
-
[37/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java
deleted file mode 100644
index c1ba7e9..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java
+++ /dev/null
@@ -1,746 +0,0 @@
-/**
- * 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.provider.db.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 TAlterSentryRoleDeleteGroupsRequest implements org.apache.thrift.TBase<TAlterSentryRoleDeleteGroupsRequest, TAlterSentryRoleDeleteGroupsRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleDeleteGroupsRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleDeleteGroupsRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)5);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleDeleteGroupsRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleDeleteGroupsRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private Set<TSentryGroup> groups; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName"),
- GROUPS((short)5, "groups");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- case 5: // GROUPS
- return GROUPS;
- 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryGroup.class))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleDeleteGroupsRequest.class, metaDataMap);
- }
-
- public TAlterSentryRoleDeleteGroupsRequest() {
- this.protocol_version = 2;
-
- }
-
- public TAlterSentryRoleDeleteGroupsRequest(
- int protocol_version,
- String requestorUserName,
- String roleName,
- Set<TSentryGroup> groups)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- this.groups = groups;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleDeleteGroupsRequest(TAlterSentryRoleDeleteGroupsRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetGroups()) {
- Set<TSentryGroup> __this__groups = new HashSet<TSentryGroup>(other.groups.size());
- for (TSentryGroup other_element : other.groups) {
- __this__groups.add(new TSentryGroup(other_element));
- }
- this.groups = __this__groups;
- }
- }
-
- public TAlterSentryRoleDeleteGroupsRequest deepCopy() {
- return new TAlterSentryRoleDeleteGroupsRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.groups = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public int getGroupsSize() {
- return (this.groups == null) ? 0 : this.groups.size();
- }
-
- public java.util.Iterator<TSentryGroup> getGroupsIterator() {
- return (this.groups == null) ? null : this.groups.iterator();
- }
-
- public void addToGroups(TSentryGroup elem) {
- if (this.groups == null) {
- this.groups = new HashSet<TSentryGroup>();
- }
- this.groups.add(elem);
- }
-
- public Set<TSentryGroup> getGroups() {
- return this.groups;
- }
-
- public void setGroups(Set<TSentryGroup> groups) {
- this.groups = groups;
- }
-
- public void unsetGroups() {
- this.groups = null;
- }
-
- /** Returns true if field groups is set (has been assigned a value) and false otherwise */
- public boolean isSetGroups() {
- return this.groups != null;
- }
-
- public void setGroupsIsSet(boolean value) {
- if (!value) {
- this.groups = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case GROUPS:
- if (value == null) {
- unsetGroups();
- } else {
- setGroups((Set<TSentryGroup>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case GROUPS:
- return getGroups();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case GROUPS:
- return isSetGroups();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleDeleteGroupsRequest)
- return this.equals((TAlterSentryRoleDeleteGroupsRequest)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleDeleteGroupsRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- boolean this_present_groups = true && this.isSetGroups();
- boolean that_present_groups = true && that.isSetGroups();
- if (this_present_groups || that_present_groups) {
- if (!(this_present_groups && that_present_groups))
- return false;
- if (!this.groups.equals(that.groups))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- boolean present_groups = true && (isSetGroups());
- list.add(present_groups);
- if (present_groups)
- list.add(groups);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleDeleteGroupsRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGroups()).compareTo(other.isSetGroups());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroups()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, other.groups);
- 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("TAlterSentryRoleDeleteGroupsRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("groups:");
- if (this.groups == null) {
- sb.append("null");
- } else {
- sb.append(this.groups);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- if (!isSetGroups()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'groups' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TAlterSentryRoleDeleteGroupsRequestStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleDeleteGroupsRequestStandardScheme getScheme() {
- return new TAlterSentryRoleDeleteGroupsRequestStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleDeleteGroupsRequestStandardScheme extends StandardScheme<TAlterSentryRoleDeleteGroupsRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleDeleteGroupsRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // GROUPS
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set16 = iprot.readSetBegin();
- struct.groups = new HashSet<TSentryGroup>(2*_set16.size);
- TSentryGroup _elem17;
- for (int _i18 = 0; _i18 < _set16.size; ++_i18)
- {
- _elem17 = new TSentryGroup();
- _elem17.read(iprot);
- struct.groups.add(_elem17);
- }
- iprot.readSetEnd();
- }
- struct.setGroupsIsSet(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, TAlterSentryRoleDeleteGroupsRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.groups != null) {
- oprot.writeFieldBegin(GROUPS_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.groups.size()));
- for (TSentryGroup _iter19 : struct.groups)
- {
- _iter19.write(oprot);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleDeleteGroupsRequestTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleDeleteGroupsRequestTupleScheme getScheme() {
- return new TAlterSentryRoleDeleteGroupsRequestTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleDeleteGroupsRequestTupleScheme extends TupleScheme<TAlterSentryRoleDeleteGroupsRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- {
- oprot.writeI32(struct.groups.size());
- for (TSentryGroup _iter20 : struct.groups)
- {
- _iter20.write(oprot);
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set21 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.groups = new HashSet<TSentryGroup>(2*_set21.size);
- TSentryGroup _elem22;
- for (int _i23 = 0; _i23 < _set21.size; ++_i23)
- {
- _elem22 = new TSentryGroup();
- _elem22.read(iprot);
- struct.groups.add(_elem22);
- }
- }
- struct.setGroupsIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsResponse.java
deleted file mode 100644
index 7f47dd4..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsResponse.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/**
- * 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.provider.db.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 TAlterSentryRoleDeleteGroupsResponse implements org.apache.thrift.TBase<TAlterSentryRoleDeleteGroupsResponse, TAlterSentryRoleDeleteGroupsResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleDeleteGroupsResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleDeleteGroupsResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleDeleteGroupsResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleDeleteGroupsResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.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)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleDeleteGroupsResponse.class, metaDataMap);
- }
-
- public TAlterSentryRoleDeleteGroupsResponse() {
- }
-
- public TAlterSentryRoleDeleteGroupsResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleDeleteGroupsResponse(TAlterSentryRoleDeleteGroupsResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- }
-
- public TAlterSentryRoleDeleteGroupsResponse deepCopy() {
- return new TAlterSentryRoleDeleteGroupsResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleDeleteGroupsResponse)
- return this.equals((TAlterSentryRoleDeleteGroupsResponse)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleDeleteGroupsResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleDeleteGroupsResponse 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;
- }
- }
- 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("TAlterSentryRoleDeleteGroupsResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // 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 {
- 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 TAlterSentryRoleDeleteGroupsResponseStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleDeleteGroupsResponseStandardScheme getScheme() {
- return new TAlterSentryRoleDeleteGroupsResponseStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleDeleteGroupsResponseStandardScheme extends StandardScheme<TAlterSentryRoleDeleteGroupsResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleDeleteGroupsResponse 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;
- 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, TAlterSentryRoleDeleteGroupsResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleDeleteGroupsResponseTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleDeleteGroupsResponseTupleScheme getScheme() {
- return new TAlterSentryRoleDeleteGroupsResponseTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleDeleteGroupsResponseTupleScheme extends TupleScheme<TAlterSentryRoleDeleteGroupsResponse> {
-
- @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 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);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteUsersRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteUsersRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteUsersRequest.java
deleted file mode 100644
index a3a9e20..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteUsersRequest.java
+++ /dev/null
@@ -1,741 +0,0 @@
-/**
- * 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.provider.db.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 TAlterSentryRoleDeleteUsersRequest implements org.apache.thrift.TBase<TAlterSentryRoleDeleteUsersRequest, TAlterSentryRoleDeleteUsersRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleDeleteUsersRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleDeleteUsersRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField USERS_FIELD_DESC = new org.apache.thrift.protocol.TField("users", org.apache.thrift.protocol.TType.SET, (short)4);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleDeleteUsersRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleDeleteUsersRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private Set<String> users; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName"),
- USERS((short)4, "users");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- case 4: // USERS
- return USERS;
- 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.USERS, new org.apache.thrift.meta_data.FieldMetaData("users", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleDeleteUsersRequest.class, metaDataMap);
- }
-
- public TAlterSentryRoleDeleteUsersRequest() {
- this.protocol_version = 1;
-
- }
-
- public TAlterSentryRoleDeleteUsersRequest(
- int protocol_version,
- String requestorUserName,
- String roleName,
- Set<String> users)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- this.users = users;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleDeleteUsersRequest(TAlterSentryRoleDeleteUsersRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetUsers()) {
- Set<String> __this__users = new HashSet<String>(other.users);
- this.users = __this__users;
- }
- }
-
- public TAlterSentryRoleDeleteUsersRequest deepCopy() {
- return new TAlterSentryRoleDeleteUsersRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 1;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.users = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public int getUsersSize() {
- return (this.users == null) ? 0 : this.users.size();
- }
-
- public java.util.Iterator<String> getUsersIterator() {
- return (this.users == null) ? null : this.users.iterator();
- }
-
- public void addToUsers(String elem) {
- if (this.users == null) {
- this.users = new HashSet<String>();
- }
- this.users.add(elem);
- }
-
- public Set<String> getUsers() {
- return this.users;
- }
-
- public void setUsers(Set<String> users) {
- this.users = users;
- }
-
- public void unsetUsers() {
- this.users = null;
- }
-
- /** Returns true if field users is set (has been assigned a value) and false otherwise */
- public boolean isSetUsers() {
- return this.users != null;
- }
-
- public void setUsersIsSet(boolean value) {
- if (!value) {
- this.users = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case USERS:
- if (value == null) {
- unsetUsers();
- } else {
- setUsers((Set<String>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case USERS:
- return getUsers();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case USERS:
- return isSetUsers();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleDeleteUsersRequest)
- return this.equals((TAlterSentryRoleDeleteUsersRequest)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleDeleteUsersRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- boolean this_present_users = true && this.isSetUsers();
- boolean that_present_users = true && that.isSetUsers();
- if (this_present_users || that_present_users) {
- if (!(this_present_users && that_present_users))
- return false;
- if (!this.users.equals(that.users))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- boolean present_users = true && (isSetUsers());
- list.add(present_users);
- if (present_users)
- list.add(users);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleDeleteUsersRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetUsers()).compareTo(other.isSetUsers());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetUsers()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.users, other.users);
- 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("TAlterSentryRoleDeleteUsersRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("users:");
- if (this.users == null) {
- sb.append("null");
- } else {
- sb.append(this.users);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- if (!isSetUsers()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'users' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TAlterSentryRoleDeleteUsersRequestStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleDeleteUsersRequestStandardScheme getScheme() {
- return new TAlterSentryRoleDeleteUsersRequestStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleDeleteUsersRequestStandardScheme extends StandardScheme<TAlterSentryRoleDeleteUsersRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleDeleteUsersRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // USERS
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set24 = iprot.readSetBegin();
- struct.users = new HashSet<String>(2*_set24.size);
- String _elem25;
- for (int _i26 = 0; _i26 < _set24.size; ++_i26)
- {
- _elem25 = iprot.readString();
- struct.users.add(_elem25);
- }
- iprot.readSetEnd();
- }
- struct.setUsersIsSet(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, TAlterSentryRoleDeleteUsersRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.users != null) {
- oprot.writeFieldBegin(USERS_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.users.size()));
- for (String _iter27 : struct.users)
- {
- oprot.writeString(_iter27);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleDeleteUsersRequestTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleDeleteUsersRequestTupleScheme getScheme() {
- return new TAlterSentryRoleDeleteUsersRequestTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleDeleteUsersRequestTupleScheme extends TupleScheme<TAlterSentryRoleDeleteUsersRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteUsersRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- {
- oprot.writeI32(struct.users.size());
- for (String _iter28 : struct.users)
- {
- oprot.writeString(_iter28);
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteUsersRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set29 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.users = new HashSet<String>(2*_set29.size);
- String _elem30;
- for (int _i31 = 0; _i31 < _set29.size; ++_i31)
- {
- _elem30 = iprot.readString();
- struct.users.add(_elem30);
- }
- }
- struct.setUsersIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteUsersResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteUsersResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteUsersResponse.java
deleted file mode 100644
index e4d7684..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteUsersResponse.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/**
- * 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.provider.db.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 TAlterSentryRoleDeleteUsersResponse implements org.apache.thrift.TBase<TAlterSentryRoleDeleteUsersResponse, TAlterSentryRoleDeleteUsersResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleDeleteUsersResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleDeleteUsersResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleDeleteUsersResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleDeleteUsersResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.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)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleDeleteUsersResponse.class, metaDataMap);
- }
-
- public TAlterSentryRoleDeleteUsersResponse() {
- }
-
- public TAlterSentryRoleDeleteUsersResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleDeleteUsersResponse(TAlterSentryRoleDeleteUsersResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- }
-
- public TAlterSentryRoleDeleteUsersResponse deepCopy() {
- return new TAlterSentryRoleDeleteUsersResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleDeleteUsersResponse)
- return this.equals((TAlterSentryRoleDeleteUsersResponse)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleDeleteUsersResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleDeleteUsersResponse 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;
- }
- }
- 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("TAlterSentryRoleDeleteUsersResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // 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 {
- 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 TAlterSentryRoleDeleteUsersResponseStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleDeleteUsersResponseStandardScheme getScheme() {
- return new TAlterSentryRoleDeleteUsersResponseStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleDeleteUsersResponseStandardScheme extends StandardScheme<TAlterSentryRoleDeleteUsersResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleDeleteUsersResponse 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;
- 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, TAlterSentryRoleDeleteUsersResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleDeleteUsersResponseTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleDeleteUsersResponseTupleScheme getScheme() {
- return new TAlterSentryRoleDeleteUsersResponseTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleDeleteUsersResponseTupleScheme extends TupleScheme<TAlterSentryRoleDeleteUsersResponse> {
-
- @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 read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteUsersResponse 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);
- }
- }
-
-}
-
[23/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericServiceClientDefaultImpl.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericServiceClientDefaultImpl.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericServiceClientDefaultImpl.java
deleted file mode 100644
index 4cd8fd6..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericServiceClientDefaultImpl.java
+++ /dev/null
@@ -1,559 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.generic.service.thrift;
-
-import com.google.common.collect.Lists;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.sentry.core.common.ActiveRoleSet;
-import org.apache.sentry.core.common.Authorizable;
-import org.apache.sentry.core.common.exception.SentryUserException;
-import org.apache.sentry.core.common.transport.SentryConnection;
-import org.apache.sentry.core.common.transport.SentryTransportPool;
-import org.apache.sentry.core.common.transport.TTransportWrapper;
-import org.apache.sentry.core.model.db.AccessConstants;
-import org.apache.sentry.provider.db.generic.service.thrift.SentryGenericPolicyService.Client;
-import org.apache.sentry.service.thrift.ServiceConstants.ClientConfig;
-import org.apache.sentry.service.thrift.Status;
-import org.apache.sentry.service.thrift.sentry_common_serviceConstants;
-import org.apache.thrift.TException;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.protocol.TMultiplexedProtocol;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-
-/**
- * Sentry Generic Service Client.
- * <p>
- * Thread safety. This class is not thread safe - it is up to the
- * caller to ensure thread safety.
- */
-public class SentryGenericServiceClientDefaultImpl
- implements SentryGenericServiceClient, SentryConnection {
-
- private Client client;
- private final SentryTransportPool transportPool;
- private TTransportWrapper transport;
- private static final String THRIFT_EXCEPTION_MESSAGE = "Thrift exception occured ";
- private final long maxMessageSize;
-
- /**
- * Initialize client with the given configuration, using specified transport pool
- * implementation for obtaining transports.
- * @param conf Sentry Configuration
- * @param transportPool source of connected transports
- */
- SentryGenericServiceClientDefaultImpl(Configuration conf,
- SentryTransportPool transportPool) {
-
- //TODO(kalyan) need to find appropriate place to add it
- // if (kerberos) {
- // // since the client uses hadoop-auth, we need to set kerberos in
- // // hadoop-auth if we plan to use kerberos
- // conf.set(HADOOP_SECURITY_AUTHENTICATION, SentryConstants.KERBEROS_MoODE);
- // }
- maxMessageSize = conf.getLong(ClientConfig.SENTRY_POLICY_CLIENT_THRIFT_MAX_MESSAGE_SIZE,
- ClientConfig.SENTRY_POLICY_CLIENT_THRIFT_MAX_MESSAGE_SIZE_DEFAULT);
- this.transportPool = transportPool;
- }
-
- /**
- * Connect to the specified server configured
- *
- * @throws IOException
- */
- @Override
- public void connect() throws Exception {
- if ((transport != null) && transport.isOpen()) {
- return;
- }
-
- // Obtain connection to Sentry server
- transport = transportPool.getTransport();
- TMultiplexedProtocol protocol = new TMultiplexedProtocol(
- new TBinaryProtocol(transport.getTTransport(), maxMessageSize,
- maxMessageSize, true, true),
- SentryGenericPolicyProcessor.SENTRY_GENERIC_SERVICE_NAME);
- client = new Client(protocol);
- }
-
- /**
- * Create a sentry role
- *
- * @param requestorUserName: user on whose behalf the request is issued
- * @param roleName: Name of the role
- * @param component: The request is issued to which component
- * @throws SentryUserException
- */
- @Override
- public void createRole(String requestorUserName, String roleName, String component)
- throws SentryUserException {
- TCreateSentryRoleRequest request = new TCreateSentryRoleRequest();
- request.setProtocol_version(sentry_common_serviceConstants.TSENTRY_SERVICE_V2);
- request.setRequestorUserName(requestorUserName);
- request.setRoleName(roleName);
- request.setComponent(component);
- try {
- TCreateSentryRoleResponse response = client.create_sentry_role(request);
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- @Override
- public void createRoleIfNotExist(String requestorUserName, String roleName, String component) throws SentryUserException {
- TCreateSentryRoleRequest request = new TCreateSentryRoleRequest();
- request.setProtocol_version(sentry_common_serviceConstants.TSENTRY_SERVICE_V2);
- request.setRequestorUserName(requestorUserName);
- request.setRoleName(roleName);
- request.setComponent(component);
- try {
- TCreateSentryRoleResponse response = client.create_sentry_role(request);
- Status status = Status.fromCode(response.getStatus().getValue());
- if (status == Status.ALREADY_EXISTS) {
- return;
- }
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- /**
- * Drop a sentry role
- *
- * @param requestorUserName: user on whose behalf the request is issued
- * @param roleName: Name of the role
- * @param component: The request is issued to which component
- * @throws SentryUserException
- */
- @Override
- public void dropRole(String requestorUserName,
- String roleName, String component)
- throws SentryUserException {
- dropRole(requestorUserName, roleName, component, false);
- }
-
- @Override
- public void dropRoleIfExists(String requestorUserName,
- String roleName, String component)
- throws SentryUserException {
- dropRole(requestorUserName, roleName, component, true);
- }
-
- private void dropRole(String requestorUserName,
- String roleName, String component, boolean ifExists)
- throws SentryUserException {
- TDropSentryRoleRequest request = new TDropSentryRoleRequest();
- request.setProtocol_version(sentry_common_serviceConstants.TSENTRY_SERVICE_V2);
- request.setRequestorUserName(requestorUserName);
- request.setRoleName(roleName);
- request.setComponent(component);
- try {
- TDropSentryRoleResponse response = client.drop_sentry_role(request);
- Status status = Status.fromCode(response.getStatus().getValue());
- if (ifExists && status == Status.NO_SUCH_OBJECT) {
- return;
- }
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- /**
- * Grant a sentry role to groups.
- *
- * @param requestorUserName: user on whose behalf the request is issued
- * @param roleName: Name of the role
- * @param component: The request is issued to which component
- * @param groups: The name of groups
- * @throws SentryUserException
- */
- @Override
- public void grantRoleToGroups(String requestorUserName, String roleName,
- String component, Set<String> groups) throws SentryUserException {
- TAlterSentryRoleAddGroupsRequest request = new TAlterSentryRoleAddGroupsRequest();
- request.setProtocol_version(sentry_common_serviceConstants.TSENTRY_SERVICE_V2);
- request.setRequestorUserName(requestorUserName);
- request.setRoleName(roleName);
- request.setGroups(groups);
- request.setComponent(component);
-
- try {
- TAlterSentryRoleAddGroupsResponse response = client.alter_sentry_role_add_groups(request);
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- /**
- * revoke a sentry role from groups.
- *
- * @param requestorUserName: user on whose behalf the request is issued
- * @param roleName: Name of the role
- * @param component: The request is issued to which component
- * @param groups: The name of groups
- * @throws SentryUserException
- */
- @Override
- public void revokeRoleFromGroups(String requestorUserName, String roleName,
- String component, Set<String> groups) throws SentryUserException {
- TAlterSentryRoleDeleteGroupsRequest request = new TAlterSentryRoleDeleteGroupsRequest();
- request.setProtocol_version(sentry_common_serviceConstants.TSENTRY_SERVICE_V2);
- request.setRequestorUserName(requestorUserName);
- request.setRoleName(roleName);
- request.setGroups(groups);
- request.setComponent(component);
-
- try {
- TAlterSentryRoleDeleteGroupsResponse response = client.alter_sentry_role_delete_groups(request);
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- /**
- * grant privilege
- *
- * @param requestorUserName: user on whose behalf the request is issued
- * @param roleName: Name of the role
- * @param component: The request is issued to which component
- * @param privilege
- * @throws SentryUserException
- */
- @Override
- public void grantPrivilege(String requestorUserName, String roleName,
- String component, TSentryPrivilege privilege) throws SentryUserException {
- TAlterSentryRoleGrantPrivilegeRequest request = new TAlterSentryRoleGrantPrivilegeRequest();
- request.setProtocol_version(sentry_common_serviceConstants.TSENTRY_SERVICE_V2);
- request.setComponent(component);
- request.setRoleName(roleName);
- request.setRequestorUserName(requestorUserName);
- request.setPrivilege(privilege);
-
- try {
- TAlterSentryRoleGrantPrivilegeResponse response = client.alter_sentry_role_grant_privilege(request);
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- /**
- * revoke privilege
- *
- * @param requestorUserName: user on whose behalf the request is issued
- * @param roleName: Name of the role
- * @param component: The request is issued to which component
- * @param privilege
- * @throws SentryUserException
- */
- @Override
- public void revokePrivilege(String requestorUserName, String roleName,
- String component, TSentryPrivilege privilege) throws SentryUserException {
- TAlterSentryRoleRevokePrivilegeRequest request = new TAlterSentryRoleRevokePrivilegeRequest();
- request.setProtocol_version(sentry_common_serviceConstants.TSENTRY_SERVICE_V2);
- request.setComponent(component);
- request.setRequestorUserName(requestorUserName);
- request.setRoleName(roleName);
- request.setPrivilege(privilege);
-
- try {
- TAlterSentryRoleRevokePrivilegeResponse response = client.alter_sentry_role_revoke_privilege(request);
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- /**
- * drop privilege
- *
- * @param requestorUserName: user on whose behalf the request is issued
- * @param component: The request is issued to which component
- * @param privilege
- * @throws SentryUserException
- */
- @Override
- public void dropPrivilege(String requestorUserName, String component,
- TSentryPrivilege privilege) throws SentryUserException {
- TDropPrivilegesRequest request = new TDropPrivilegesRequest();
- request.setProtocol_version(sentry_common_serviceConstants.TSENTRY_SERVICE_V2);
- request.setComponent(component);
- request.setRequestorUserName(requestorUserName);
- request.setPrivilege(privilege);
-
- try {
- TDropPrivilegesResponse response = client.drop_sentry_privilege(request);
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- /**
- * rename privilege
- *
- * @param requestorUserName: user on whose behalf the request is issued
- * @param component: The request is issued to which component
- * @param serviceName: The Authorizable belongs to which service
- * @param oldAuthorizables
- * @param newAuthorizables
- * @throws SentryUserException
- */
- @Override
- public void renamePrivilege(String requestorUserName, String component,
- String serviceName, List<? extends Authorizable> oldAuthorizables,
- List<? extends Authorizable> newAuthorizables) throws SentryUserException {
- if (oldAuthorizables == null || oldAuthorizables.isEmpty()
- || newAuthorizables == null || newAuthorizables.isEmpty()) {
- throw new SentryUserException("oldAuthorizables or newAuthorizables can not be null or empty");
- }
-
- TRenamePrivilegesRequest request = new TRenamePrivilegesRequest();
- request.setProtocol_version(sentry_common_serviceConstants.TSENTRY_SERVICE_V2);
- request.setComponent(component);
- request.setRequestorUserName(requestorUserName);
- request.setServiceName(serviceName);
-
- List<TAuthorizable> oldTAuthorizables = Lists.newArrayList();
- List<TAuthorizable> newTAuthorizables = Lists.newArrayList();
- for (Authorizable authorizable : oldAuthorizables) {
- oldTAuthorizables.add(new TAuthorizable(authorizable.getTypeName(), authorizable.getName()));
- request.setOldAuthorizables(oldTAuthorizables);
- }
- for (Authorizable authorizable : newAuthorizables) {
- newTAuthorizables.add(new TAuthorizable(authorizable.getTypeName(), authorizable.getName()));
- request.setNewAuthorizables(newTAuthorizables);
- }
-
- try {
- TRenamePrivilegesResponse response = client.rename_sentry_privilege(request);
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- /**
- * Gets sentry role objects for a given groupName using the Sentry service
- *
- * @param requestorUserName : user on whose behalf the request is issued
- * @param groupName : groupName to look up ( if null returns all roles for groups related to requestorUserName)
- * @param component: The request is issued to which component
- * @return Set of thrift sentry role objects
- * @throws SentryUserException
- */
- @Override
- public Set<TSentryRole> listRolesByGroupName(
- String requestorUserName,
- String groupName,
- String component)
- throws SentryUserException {
- TListSentryRolesRequest request = new TListSentryRolesRequest();
- request.setProtocol_version(sentry_common_serviceConstants.TSENTRY_SERVICE_V2);
- request.setRequestorUserName(requestorUserName);
- request.setGroupName(groupName);
- request.setComponent(component);
- TListSentryRolesResponse response;
- try {
- response = client.list_sentry_roles_by_group(request);
- Status.throwIfNotOk(response.getStatus());
- return response.getRoles();
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- @Override
- public Set<TSentryRole> listUserRoles(String requestorUserName, String component)
- throws SentryUserException {
- return listRolesByGroupName(requestorUserName, AccessConstants.ALL, component);
- }
-
- @Override
- public Set<TSentryRole> listAllRoles(String requestorUserName, String component)
- throws SentryUserException {
- return listRolesByGroupName(requestorUserName, null, component);
- }
-
- /**
- * Gets sentry privileges for a given roleName and Authorizable Hirerchys using the Sentry service
- *
- * @param requestorUserName: user on whose behalf the request is issued
- * @param roleName:
- * @param component: The request is issued to which component
- * @param serviceName
- * @param authorizables
- * @return
- * @throws SentryUserException
- */
- @Override
- public Set<TSentryPrivilege> listPrivilegesByRoleName(
- String requestorUserName, String roleName, String component,
- String serviceName, List<? extends Authorizable> authorizables)
- throws SentryUserException {
- TListSentryPrivilegesRequest request = new TListSentryPrivilegesRequest();
- request.setProtocol_version(sentry_common_serviceConstants.TSENTRY_SERVICE_V2);
- request.setComponent(component);
- request.setServiceName(serviceName);
- request.setRequestorUserName(requestorUserName);
- request.setRoleName(roleName);
- if (authorizables != null && !authorizables.isEmpty()) {
- List<TAuthorizable> tAuthorizables = Lists.newArrayList();
- for (Authorizable authorizable : authorizables) {
- tAuthorizables.add(new TAuthorizable(authorizable.getTypeName(), authorizable.getName()));
- }
- request.setAuthorizables(tAuthorizables);
- }
-
- TListSentryPrivilegesResponse response;
- try {
- response = client.list_sentry_privileges_by_role(request);
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- return response.getPrivileges();
- }
-
- @Override
- public Set<TSentryPrivilege> listAllPrivilegesByRoleName(
- String requestorUserName, String roleName, String component,
- String serviceName) throws SentryUserException {
- return listPrivilegesByRoleName(requestorUserName, roleName, component, serviceName, null);
- }
-
- /**
- * get sentry permissions from provider as followings:
- *
- * @throws SentryUserException
- * @param: component: The request is issued to which component
- * @param: serviceName: The privilege belongs to which service
- * @param: roleSet
- * @param: groupNames
- * @param: the authorizables
- * @returns the set of permissions
- */
- @Override
- public Set<String> listPrivilegesForProvider(String component,
- String serviceName, ActiveRoleSet roleSet, Set<String> groups,
- List<? extends Authorizable> authorizables) throws SentryUserException {
- TSentryActiveRoleSet thriftRoleSet = new TSentryActiveRoleSet(roleSet.isAll(), roleSet.getRoles());
- TListSentryPrivilegesForProviderRequest request = new TListSentryPrivilegesForProviderRequest();
- request.setProtocol_version(sentry_common_serviceConstants.TSENTRY_SERVICE_V2);
- request.setComponent(component);
- request.setServiceName(serviceName);
- request.setRoleSet(thriftRoleSet);
- if (groups == null) {
- request.setGroups(new HashSet<String>());
- } else {
- request.setGroups(groups);
- }
- List<TAuthorizable> tAuthoriables = Lists.newArrayList();
- if (authorizables != null && !authorizables.isEmpty()) {
- for (Authorizable authorizable : authorizables) {
- tAuthoriables.add(new TAuthorizable(authorizable.getTypeName(), authorizable.getName()));
- }
- request.setAuthorizables(tAuthoriables);
- }
-
- try {
- TListSentryPrivilegesForProviderResponse response = client.list_sentry_privileges_for_provider(request);
- Status.throwIfNotOk(response.getStatus());
- return response.getPrivileges();
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- /**
- * Get sentry privileges based on valid active roles and the authorize objects. Note that
- * it is client responsibility to ensure the requestor username, etc. is not impersonated.
- *
- * @param component: The request respond to which component.
- * @param serviceName: The name of service.
- * @param requestorUserName: The requestor user name.
- * @param authorizablesSet: The set of authorize objects. One authorize object is represented
- * as a string. e.g resourceType1=resourceName1->resourceType2=resourceName2->resourceType3=resourceName3.
- * @param groups: The requested groups.
- * @param roleSet: The active roles set.
- * @throws SentryUserException
- * @returns The mapping of authorize objects and TSentryPrivilegeMap(<role, set<privileges>).
- */
- @Override
- public Map<String, TSentryPrivilegeMap> listPrivilegesbyAuthorizable(String component,
- String serviceName, String requestorUserName, Set<String> authorizablesSet,
- Set<String> groups, ActiveRoleSet roleSet) throws SentryUserException {
-
- TListSentryPrivilegesByAuthRequest request = new TListSentryPrivilegesByAuthRequest();
-
- request.setProtocol_version(sentry_common_serviceConstants.TSENTRY_SERVICE_V2);
- request.setComponent(component);
- request.setServiceName(serviceName);
- request.setRequestorUserName(requestorUserName);
- request.setAuthorizablesSet(authorizablesSet);
-
- if (groups == null) {
- request.setGroups(new HashSet<String>());
- } else {
- request.setGroups(groups);
- }
-
- if (roleSet != null) {
- request.setRoleSet(new TSentryActiveRoleSet(roleSet.isAll(), roleSet.getRoles()));
- }
-
- try {
- TListSentryPrivilegesByAuthResponse response = client.list_sentry_privileges_by_authorizable(request);
- Status.throwIfNotOk(response.getStatus());
- return response.getPrivilegesMapByAuth();
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- @Override
- public void close() {
- done();
- }
-
- @Override
- public void done() {
- if (transport != null) {
- transportPool.returnTransport(transport);
- transport = null;
- }
- }
-
- @Override
- public void invalidate() {
- if (transport != null) {
- transportPool.invalidateTransport(transport);
- transport = null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericServiceClientFactory.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericServiceClientFactory.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericServiceClientFactory.java
deleted file mode 100644
index b663e3d..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericServiceClientFactory.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.generic.service.thrift;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.sentry.core.common.transport.RetryClientInvocationHandler;
-import org.apache.sentry.core.common.transport.SentryPolicyClientTransportConfig;
-import org.apache.sentry.core.common.transport.SentryTransportFactory;
-import org.apache.sentry.core.common.transport.SentryTransportPool;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.annotation.concurrent.ThreadSafe;
-import java.lang.reflect.Proxy;
-import java.util.concurrent.atomic.AtomicReference;
-
-/**
- * Produces client connection for Sentry clients using Generic model.
- * Factory is [alost] a singleton. Tests can call {@link #factoryReset()} to destroy the
- * existing factory and create a new one. This may be needed because tests modify
- * configuration and start and stop servers.
- */
-@ThreadSafe
-public final class SentryGenericServiceClientFactory {
- private static final Logger LOGGER = LoggerFactory.getLogger(SentryGenericServiceClientFactory.class);
-
- // Used to implement a singleton
- private static final AtomicReference<SentryGenericServiceClientFactory> clientFactory =
- new AtomicReference<>();
-
- private final SentryPolicyClientTransportConfig transportConfig =
- new SentryPolicyClientTransportConfig();
- private final SentryTransportPool transportPool;
- private final Configuration conf;
-
- /**
- * Obtain an Generic policy client instance.
- * @param conf Configuration that should be used. Configuration is only used for the
- * initial creation and ignored afterwords.
- */
- public static SentryGenericServiceClient create(Configuration conf) throws Exception {
- SentryGenericServiceClientFactory factory = clientFactory.get();
- if (factory != null) {
- return factory.create();
- }
- factory = new SentryGenericServiceClientFactory(conf);
- boolean ok = clientFactory.compareAndSet(null, factory);
- if (ok) {
- return factory.create();
- }
- factory.close();
- return clientFactory.get().create();
- }
-
- /**
- * Create a new factory instance and atach it to a connection pool instance.
- * @param conf Configuration
- */
- private SentryGenericServiceClientFactory(Configuration conf) {
- if (transportConfig.isKerberosEnabled(conf) &&
- transportConfig.useUserGroupInformation(conf)) {
- LOGGER.info("Using UserGroupInformation authentication");
- UserGroupInformation.setConfiguration(conf);
- }
-
- this.conf = conf;
-
- transportPool = new SentryTransportPool(this.conf, transportConfig,
- new SentryTransportFactory(this.conf, transportConfig));
- }
-
- /**
- * Create a new client connection to the server for Generic model clients
- * @return client instance
- * @throws Exception if something goes wrong
- */
- @SuppressWarnings("squid:S00112")
- private SentryGenericServiceClient create() throws Exception {
- return (SentryGenericServiceClient) Proxy
- .newProxyInstance(SentryGenericServiceClientDefaultImpl.class.getClassLoader(),
- SentryGenericServiceClientDefaultImpl.class.getInterfaces(),
- new RetryClientInvocationHandler(conf,
- new SentryGenericServiceClientDefaultImpl(conf, transportPool), transportConfig));
- }
-
- // Should only be used by tests.
- // Resets the factory and destroys any pooled connections
- public static void factoryReset() {
- LOGGER.debug("factory reset");
- SentryGenericServiceClientFactory factory = clientFactory.getAndSet(null);
- if (factory != null) {
- try {
- factory.transportPool.close();
- } catch (Exception e) {
- LOGGER.error("failed to close transport pool", e);
- }
- }
- }
-
- private void close() {
- try {
- transportPool.close();
- } catch (Exception e) {
- LOGGER.error("failed to close transport pool", e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/tools/GenericPrivilegeConverter.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/tools/GenericPrivilegeConverter.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/tools/GenericPrivilegeConverter.java
index 82b21ef..6a2c77f 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/tools/GenericPrivilegeConverter.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/tools/GenericPrivilegeConverter.java
@@ -29,6 +29,9 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import org.apache.sentry.api.generic.thrift.TAuthorizable;
+import org.apache.sentry.api.generic.thrift.TSentryGrantOption;
+import org.apache.sentry.api.generic.thrift.TSentryPrivilege;
import org.apache.sentry.core.common.Authorizable;
import org.apache.sentry.core.common.exception.SentryUserException;
import org.apache.sentry.core.common.utils.KeyValue;
@@ -46,9 +49,6 @@ import org.apache.sentry.core.model.solr.SolrPrivilegeModel;
import org.apache.sentry.core.model.sqoop.SqoopModelAuthorizables;
import org.apache.sentry.core.model.sqoop.SqoopPrivilegeModel;
import org.apache.sentry.provider.common.AuthorizationComponent;
-import org.apache.sentry.provider.db.generic.service.thrift.TAuthorizable;
-import org.apache.sentry.provider.db.generic.service.thrift.TSentryGrantOption;
-import org.apache.sentry.provider.db.generic.service.thrift.TSentryPrivilege;
import org.apache.shiro.config.ConfigurationException;
/**
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/tools/TSentryPrivilegeConverter.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/tools/TSentryPrivilegeConverter.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/tools/TSentryPrivilegeConverter.java
index 5e48483..fc55575 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/tools/TSentryPrivilegeConverter.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/tools/TSentryPrivilegeConverter.java
@@ -18,8 +18,8 @@
*/
package org.apache.sentry.provider.db.generic.tools;
+import org.apache.sentry.api.generic.thrift.TSentryPrivilege;
import org.apache.sentry.core.common.exception.SentryUserException;
-import org.apache.sentry.provider.db.generic.service.thrift.TSentryPrivilege;
public interface TSentryPrivilegeConverter {
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/log/entity/JsonLogEntityFactory.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/log/entity/JsonLogEntityFactory.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/log/entity/JsonLogEntityFactory.java
index 09f7d13..61becce 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/log/entity/JsonLogEntityFactory.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/log/entity/JsonLogEntityFactory.java
@@ -25,30 +25,30 @@ import java.util.Map;
import java.util.Set;
import org.apache.hadoop.conf.Configuration;
-import org.apache.sentry.provider.db.generic.service.thrift.TAuthorizable;
+import org.apache.sentry.api.generic.thrift.TAuthorizable;
import org.apache.sentry.provider.db.log.util.CommandUtil;
import org.apache.sentry.provider.db.log.util.Constants;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleAddGroupsRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleAddGroupsResponse;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleAddUsersRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleAddUsersResponse;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleDeleteGroupsRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleDeleteGroupsResponse;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleDeleteUsersRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleDeleteUsersResponse;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleGrantPrivilegeRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleGrantPrivilegeResponse;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleRevokePrivilegeRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleRevokePrivilegeResponse;
-import org.apache.sentry.provider.db.service.thrift.TCreateSentryRoleRequest;
-import org.apache.sentry.provider.db.service.thrift.TCreateSentryRoleResponse;
-import org.apache.sentry.provider.db.service.thrift.TDropSentryRoleRequest;
-import org.apache.sentry.provider.db.service.thrift.TDropSentryRoleResponse;
-import org.apache.sentry.provider.db.service.thrift.TSentryGroup;
-import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleAddGroupsRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleAddGroupsResponse;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleAddUsersRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleAddUsersResponse;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleDeleteGroupsRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleDeleteGroupsResponse;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleDeleteUsersRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleDeleteUsersResponse;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleGrantPrivilegeRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleGrantPrivilegeResponse;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleRevokePrivilegeRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleRevokePrivilegeResponse;
+import org.apache.sentry.api.service.thrift.TCreateSentryRoleRequest;
+import org.apache.sentry.api.service.thrift.TCreateSentryRoleResponse;
+import org.apache.sentry.api.service.thrift.TDropSentryRoleRequest;
+import org.apache.sentry.api.service.thrift.TDropSentryRoleResponse;
+import org.apache.sentry.api.service.thrift.TSentryGroup;
+import org.apache.sentry.api.service.thrift.TSentryPrivilege;
import org.apache.sentry.core.common.utils.ThriftUtil;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
-import org.apache.sentry.service.thrift.Status;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
+import org.apache.sentry.api.common.Status;
import org.apache.sentry.service.thrift.TSentryResponseStatus;
import com.google.common.base.Joiner;
@@ -225,8 +225,8 @@ public final class JsonLogEntityFactory {
// log entity for generic model create role
public JsonLogEntity createJsonLogEntity(
- org.apache.sentry.provider.db.generic.service.thrift.TCreateSentryRoleRequest request,
- org.apache.sentry.provider.db.generic.service.thrift.TCreateSentryRoleResponse response,
+ org.apache.sentry.api.generic.thrift.TCreateSentryRoleRequest request,
+ org.apache.sentry.api.generic.thrift.TCreateSentryRoleResponse response,
Configuration conf) {
GMAuditMetadataLogEntity gmamle = createCommonGMAMLE(conf, response.getStatus(),
request.getRequestorUserName(), request.getClass().getName(), request.getComponent());
@@ -237,8 +237,8 @@ public final class JsonLogEntityFactory {
// log entity for generic model drop role
public JsonLogEntity createJsonLogEntity(
- org.apache.sentry.provider.db.generic.service.thrift.TDropSentryRoleRequest request,
- org.apache.sentry.provider.db.generic.service.thrift.TDropSentryRoleResponse response,
+ org.apache.sentry.api.generic.thrift.TDropSentryRoleRequest request,
+ org.apache.sentry.api.generic.thrift.TDropSentryRoleResponse response,
Configuration conf) {
GMAuditMetadataLogEntity gmamle = createCommonGMAMLE(conf, response.getStatus(),
request.getRequestorUserName(), request.getClass().getName(), request.getComponent());
@@ -249,8 +249,8 @@ public final class JsonLogEntityFactory {
// log entity for generic model grant privilege
public JsonLogEntity createJsonLogEntity(
- org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleGrantPrivilegeRequest request,
- org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleGrantPrivilegeResponse response,
+ org.apache.sentry.api.generic.thrift.TAlterSentryRoleGrantPrivilegeRequest request,
+ org.apache.sentry.api.generic.thrift.TAlterSentryRoleGrantPrivilegeResponse response,
Configuration conf) {
GMAuditMetadataLogEntity gmamle = createCommonGMAMLE(conf, response.getStatus(),
request.getRequestorUserName(), request.getClass().getName(), request.getComponent());
@@ -271,8 +271,8 @@ public final class JsonLogEntityFactory {
// log entity for generic model revoke privilege
public JsonLogEntity createJsonLogEntity(
- org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleRevokePrivilegeRequest request,
- org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleRevokePrivilegeResponse response,
+ org.apache.sentry.api.generic.thrift.TAlterSentryRoleRevokePrivilegeRequest request,
+ org.apache.sentry.api.generic.thrift.TAlterSentryRoleRevokePrivilegeResponse response,
Configuration conf) {
GMAuditMetadataLogEntity gmamle = createCommonGMAMLE(conf, response.getStatus(),
request.getRequestorUserName(), request.getClass().getName(), request.getComponent());
@@ -293,8 +293,8 @@ public final class JsonLogEntityFactory {
// log entity for generic model add role to group
public JsonLogEntity createJsonLogEntity(
- org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleAddGroupsRequest request,
- org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleAddGroupsResponse response,
+ org.apache.sentry.api.generic.thrift.TAlterSentryRoleAddGroupsRequest request,
+ org.apache.sentry.api.generic.thrift.TAlterSentryRoleAddGroupsResponse response,
Configuration conf) {
GMAuditMetadataLogEntity gmamle = createCommonGMAMLE(conf, response.getStatus(),
request.getRequestorUserName(), request.getClass().getName(), request.getComponent());
@@ -307,8 +307,8 @@ public final class JsonLogEntityFactory {
// log entity for hive delete role from group
public JsonLogEntity createJsonLogEntity(
- org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleDeleteGroupsRequest request,
- org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleDeleteGroupsResponse response,
+ org.apache.sentry.api.generic.thrift.TAlterSentryRoleDeleteGroupsRequest request,
+ org.apache.sentry.api.generic.thrift.TAlterSentryRoleDeleteGroupsResponse response,
Configuration conf) {
GMAuditMetadataLogEntity gmamle = createCommonGMAMLE(conf, response.getStatus(),
request.getRequestorUserName(), request.getClass().getName(), request.getComponent());
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/log/util/CommandUtil.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/log/util/CommandUtil.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/log/util/CommandUtil.java
index 328bbbb..6479a60 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/log/util/CommandUtil.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/log/util/CommandUtil.java
@@ -25,12 +25,12 @@ import java.util.List;
import java.util.Set;
import org.apache.sentry.core.model.db.AccessConstants;
-import org.apache.sentry.provider.db.generic.service.thrift.TAuthorizable;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleGrantPrivilegeRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleRevokePrivilegeRequest;
-import org.apache.sentry.provider.db.service.thrift.TSentryGrantOption;
-import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege;
-import org.apache.sentry.service.thrift.ServiceConstants.PrivilegeScope;
+import org.apache.sentry.api.generic.thrift.TAuthorizable;
+import org.apache.sentry.api.common.ApiConstants.PrivilegeScope;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleGrantPrivilegeRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleRevokePrivilegeRequest;
+import org.apache.sentry.api.service.thrift.TSentryGrantOption;
+import org.apache.sentry.api.service.thrift.TSentryPrivilege;
import org.datanucleus.util.StringUtils;
import com.google.common.annotations.VisibleForTesting;
@@ -159,18 +159,18 @@ public final class CommandUtil {
}
public static String createCmdForGrantGMPrivilege(
- org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleGrantPrivilegeRequest request) {
+ org.apache.sentry.api.generic.thrift.TAlterSentryRoleGrantPrivilegeRequest request) {
return createCmdForGrantOrRevokeGMPrivilege(request.getRoleName(), request.getPrivilege(), true);
}
public static String createCmdForRevokeGMPrivilege(
- org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleRevokePrivilegeRequest request) {
+ org.apache.sentry.api.generic.thrift.TAlterSentryRoleRevokePrivilegeRequest request) {
return createCmdForGrantOrRevokeGMPrivilege(request.getRoleName(), request.getPrivilege(),
false);
}
private static String createCmdForGrantOrRevokeGMPrivilege(String roleName,
- org.apache.sentry.provider.db.generic.service.thrift.TSentryPrivilege privilege,
+ org.apache.sentry.api.generic.thrift.TSentryPrivilege privilege,
boolean isGrant) {
StringBuilder sb = new StringBuilder();
if (isGrant) {
@@ -205,7 +205,7 @@ public final class CommandUtil {
}
sb.append(roleName);
- if (privilege.getGrantOption() == org.apache.sentry.provider.db.generic.service.thrift.TSentryGrantOption.TRUE) {
+ if (privilege.getGrantOption() == org.apache.sentry.api.generic.thrift.TSentryGrantOption.TRUE) {
sb.append(" WITH GRANT OPTION");
}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/log/util/Constants.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/log/util/Constants.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/log/util/Constants.java
index 6a4f2e0..6e91f8b 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/log/util/Constants.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/log/util/Constants.java
@@ -21,7 +21,7 @@ package org.apache.sentry.provider.db.log.util;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
-import org.apache.sentry.provider.db.service.thrift.*;
+import org.apache.sentry.api.service.thrift.*;
public final class Constants {
public static final String AUDIT_LOGGER_NAME = "sentry.hive.authorization.ddl.logger";
@@ -69,17 +69,17 @@ public final class Constants {
.put(TAlterSentryRoleDeleteUsersRequest.class.getName(), Constants.OPERATION_DELETE_ROLE_USER)
// for generic model audit log
- .put(org.apache.sentry.provider.db.generic.service.thrift.TCreateSentryRoleRequest.class.getName(),
+ .put(org.apache.sentry.api.generic.thrift.TCreateSentryRoleRequest.class.getName(),
Constants.OPERATION_CREATE_ROLE)
- .put(org.apache.sentry.provider.db.generic.service.thrift.TDropSentryRoleRequest.class.getName(),
+ .put(org.apache.sentry.api.generic.thrift.TDropSentryRoleRequest.class.getName(),
Constants.OPERATION_DROP_ROLE)
- .put(org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleGrantPrivilegeRequest.class.getName(),
+ .put(org.apache.sentry.api.generic.thrift.TAlterSentryRoleGrantPrivilegeRequest.class.getName(),
Constants.OPERATION_GRANT_PRIVILEGE)
- .put(org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleRevokePrivilegeRequest.class.getName(),
+ .put(org.apache.sentry.api.generic.thrift.TAlterSentryRoleRevokePrivilegeRequest.class.getName(),
Constants.OPERATION_REVOKE_PRIVILEGE)
- .put(org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleAddGroupsRequest.class.getName(),
+ .put(org.apache.sentry.api.generic.thrift.TAlterSentryRoleAddGroupsRequest.class.getName(),
Constants.OPERATION_ADD_ROLE)
- .put(org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleDeleteGroupsRequest.class.getName(),
+ .put(org.apache.sentry.api.generic.thrift.TAlterSentryRoleDeleteGroupsRequest.class.getName(),
Constants.OPERATION_DELETE_ROLE)
.build();
@@ -95,17 +95,17 @@ public final class Constants {
.put(TAlterSentryRoleRevokePrivilegeRequest.class.getName(), Constants.OBJECT_TYPE_PRINCIPAL)
// for generic model audit log
- .put(org.apache.sentry.provider.db.generic.service.thrift.TCreateSentryRoleRequest.class.getName(),
+ .put(org.apache.sentry.api.generic.thrift.TCreateSentryRoleRequest.class.getName(),
Constants.OBJECT_TYPE_ROLE)
- .put(org.apache.sentry.provider.db.generic.service.thrift.TDropSentryRoleRequest.class.getName(),
+ .put(org.apache.sentry.api.generic.thrift.TDropSentryRoleRequest.class.getName(),
Constants.OBJECT_TYPE_ROLE)
- .put(org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleAddGroupsRequest.class.getName(),
+ .put(org.apache.sentry.api.generic.thrift.TAlterSentryRoleAddGroupsRequest.class.getName(),
Constants.OBJECT_TYPE_ROLE)
- .put(org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleDeleteGroupsRequest.class.getName(),
+ .put(org.apache.sentry.api.generic.thrift.TAlterSentryRoleDeleteGroupsRequest.class.getName(),
Constants.OBJECT_TYPE_ROLE)
- .put(org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleGrantPrivilegeRequest.class.getName(),
+ .put(org.apache.sentry.api.generic.thrift.TAlterSentryRoleGrantPrivilegeRequest.class.getName(),
Constants.OBJECT_TYPE_PRINCIPAL)
- .put(org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleRevokePrivilegeRequest.class.getName(),
+ .put(org.apache.sentry.api.generic.thrift.TAlterSentryRoleRevokePrivilegeRequest.class.getName(),
Constants.OBJECT_TYPE_PRINCIPAL)
.build();
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HAContext.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HAContext.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HAContext.java
index 71865ca..2505da9 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HAContext.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HAContext.java
@@ -47,7 +47,7 @@ import java.util.concurrent.ThreadFactory;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
-import static org.apache.sentry.service.thrift.ServiceConstants.ServerConfig.*;
+import static org.apache.sentry.service.common.ServiceConstants.ServerConfig.*;
/**
* HAContext stores the global ZooKeeper related context.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
index 929e6be..42770df 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
@@ -36,7 +36,7 @@ import org.apache.thrift.TException;
import org.apache.sentry.service.thrift.SentryHMSClient;
import org.apache.sentry.service.thrift.HiveConnectionFactory;
import org.apache.sentry.service.thrift.HiveNotificationFetcher;
-import org.apache.sentry.service.thrift.SentryServiceUtil;
+import org.apache.sentry.api.common.SentryServiceUtil;
import org.apache.sentry.service.thrift.SentryStateBank;
import org.apache.sentry.service.thrift.SentryServiceState;
import org.apache.sentry.service.thrift.HMSFollowerState;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/LeaderStatusMonitor.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/LeaderStatusMonitor.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/LeaderStatusMonitor.java
index 0a208d4..c2f1ad0 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/LeaderStatusMonitor.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/LeaderStatusMonitor.java
@@ -33,7 +33,7 @@ import java.util.concurrent.locks.ReentrantLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static org.apache.sentry.service.thrift.ServiceConstants.ServerConfig.*;
+import static org.apache.sentry.service.common.ServiceConstants.ServerConfig.*;
/**
* LeaderStatusMonitor participates in the distributed leader election protocol
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/NotificationProcessor.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/NotificationProcessor.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/NotificationProcessor.java
index 6134778..228d37c 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/NotificationProcessor.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/NotificationProcessor.java
@@ -45,11 +45,11 @@ import org.apache.sentry.hdfs.SentryMalformedPathException;
import org.apache.sentry.hdfs.UniquePathsUpdate;
import org.apache.sentry.hdfs.Updateable.Update;
import org.apache.sentry.hdfs.service.thrift.TPrivilegeChanges;
+import org.apache.sentry.api.service.thrift.SentryMetrics;
+import org.apache.sentry.api.service.thrift.TSentryAuthorizable;
+import org.apache.sentry.api.common.SentryServiceUtil;
import org.apache.sentry.hdfs.service.thrift.TPrivilegeEntityType;
-import org.apache.sentry.provider.db.service.thrift.SentryMetrics;
-import org.apache.sentry.provider.db.service.thrift.TSentryAuthorizable;
import org.apache.sentry.hdfs.service.thrift.TPrivilegeEntity;
-import org.apache.sentry.service.thrift.SentryServiceUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
index 4581170..b640f59 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
@@ -70,18 +70,18 @@ import org.apache.sentry.provider.db.service.model.MSentryVersion;
import org.apache.sentry.provider.db.service.model.MSentryRole;
import org.apache.sentry.provider.db.service.model.MSentryUtil;
import org.apache.sentry.provider.db.service.model.MPath;
-import org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessor;
-import org.apache.sentry.provider.db.service.thrift.TSentryActiveRoleSet;
-import org.apache.sentry.provider.db.service.thrift.TSentryAuthorizable;
-import org.apache.sentry.provider.db.service.thrift.TSentryGrantOption;
-import org.apache.sentry.provider.db.service.thrift.TSentryGroup;
-import org.apache.sentry.provider.db.service.thrift.TSentryMappingData;
-import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege;
-import org.apache.sentry.provider.db.service.thrift.TSentryPrivilegeMap;
-import org.apache.sentry.provider.db.service.thrift.TSentryRole;
import org.apache.sentry.hdfs.service.thrift.TPrivilegeEntity;
-import org.apache.sentry.service.thrift.ServiceConstants.PrivilegeScope;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
+import org.apache.sentry.api.common.ApiConstants.PrivilegeScope;
+import org.apache.sentry.api.service.thrift.SentryPolicyStoreProcessor;
+import org.apache.sentry.api.service.thrift.TSentryActiveRoleSet;
+import org.apache.sentry.api.service.thrift.TSentryAuthorizable;
+import org.apache.sentry.api.service.thrift.TSentryGrantOption;
+import org.apache.sentry.api.service.thrift.TSentryGroup;
+import org.apache.sentry.api.service.thrift.TSentryMappingData;
+import org.apache.sentry.api.service.thrift.TSentryPrivilege;
+import org.apache.sentry.api.service.thrift.TSentryPrivilegeMap;
+import org.apache.sentry.api.service.thrift.TSentryRole;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
import org.datanucleus.store.rdbms.exceptions.MissingTableException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/TransactionManager.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/TransactionManager.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/TransactionManager.java
index f4ff962..ba6e845 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/TransactionManager.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/TransactionManager.java
@@ -25,7 +25,7 @@ import com.codahale.metrics.Timer;
import com.codahale.metrics.Timer.Context;
import org.apache.hadoop.conf.Configuration;
import org.apache.sentry.core.common.exception.SentryUserException;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -33,7 +33,7 @@ import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;
import javax.jdo.Transaction;
-import org.apache.sentry.provider.db.service.thrift.SentryMetrics;
+import org.apache.sentry.api.service.thrift.SentryMetrics;
import java.util.Random;
import java.util.concurrent.Callable;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/ConfServlet.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/ConfServlet.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/ConfServlet.java
deleted file mode 100644
index 1233fbc..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/ConfServlet.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.apache.sentry.provider.db.service.thrift;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.IOException;
-import java.io.Writer;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.hadoop.conf.Configuration;
-
-import static org.apache.commons.lang.StringEscapeUtils.escapeHtml;
-
-/**
- * Servlet to print out all sentry configuration.
- */
-public class ConfServlet extends HttpServlet {
- public static final String CONF_CONTEXT_ATTRIBUTE = "sentry.conf";
- public static final String FORMAT_JSON = "json";
- public static final String FORMAT_XML = "xml";
- public static final String FORMAT_PARAM = "format";
- private static final long serialVersionUID = 1L;
-
- @Override
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- String format = request.getParameter(FORMAT_PARAM);
- if (format == null) {
- format = FORMAT_XML;
- }
-
- if (FORMAT_XML.equals(format)) {
- response.setContentType("text/xml; charset=utf-8");
- } else if (FORMAT_JSON.equals(format)) {
- response.setContentType("application/json; charset=utf-8");
- }
-
- Configuration conf = (Configuration)getServletContext().getAttribute(
- CONF_CONTEXT_ATTRIBUTE);
- assert conf != null;
-
- Writer out = response.getWriter();
- if (FORMAT_JSON.equals(format)) {
- Configuration.dumpConfiguration(conf, out);
- } else if (FORMAT_XML.equals(format)) {
- conf.writeXml(out);
- } else {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Bad format: " + escapeHtml(format));
- }
- out.close();
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/LogLevelServlet.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/LogLevelServlet.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/LogLevelServlet.java
deleted file mode 100644
index 68d6d90..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/LogLevelServlet.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
-
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import static org.apache.commons.lang.StringEscapeUtils.escapeHtml;
-
-public class LogLevelServlet extends HttpServlet {
- private static final String LF = "\n";
- private static final String BR = "<br />";
- private static final String B_BR = "<b>%s</b><br />";
- private static final String FORMS_HEAD =
- "<h1>" + "Log Level" + "</h1>"
- + LF + BR + "<hr /><h3>Results</h3>"
- + LF + " Submitted Log Name: " + B_BR;
- private static final String FORMS_CONTENT_GET =
- LF + " Effective level: " + B_BR;
- private static final String FORMS_CONTENT_SET =
- LF + " Submitted Level: " + B_BR
- + LF + " Setting Level to %s" + BR
- + LF + " Effective level: " + B_BR;
- private static final String FORMS_END =
- LF + BR + "<hr /><h3>Get / Set</h3>"
- + LF + "<form>Log: <input type='text' size='50' name='log' /> "
- + "<input type='submit' value='Get Log Level' />" + "</form>"
- + LF + "<form>Log: <input type='text' size='50' name='log' /> "
- + "Level: <input type='text' name='level' /> "
- + "<input type='submit' value='Set Log Level' />" + "</form>";
- private static final String FORMS_GET = FORMS_HEAD + FORMS_CONTENT_GET;
- private static final String FORMS_SET = FORMS_HEAD + FORMS_CONTENT_SET;
-
- /**
- * Return parameter on servlet request for the given name
- *
- * @param request: Servlet request
- * @param name: Name of parameter in servlet request
- * @return Parameter in servlet request for the given name, return null if can't find parameter.
- */
- private String getParameter(ServletRequest request, String name) {
- String s = request.getParameter(name);
- if (s == null) {
- return null;
- }
- s = s.trim();
- return s.length() == 0 ? null : s;
- }
-
- /**
- * Check the validity of the log level.
- * @param level: The log level to be checked
- * @return
- * true: The log level is valid
- * false: The log level is invalid
- */
- private boolean isLogLevelValid(String level) {
- return level.equals(Level.toLevel(level).toString());
- }
-
- /**
- * Parse the class name and log level in the http servlet request.
- * If the request contains only class name, return the log level in the response message.
- * If the request contains both class name and level, set the log level to the requested level
- * and return the setting result in the response message.
- */
- @Override
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- String logName = getParameter(request, "log");
- String level = getParameter(request, "level");
- response.setContentType("text/html;charset=utf-8");
- response.setStatus(HttpServletResponse.SC_OK);
- PrintWriter out = response.getWriter();
-
- if (logName != null) {
- Logger logInstance = LogManager.getLogger(logName);
- if (level == null) {
- out.write(String.format(FORMS_GET,
- escapeHtml(logName),
- logInstance.getEffectiveLevel().toString()));
- } else if (isLogLevelValid(level)) {
- logInstance.setLevel(Level.toLevel(level));
- out.write(String.format(FORMS_SET,
- escapeHtml(logName),
- escapeHtml(level),
- escapeHtml(level),
- logInstance.getEffectiveLevel().toString()));
- } else {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Invalid log level: " + escapeHtml(level));
- return;
- }
- }
- out.write(FORMS_END);
- out.close();
- response.flushBuffer();
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/NotificationHandler.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/NotificationHandler.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/NotificationHandler.java
deleted file mode 100644
index e853394..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/NotificationHandler.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.hadoop.conf.Configuration;
-
-/**
- * Users wishing to be notified when a metadata changing event occurs
- * should extend this abstract class. All methods which modify the underlying
- * metadata in SentryPolicyStoreProcessor will have a corresponding method
- * on this class. Each method will contain a copy of the request and response
- * object. Therefore any change to the request or response object will be ignored.
- *
- * Sub-classes should be thread-safe.
- */
-public abstract class NotificationHandler {
-
- private final Configuration config;
-
- public NotificationHandler(Configuration config) throws Exception {
- this.config = config;
- }
-
- protected Configuration getConf() {
- return config;
- }
-
- public void create_sentry_role(TCreateSentryRoleRequest request, TCreateSentryRoleResponse response) {
- }
-
- public void drop_sentry_role(TDropSentryRoleRequest request, TDropSentryRoleResponse response) {
- }
-
- public void alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request,
- TAlterSentryRoleGrantPrivilegeResponse response) {
- }
-
- public void alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request,
- TAlterSentryRoleRevokePrivilegeResponse response) {
- }
-
- public void alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request,
- TAlterSentryRoleAddGroupsResponse response) {
- }
-
- public void alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request,
- TAlterSentryRoleDeleteGroupsResponse response) {
- }
-
- public void alter_sentry_role_add_users(TAlterSentryRoleAddUsersRequest request,
- TAlterSentryRoleAddUsersResponse response) {
- }
-
- public void alter_sentry_role_delete_users(TAlterSentryRoleDeleteUsersRequest request,
- TAlterSentryRoleDeleteUsersResponse response) {
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/NotificationHandlerInvoker.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/NotificationHandlerInvoker.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/NotificationHandlerInvoker.java
deleted file mode 100644
index 75b4260..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/NotificationHandlerInvoker.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import java.util.List;
-
-import org.apache.hadoop.conf.Configuration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Invokes configured instances of NotificationHandler. Importantly
- * NotificationHandler's each receive a copy of the request and
- * response thrift objects from each successful request.
- */
-public class NotificationHandlerInvoker extends NotificationHandler {
- private static final Logger LOGGER = LoggerFactory.getLogger(NotificationHandlerInvoker.class);
-
- private final ImmutableList<NotificationHandler> handlers;
-
- public NotificationHandlerInvoker(Configuration conf, List<NotificationHandler> handlers)
- throws Exception {
- super(conf);
- this.handlers = ImmutableList.copyOf(handlers);
- }
-
- @Override
- public void create_sentry_role(TCreateSentryRoleRequest request, TCreateSentryRoleResponse response) {
- for (NotificationHandler handler : handlers) {
- try {
- LOGGER.debug("Calling " + handler);
- handler.create_sentry_role(new TCreateSentryRoleRequest(request),
- new TCreateSentryRoleResponse(response));
- } catch (Exception ex) {
- LOGGER.error("Unexpected error in " + handler + ". Request: "
- + request + ", Response: " + response, ex);
- }
- }
- }
-
- @Override
- public void drop_sentry_role(TDropSentryRoleRequest request,
- TDropSentryRoleResponse response) {
- for (NotificationHandler handler : handlers) {
- try {
- LOGGER.debug("Calling " + handler);
- handler.drop_sentry_role(new TDropSentryRoleRequest(request),
- new TDropSentryRoleResponse(response));
- } catch (Exception ex) {
- LOGGER.error("Unexpected error in " + handler + ". Request: "
- + request + ", Response: " + response, ex);
- }
- }
- }
-
- @Override
- public void alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request,
- TAlterSentryRoleGrantPrivilegeResponse response) {
- for (NotificationHandler handler : handlers) {
- try {
- LOGGER.debug("Calling " + handler);
- handler.alter_sentry_role_grant_privilege(new TAlterSentryRoleGrantPrivilegeRequest(request),
- new TAlterSentryRoleGrantPrivilegeResponse(response));
- } catch (Exception ex) {
- LOGGER.error("Unexpected error in " + handler + ". Request: "
- + request + ", Response: " + response, ex);
- }
- }
- }
-
- @Override
- public void alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request,
- TAlterSentryRoleRevokePrivilegeResponse response) {
- for (NotificationHandler handler : handlers) {
- try {
- LOGGER.debug("Calling " + handler);
- handler.alter_sentry_role_revoke_privilege(new TAlterSentryRoleRevokePrivilegeRequest(request),
- new TAlterSentryRoleRevokePrivilegeResponse(response));
- } catch (Exception ex) {
- LOGGER.error("Unexpected error in " + handler + ". Request: "
- + request + ", Response: " + response, ex);
- }
- }
- }
-
- @Override
- public void alter_sentry_role_add_groups(
- TAlterSentryRoleAddGroupsRequest request,
- TAlterSentryRoleAddGroupsResponse response) {
- for (NotificationHandler handler : handlers) {
- try {
- LOGGER.debug("Calling " + handler);
- handler.alter_sentry_role_add_groups(new TAlterSentryRoleAddGroupsRequest(request),
- new TAlterSentryRoleAddGroupsResponse(response));
- } catch (Exception ex) {
- LOGGER.error("Unexpected error in " + handler + ". Request: "
- + request + ", Response: " + response, ex);
- }
- }
- }
-
- @Override
- public void alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request,
- TAlterSentryRoleDeleteGroupsResponse response) {
- for (NotificationHandler handler : handlers) {
- try {
- LOGGER.debug("Calling " + handler);
- handler.alter_sentry_role_delete_groups(new TAlterSentryRoleDeleteGroupsRequest(request),
- new TAlterSentryRoleDeleteGroupsResponse(response));
- } catch (Exception ex) {
- LOGGER.error("Unexpected error in " + handler + ". Request: "
- + request + ", Response: " + response, ex);
- }
- }
- }
-
- @Override
- public void alter_sentry_role_add_users(TAlterSentryRoleAddUsersRequest request,
- TAlterSentryRoleAddUsersResponse response) {
- for (NotificationHandler handler : handlers) {
- try {
- LOGGER.debug("Calling " + handler);
- handler.alter_sentry_role_add_users(new TAlterSentryRoleAddUsersRequest(request),
- new TAlterSentryRoleAddUsersResponse(response));
- } catch (Exception ex) {
- LOGGER.error("Unexpected error in " + handler + ". Request: " + request + ", Response: "
- + response, ex);
- }
- }
- }
-
- @Override
- public void alter_sentry_role_delete_users(TAlterSentryRoleDeleteUsersRequest request,
- TAlterSentryRoleDeleteUsersResponse response) {
- for (NotificationHandler handler : handlers) {
- try {
- LOGGER.debug("Calling " + handler);
- handler.alter_sentry_role_delete_users(new TAlterSentryRoleDeleteUsersRequest(
- request), new TAlterSentryRoleDeleteUsersResponse(response));
- } catch (Exception ex) {
- LOGGER.error("Unexpected error in " + handler + ". Request: " + request + ", Response: "
- + response, ex);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/PubSubServlet.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/PubSubServlet.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/PubSubServlet.java
deleted file mode 100644
index 6756d91..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/PubSubServlet.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.sentry.core.common.utils.PubSub;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import static org.apache.commons.lang.StringEscapeUtils.escapeHtml;
-
-/**
- * This servlet facilitates sending {topic, message } tuples to Servlet components
- * subscribed to specific topics.
- * <p>
- * It uses publish-subscribe mechanism implemented by PubSub class.
- * The form generated by this servlet consists of the following elements:
- * <p>
- * a) Topic: pull-down menu of existing topics, i.e. the topics registered with
- * PubSub by calling PubSub.subscribe() API. This prevents entering invalid topic.
- * <p>
- * b) Message: text field for entering a message
- * <p>
- * c) Submit: button to submit (topic, message) tuple
- * <p>
- * d) Status: text area printing status of the request or help information.
- */
-public class PubSubServlet extends HttpServlet {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(PubSubServlet.class);
-
- private static final String FORM_GET =
- "<!DOCTYPE html>" +
- "<html>" +
- "<body>" +
- "<form>" +
- "<br><br><b>Topic:</b><br><br>" +
- "<select name='topic'/>%s</select>" +
- "<br><br><b>Message:</b><br><br>" +
- "<input type='text' size='50' name='message'/>" +
- "<br><br>" +
- "<input type='submit' value='Submit'/>" +
- "</form>" +
- "<br><br><b>Status:</b><br><br>" +
- "<textarea rows='4' cols='50'>%s</textarea>" +
- "</body>" +
- "</html>";
-
- /**
- * Return parameter on servlet request for the given name
- *
- * @param request: Servlet request
- * @param name: Name of parameter in servlet request
- * @return Parameter in servlet request for the given name, return null if can't find parameter.
- */
- private static String getParameter(ServletRequest request, String name) {
- String s = request.getParameter(name);
- if (s == null) {
- return null;
- }
- s = s.trim();
- return s.isEmpty() ? null : s;
- }
-
- /**
- * Parse the topic and message values and submit them via PubSub.submit() API.
- * Reject request for unknown topic, i.e. topic no one is subscribed to.
- */
- @Override
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- String topic = getParameter(request, "topic");
- String message = getParameter(request, "message");
- response.setContentType("text/html;charset=utf-8");
- response.setStatus(HttpServletResponse.SC_OK);
- PrintWriter out = response.getWriter();
-
- String msg = "Topic is required, Message is optional.\nValid topics: " + PubSub.getInstance().getTopics();
- if (topic != null) {
- LOGGER.info("Submitting topic " + topic + ", message " + message);
- try {
- PubSub.getInstance().publish(PubSub.Topic.fromString(topic), message);
- msg = "Submitted topic " + topic + ", message " + message;
- } catch (Exception e) {
- msg = "Failed to submit topic " + topic + ", message " + message + " - " + e.getMessage();
- LOGGER.error(msg);
- response.sendError(HttpServletResponse.SC_BAD_REQUEST, msg);
- return;
- }
- }
-
- StringBuilder topics = new StringBuilder();
- for (PubSub.Topic t : PubSub.getInstance().getTopics()) {
- topics.append("<option>").append(t.getName()).append("</option>");
- }
-
- String output = String.format(FORM_GET, topics.toString(), escapeHtml(msg));
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("HTML Page: " + output);
- }
- out.write(output);
- out.close();
- response.flushBuffer();
- }
-}
[24/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryWebServer.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryWebServer.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryWebServer.java
new file mode 100644
index 0000000..befe6c3
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryWebServer.java
@@ -0,0 +1,240 @@
+package org.apache.sentry.api.service.thrift;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import com.codahale.metrics.servlets.AdminServlet;
+import com.google.common.base.Preconditions;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.EnumSet;
+import java.util.EventListener;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import com.google.common.base.Splitter;
+import com.google.common.base.Strings;
+import com.google.common.collect.Sets;
+import javax.servlet.DispatcherType;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.security.SecurityUtil;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
+import org.eclipse.jetty.security.ConstraintMapping;
+import org.eclipse.jetty.security.ConstraintSecurityHandler;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.HttpConfiguration;
+import org.eclipse.jetty.server.HttpConnectionFactory;
+import org.eclipse.jetty.server.SecureRequestCustomizer;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.server.SslConnectionFactory;
+import org.eclipse.jetty.server.handler.ContextHandler;
+import org.eclipse.jetty.server.handler.ContextHandlerCollection;
+import org.eclipse.jetty.server.handler.ResourceHandler;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.FilterHolder;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.util.resource.Resource;
+import org.eclipse.jetty.util.security.Constraint;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SentryWebServer {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(SentryWebServer.class);
+ private static final String RESOURCE_DIR = "/webapp";
+ private static final String WELCOME_PAGE = "SentryService.html";
+
+ private Server server;
+
+ public SentryWebServer(List<EventListener> listeners, int port, Configuration conf) {
+ server = new Server();
+
+ // Create a channel connector for "http/https" requests
+ ServerConnector connector;
+ if (conf.getBoolean(ServerConfig.SENTRY_WEB_USE_SSL, false)) {
+ SslContextFactory sslContextFactory = new SslContextFactory();
+ sslContextFactory.setKeyStorePath(conf.get(ServerConfig.SENTRY_WEB_SSL_KEYSTORE_PATH, ""));
+ sslContextFactory.setKeyStorePassword(
+ conf.get(ServerConfig.SENTRY_WEB_SSL_KEYSTORE_PASSWORD, ""));
+ // Exclude SSL blacklist protocols
+ sslContextFactory.setExcludeProtocols(ServerConfig.SENTRY_SSL_PROTOCOL_BLACKLIST_DEFAULT);
+ Set<String> moreExcludedSSLProtocols =
+ Sets.newHashSet(Splitter.on(",").trimResults().omitEmptyStrings()
+ .split(Strings.nullToEmpty(conf.get(ServerConfig.SENTRY_SSL_PROTOCOL_BLACKLIST))));
+ sslContextFactory.addExcludeProtocols(moreExcludedSSLProtocols.toArray(
+ new String[moreExcludedSSLProtocols.size()]));
+
+ HttpConfiguration httpConfiguration = new HttpConfiguration();
+ httpConfiguration.setSecurePort(port);
+ httpConfiguration.setSecureScheme("https");
+ httpConfiguration.addCustomizer(new SecureRequestCustomizer());
+
+ connector = new ServerConnector(
+ server,
+ new SslConnectionFactory(sslContextFactory, "http/1.1"),
+ new HttpConnectionFactory(httpConfiguration));
+
+ LOGGER.info("Now using SSL mode.");
+ } else {
+ connector = new ServerConnector(server, new HttpConnectionFactory());
+ }
+
+ connector.setPort(port);
+ server.setConnectors(new Connector[] { connector });
+
+ ServletContextHandler servletContextHandler = new ServletContextHandler();
+ ServletHolder servletHolder = new ServletHolder(AdminServlet.class);
+ servletContextHandler.addServlet(servletHolder, "/*");
+
+ for(EventListener listener:listeners) {
+ servletContextHandler.addEventListener(listener);
+ }
+
+ servletContextHandler.addServlet(new ServletHolder(ConfServlet.class), "/conf");
+
+ if (conf.getBoolean(ServerConfig.SENTRY_WEB_ADMIN_SERVLET_ENABLED,
+ ServerConfig.SENTRY_WEB_ADMIN_SERVLET_ENABLED_DEFAULT)) {
+ servletContextHandler.addServlet(
+ new ServletHolder(SentryAdminServlet.class), "/admin/*");
+ }
+ servletContextHandler.getServletContext()
+ .setAttribute(ConfServlet.CONF_CONTEXT_ATTRIBUTE, conf);
+
+ servletContextHandler.addServlet(new ServletHolder(LogLevelServlet.class), "/admin/logLevel");
+
+ if (conf.getBoolean(ServerConfig.SENTRY_WEB_PUBSUB_SERVLET_ENABLED,
+ ServerConfig.SENTRY_WEB_PUBSUB_SERVLET_ENABLED_DEFAULT)) {
+ servletContextHandler.addServlet(new ServletHolder(PubSubServlet.class), "/admin/publishMessage");
+ }
+
+ ResourceHandler resourceHandler = new ResourceHandler();
+ resourceHandler.setDirectoriesListed(true);
+ URL url = this.getClass().getResource(RESOURCE_DIR);
+ try {
+ resourceHandler.setBaseResource(Resource.newResource(url.toString()));
+ } catch (IOException e) {
+ LOGGER.error("Got exception while setBaseResource for Sentry Service web UI", e);
+ }
+ resourceHandler.setWelcomeFiles(new String[]{WELCOME_PAGE});
+ ContextHandler contextHandler= new ContextHandler();
+ contextHandler.setHandler(resourceHandler);
+
+ ContextHandlerCollection contextHandlerCollection = new ContextHandlerCollection();
+ contextHandlerCollection.setHandlers(new Handler[]{contextHandler, servletContextHandler});
+
+ String authMethod = conf.get(ServerConfig.SENTRY_WEB_SECURITY_TYPE);
+ if (!ServerConfig.SENTRY_WEB_SECURITY_TYPE_NONE.equalsIgnoreCase(authMethod)) {
+ /**
+ * SentryAuthFilter is a subclass of AuthenticationFilter and
+ * AuthenticationFilter tagged as private and unstable interface:
+ * While there are not guarantees that this interface will not change,
+ * it is fairly stable and used by other projects (ie - Oozie)
+ */
+ FilterHolder filterHolder = servletContextHandler.addFilter(SentryAuthFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
+ filterHolder.setInitParameters(loadWebAuthenticationConf(conf));
+ }
+
+ server.setHandler(disableTraceMethod(contextHandlerCollection));
+ }
+
+ /**
+ * Disables the HTTP TRACE method request which leads to Cross-Site Tracking (XST) problems.
+ *
+ * To disable it, we need to wrap the Handler (which has the HTTP TRACE enabled) with
+ * a constraint that denies access to the HTTP TRACE method.
+ *
+ * @param handler The Handler which has the HTTP TRACE enabled.
+ * @return A new Handler wrapped with the HTTP TRACE constraint and the Handler passed as parameter.
+ */
+ private Handler disableTraceMethod(Handler handler) {
+ Constraint disableTraceConstraint = new Constraint();
+ disableTraceConstraint.setName("Disable TRACE");
+ disableTraceConstraint.setAuthenticate(true);
+
+ ConstraintMapping mapping = new ConstraintMapping();
+ mapping.setConstraint(disableTraceConstraint);
+ mapping.setMethod("TRACE");
+ mapping.setPathSpec("/");
+
+ ConstraintSecurityHandler constraintSecurityHandler = new ConstraintSecurityHandler();
+ constraintSecurityHandler.addConstraintMapping(mapping);
+ constraintSecurityHandler.setHandler(handler);
+
+ return constraintSecurityHandler;
+ }
+
+ public void start() throws Exception{
+ server.start();
+ }
+ public void stop() throws Exception{
+ server.stop();
+ }
+ public boolean isAlive() {
+ return server != null && server.isStarted();
+ }
+ private static Map<String, String> loadWebAuthenticationConf(Configuration conf) {
+ Map<String,String> prop = new HashMap<String, String>();
+ prop.put(AuthenticationFilter.CONFIG_PREFIX, ServerConfig.SENTRY_WEB_SECURITY_PREFIX);
+ String allowUsers = conf.get(ServerConfig.SENTRY_WEB_SECURITY_ALLOW_CONNECT_USERS);
+ if (allowUsers == null || allowUsers.equals("")) {
+ allowUsers = conf.get(ServerConfig.ALLOW_CONNECT);
+ conf.set(ServerConfig.SENTRY_WEB_SECURITY_ALLOW_CONNECT_USERS, allowUsers);
+ }
+ validateConf(conf);
+ for (Map.Entry<String, String> entry : conf) {
+ String name = entry.getKey();
+ if (name.startsWith(ServerConfig.SENTRY_WEB_SECURITY_PREFIX)) {
+ String value = conf.get(name);
+ prop.put(name, value);
+ }
+ }
+ return prop;
+ }
+
+ private static void validateConf(Configuration conf) {
+ String authHandlerName = conf.get(ServerConfig.SENTRY_WEB_SECURITY_TYPE);
+ Preconditions.checkNotNull(authHandlerName, "Web authHandler should not be null.");
+ String allowUsers = conf.get(ServerConfig.SENTRY_WEB_SECURITY_ALLOW_CONNECT_USERS);
+ Preconditions.checkNotNull(allowUsers, "Allow connect user(s) should not be null.");
+ if (ServerConfig.SENTRY_WEB_SECURITY_TYPE_KERBEROS.equalsIgnoreCase(authHandlerName)) {
+ String principal = conf.get(ServerConfig.SENTRY_WEB_SECURITY_PRINCIPAL);
+ Preconditions.checkNotNull(principal, "Kerberos principal should not be null.");
+ Preconditions.checkArgument(principal.length() != 0, "Kerberos principal is not right.");
+ String keytabFile = conf.get(ServerConfig.SENTRY_WEB_SECURITY_KEYTAB);
+ Preconditions.checkNotNull(keytabFile, "Keytab File should not be null.");
+ Preconditions.checkArgument(keytabFile.length() != 0, "Keytab File is not right.");
+ try {
+ UserGroupInformation.setConfiguration(conf);
+ String hostPrincipal = SecurityUtil.getServerPrincipal(principal, ServerConfig.RPC_ADDRESS_DEFAULT);
+ UserGroupInformation.loginUserFromKeytab(hostPrincipal, keytabFile);
+ } catch (IOException ex) {
+ throw new IllegalArgumentException("Can't use Kerberos authentication, principal ["
+ + principal + "] keytab [" + keytabFile + "]", ex);
+ }
+ LOGGER.info("Using Kerberos authentication, principal [{}] keytab [{}]", principal, keytabFile);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SentryPolicyStorePlugin.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SentryPolicyStorePlugin.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SentryPolicyStorePlugin.java
index a22b422..8462928 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SentryPolicyStorePlugin.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SentryPolicyStorePlugin.java
@@ -22,14 +22,14 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.sentry.core.common.exception.SentryInvalidInputException;
import org.apache.sentry.core.common.exception.SentryUserException;
import org.apache.sentry.provider.db.service.persistent.SentryStore;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleAddGroupsRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleDeleteGroupsRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleGrantPrivilegeRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleRevokePrivilegeRequest;
-import org.apache.sentry.provider.db.service.thrift.TDropPrivilegesRequest;
-import org.apache.sentry.provider.db.service.thrift.TDropSentryRoleRequest;
-import org.apache.sentry.provider.db.service.thrift.TRenamePrivilegesRequest;
-import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleAddGroupsRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleDeleteGroupsRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleGrantPrivilegeRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleRevokePrivilegeRequest;
+import org.apache.sentry.api.service.thrift.TDropPrivilegesRequest;
+import org.apache.sentry.api.service.thrift.TDropSentryRoleRequest;
+import org.apache.sentry.api.service.thrift.TRenamePrivilegesRequest;
+import org.apache.sentry.api.service.thrift.TSentryPrivilege;
import java.util.Map;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SimpleDBProviderBackend.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SimpleDBProviderBackend.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SimpleDBProviderBackend.java
index 480991d..277f6b3 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SimpleDBProviderBackend.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SimpleDBProviderBackend.java
@@ -24,9 +24,9 @@ import org.apache.sentry.core.common.Authorizable;
import org.apache.sentry.core.common.exception.SentryConfigurationException;
import org.apache.sentry.provider.common.ProviderBackend;
import org.apache.sentry.provider.common.ProviderBackendContext;
-import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient;
+import org.apache.sentry.api.common.ApiConstants;
+import org.apache.sentry.api.service.thrift.SentryPolicyServiceClient;
import org.apache.sentry.service.thrift.SentryServiceClientFactory;
-import org.apache.sentry.service.thrift.ServiceConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,8 +48,8 @@ public class SimpleDBProviderBackend implements ProviderBackend {
public SimpleDBProviderBackend(Configuration conf) throws Exception {
this.conf = conf;
- this.retryCount = conf.getInt(ServiceConstants.ClientConfig.RETRY_COUNT_CONF, ServiceConstants.ClientConfig.RETRY_COUNT_DEFAULT);
- this.retryIntervalSec = conf.getInt(ServiceConstants.ClientConfig.RETRY_INTERVAL_SEC_CONF, ServiceConstants.ClientConfig.RETRY_INTERVAL_SEC_DEFAULT);
+ this.retryCount = conf.getInt(ApiConstants.ClientConfig.RETRY_COUNT_CONF, ApiConstants.ClientConfig.RETRY_COUNT_DEFAULT);
+ this.retryIntervalSec = conf.getInt(ApiConstants.ClientConfig.RETRY_INTERVAL_SEC_CONF, ApiConstants.ClientConfig.RETRY_INTERVAL_SEC_DEFAULT);
}
/**
* {@inheritDoc}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/SentryGenericProviderBackend.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/SentryGenericProviderBackend.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/SentryGenericProviderBackend.java
index fe0eb07..f8dc211 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/SentryGenericProviderBackend.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/SentryGenericProviderBackend.java
@@ -32,11 +32,11 @@ import org.apache.sentry.core.common.exception.SentryConfigurationException;
import org.apache.sentry.provider.common.CacheProvider;
import org.apache.sentry.provider.common.ProviderBackend;
import org.apache.sentry.provider.common.ProviderBackendContext;
-import org.apache.sentry.provider.db.generic.service.thrift.SentryGenericServiceClient;
-import org.apache.sentry.provider.db.generic.service.thrift.SentryGenericServiceClientFactory;
-import org.apache.sentry.provider.db.generic.service.thrift.TSentryRole;
-import org.apache.sentry.provider.db.generic.tools.TSentryPrivilegeConverter;
-import org.apache.sentry.service.thrift.ServiceConstants;
+import org.apache.sentry.api.generic.thrift.SentryGenericServiceClient;
+import org.apache.sentry.api.generic.thrift.SentryGenericServiceClientFactory;
+import org.apache.sentry.api.generic.thrift.TSentryRole;
+import org.apache.sentry.api.common.ApiConstants;
+import org.apache.sentry.api.tools.TSentryPrivilegeConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -60,10 +60,10 @@ public class SentryGenericProviderBackend extends CacheProvider implements Provi
public SentryGenericProviderBackend(Configuration conf, String resource) //NOPMD
throws Exception {
this.conf = conf;
- this.enableCaching = conf.getBoolean(ServiceConstants.ClientConfig.ENABLE_CACHING, ServiceConstants.ClientConfig.ENABLE_CACHING_DEFAULT);
- this.privilegeConverter = conf.get(ServiceConstants.ClientConfig.PRIVILEGE_CONVERTER);
- this.setServiceName(conf.get(ServiceConstants.ClientConfig.SERVICE_NAME));
- this.setComponentType(conf.get(ServiceConstants.ClientConfig.COMPONENT_TYPE));
+ this.enableCaching = conf.getBoolean(ApiConstants.ClientConfig.ENABLE_CACHING, ApiConstants.ClientConfig.ENABLE_CACHING_DEFAULT);
+ this.privilegeConverter = conf.get(ApiConstants.ClientConfig.PRIVILEGE_CONVERTER);
+ this.setServiceName(conf.get(ApiConstants.ClientConfig.SERVICE_NAME));
+ this.setComponentType(conf.get(ApiConstants.ClientConfig.COMPONENT_TYPE));
}
@Override
@@ -72,12 +72,12 @@ public class SentryGenericProviderBackend extends CacheProvider implements Provi
throw new IllegalStateException("SentryGenericProviderBackend has already been initialized, cannot be initialized twice");
}
- Preconditions.checkNotNull(serviceName, "Service name is not defined. Use configuration parameter: " + conf.get(ServiceConstants.ClientConfig.SERVICE_NAME));
- Preconditions.checkNotNull(componentType, "Component type is not defined. Use configuration parameter: " + conf.get(ServiceConstants.ClientConfig.COMPONENT_TYPE));
+ Preconditions.checkNotNull(serviceName, "Service name is not defined. Use configuration parameter: " + conf.get(ApiConstants.ClientConfig.SERVICE_NAME));
+ Preconditions.checkNotNull(componentType, "Component type is not defined. Use configuration parameter: " + conf.get(ApiConstants.ClientConfig.COMPONENT_TYPE));
if (enableCaching) {
if (privilegeConverter == null) {
- throw new SentryConfigurationException(ServiceConstants.ClientConfig.PRIVILEGE_CONVERTER + " not configured.");
+ throw new SentryConfigurationException(ApiConstants.ClientConfig.PRIVILEGE_CONVERTER + " not configured.");
}
Constructor<?> privilegeConverterConstructor;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/UpdatableCache.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/UpdatableCache.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/UpdatableCache.java
index 31fcfc7..0dd7b4a 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/UpdatableCache.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/UpdatableCache.java
@@ -17,9 +17,9 @@ import com.google.common.collect.HashBasedTable;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.sentry.provider.common.TableCache;
-import org.apache.sentry.provider.db.generic.service.thrift.*;
-import org.apache.sentry.provider.db.generic.tools.TSentryPrivilegeConverter;
-import org.apache.sentry.service.thrift.ServiceConstants;
+import org.apache.sentry.api.generic.thrift.*;
+import org.apache.sentry.api.common.ApiConstants;
+import org.apache.sentry.api.tools.TSentryPrivilegeConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -81,8 +81,8 @@ public final class UpdatableCache implements TableCache, AutoCloseable {
this.tSentryPrivilegeConverter = tSentryPrivilegeConverter;
// check caching configuration
- this.cacheTtlNs = TimeUnit.MILLISECONDS.toNanos(conf.getLong(ServiceConstants.ClientConfig.CACHE_TTL_MS, ServiceConstants.ClientConfig.CACHING_TTL_MS_DEFAULT));
- this.allowedUpdateFailuresCount = conf.getInt(ServiceConstants.ClientConfig.CACHE_UPDATE_FAILURES_BEFORE_PRIV_REVOKE, ServiceConstants.ClientConfig.CACHE_UPDATE_FAILURES_BEFORE_PRIV_REVOKE_DEFAULT);
+ this.cacheTtlNs = TimeUnit.MILLISECONDS.toNanos(conf.getLong(ApiConstants.ClientConfig.CACHE_TTL_MS, ApiConstants.ClientConfig.CACHING_TTL_MS_DEFAULT));
+ this.allowedUpdateFailuresCount = conf.getInt(ApiConstants.ClientConfig.CACHE_UPDATE_FAILURES_BEFORE_PRIV_REVOKE, ApiConstants.ClientConfig.CACHE_UPDATE_FAILURES_BEFORE_PRIV_REVOKE_DEFAULT);
}
@Override
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/persistent/DelegateSentryStore.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/persistent/DelegateSentryStore.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/persistent/DelegateSentryStore.java
index bc01c12..3026a62 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/persistent/DelegateSentryStore.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/persistent/DelegateSentryStore.java
@@ -33,10 +33,10 @@ import org.apache.sentry.provider.db.service.model.MSentryGMPrivilege;
import org.apache.sentry.provider.db.service.model.MSentryGroup;
import org.apache.sentry.provider.db.service.model.MSentryRole;
import org.apache.sentry.provider.db.service.persistent.SentryStore;
-import org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessor;
-import org.apache.sentry.provider.db.service.thrift.TSentryGroup;
-import org.apache.sentry.provider.db.service.thrift.TSentryRole;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
+import org.apache.sentry.api.service.thrift.SentryPolicyStoreProcessor;
+import org.apache.sentry.api.service.thrift.TSentryGroup;
+import org.apache.sentry.api.service.thrift.TSentryRole;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
import javax.jdo.PersistenceManager;
import java.util.Arrays;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/persistent/PrivilegeOperatePersistence.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/persistent/PrivilegeOperatePersistence.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/persistent/PrivilegeOperatePersistence.java
index 9dcfc03..876ee14 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/persistent/PrivilegeOperatePersistence.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/persistent/PrivilegeOperatePersistence.java
@@ -47,7 +47,7 @@ import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import org.apache.sentry.provider.db.service.persistent.QueryParamBuilder;
import org.apache.sentry.provider.db.service.persistent.SentryStore;
-import org.apache.sentry.service.thrift.ServiceConstants;
+import org.apache.sentry.service.common.ServiceConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/NotificationHandler.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/NotificationHandler.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/NotificationHandler.java
deleted file mode 100644
index 23731bd..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/NotificationHandler.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.generic.service.thrift;
-
-public interface NotificationHandler {
-
- void create_sentry_role(TCreateSentryRoleRequest request,
- TCreateSentryRoleResponse response);
-
- void drop_sentry_role(TDropSentryRoleRequest request,
- TDropSentryRoleResponse response);
-
- void alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request,
- TAlterSentryRoleGrantPrivilegeResponse response);
-
- void alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request,
- TAlterSentryRoleRevokePrivilegeResponse response);
-
- void alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request,
- TAlterSentryRoleAddGroupsResponse response);
-
- void alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request,
- TAlterSentryRoleDeleteGroupsResponse response);
-
- void drop_sentry_privilege(TDropPrivilegesRequest request,
- TDropPrivilegesResponse response);
-
- void rename_sentry_privilege(TRenamePrivilegesRequest request,
- TRenamePrivilegesResponse response);
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/NotificationHandlerInvoker.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/NotificationHandlerInvoker.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/NotificationHandlerInvoker.java
deleted file mode 100644
index 6a8e7f3..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/NotificationHandlerInvoker.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.generic.service.thrift;
-
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Lists;
-
-/**
- * Invokes configured instances of NotificationHandler. Importantly
- * NotificationHandler's each receive a copy of the request and
- * response thrift objects from each successful request.
- */
-public class NotificationHandlerInvoker implements NotificationHandler {
- private static final Logger LOGGER = LoggerFactory.getLogger(NotificationHandlerInvoker.class);
- private List<? extends NotificationHandler> handlers = Lists.newArrayList();
-
- public NotificationHandlerInvoker(List<? extends NotificationHandler> handlers) {
- this.handlers = handlers;
- }
- @Override
- public void create_sentry_role(TCreateSentryRoleRequest request,
- TCreateSentryRoleResponse response) {
- for (NotificationHandler handler : handlers) {
- try {
- LOGGER.debug("Calling " + handler);
- handler.create_sentry_role(new TCreateSentryRoleRequest(request),
- new TCreateSentryRoleResponse(response));
- } catch (Exception ex) {
- LOGGER.error("Unexpected error in " + handler + ". Request: "
- + request + ", Response: " + response, ex);
- }
- }
- }
-
- @Override
- public void drop_sentry_role(TDropSentryRoleRequest request,
- TDropSentryRoleResponse response) {
- for (NotificationHandler handler : handlers) {
- try {
- LOGGER.debug("Calling " + handler);
- handler.drop_sentry_role(new TDropSentryRoleRequest(request),
- new TDropSentryRoleResponse(response));
- } catch (Exception ex) {
- LOGGER.error("Unexpected error in " + handler + ". Request: "
- + request + ", Response: " + response, ex);
- }
- }
- }
-
- @Override
- public void alter_sentry_role_grant_privilege(
- TAlterSentryRoleGrantPrivilegeRequest request,
- TAlterSentryRoleGrantPrivilegeResponse response) {
- for (NotificationHandler handler : handlers) {
- try {
- LOGGER.debug("Calling " + handler);
- handler.alter_sentry_role_grant_privilege(
- new TAlterSentryRoleGrantPrivilegeRequest(request),
- new TAlterSentryRoleGrantPrivilegeResponse(response));
- } catch (Exception ex) {
- LOGGER.error("Unexpected error in " + handler + ". Request: "
- + request + ", Response: " + response, ex);
- }
- }
- }
-
- @Override
- public void alter_sentry_role_revoke_privilege(
- TAlterSentryRoleRevokePrivilegeRequest request,
- TAlterSentryRoleRevokePrivilegeResponse response) {
- for (NotificationHandler handler : handlers) {
- try {
- LOGGER.debug("Calling " + handler);
- handler.alter_sentry_role_revoke_privilege(
- new TAlterSentryRoleRevokePrivilegeRequest(request),
- new TAlterSentryRoleRevokePrivilegeResponse(response));
- } catch (Exception ex) {
- LOGGER.error("Unexpected error in " + handler + ". Request: "
- + request + ", Response: " + response, ex);
- }
- }
- }
-
- @Override
- public void alter_sentry_role_add_groups(
- TAlterSentryRoleAddGroupsRequest request,
- TAlterSentryRoleAddGroupsResponse response) {
- for (NotificationHandler handler : handlers) {
- try {
- LOGGER.debug("Calling " + handler);
- handler.alter_sentry_role_add_groups(new TAlterSentryRoleAddGroupsRequest(request),
- new TAlterSentryRoleAddGroupsResponse(response));
- } catch (Exception ex) {
- LOGGER.error("Unexpected error in " + handler + ". Request: "
- + request + ", Response: " + response, ex);
- }
- }
- }
-
- @Override
- public void alter_sentry_role_delete_groups(
- TAlterSentryRoleDeleteGroupsRequest request,
- TAlterSentryRoleDeleteGroupsResponse response) {
- for (NotificationHandler handler : handlers) {
- try {
- LOGGER.debug("Calling " + handler);
- handler.alter_sentry_role_delete_groups(new TAlterSentryRoleDeleteGroupsRequest(request),
- new TAlterSentryRoleDeleteGroupsResponse(response));
- } catch (Exception ex) {
- LOGGER.error("Unexpected error in " + handler + ". Request: "
- + request + ", Response: " + response, ex);
- }
- }
- }
- @Override
- public void drop_sentry_privilege(
- TDropPrivilegesRequest request, TDropPrivilegesResponse response) {
- for (NotificationHandler handler : handlers) {
- try {
- LOGGER.debug("Calling " + handler);
- handler.drop_sentry_privilege(new TDropPrivilegesRequest(request),
- new TDropPrivilegesResponse(response));
- } catch (Exception ex) {
- LOGGER.error("Unexpected error in " + handler + ". Request: "
- + request + ", Response: " + response, ex);
- }
- }
- }
- @Override
- public void rename_sentry_privilege(TRenamePrivilegesRequest request,
- TRenamePrivilegesResponse response) {
- for (NotificationHandler handler : handlers) {
- try {
- LOGGER.debug("Calling " + handler);
- handler.rename_sentry_privilege(new TRenamePrivilegesRequest(request),
- new TRenamePrivilegesResponse(response));
- } catch (Exception ex) {
- LOGGER.error("Unexpected error in " + handler + ". Request: "
- + request + ", Response: " + response, ex);
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericPolicyProcessor.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericPolicyProcessor.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericPolicyProcessor.java
deleted file mode 100644
index 5a36433..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericPolicyProcessor.java
+++ /dev/null
@@ -1,831 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.generic.service.thrift;
-
-import static org.apache.sentry.core.common.utils.SentryConstants.AUTHORIZABLE_JOINER;
-import static org.apache.sentry.core.common.utils.SentryConstants.KV_JOINER;
-
-import java.lang.reflect.Constructor;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.sentry.core.common.exception.SentryUserException;
-import org.apache.sentry.core.common.Authorizable;
-import org.apache.sentry.core.common.utils.SentryConstants;
-import org.apache.sentry.core.common.exception.SentrySiteConfigurationException;
-import org.apache.sentry.core.model.db.AccessConstants;
-import org.apache.sentry.core.common.utils.KeyValue;
-import org.apache.sentry.provider.common.AuthorizationComponent;
-import org.apache.sentry.core.common.exception.SentryAccessDeniedException;
-import org.apache.sentry.core.common.exception.SentryAlreadyExistsException;
-import org.apache.sentry.core.common.exception.SentryInvalidInputException;
-import org.apache.sentry.core.common.exception.SentryNoSuchObjectException;
-import org.apache.sentry.core.common.exception.SentryThriftAPIMismatchException;
-import org.apache.sentry.provider.db.generic.service.persistent.DelegateSentryStore;
-import org.apache.sentry.provider.db.generic.service.persistent.PrivilegeObject;
-import org.apache.sentry.provider.db.generic.service.persistent.PrivilegeObject.Builder;
-import org.apache.sentry.provider.db.generic.service.persistent.SentryStoreLayer;
-import org.apache.sentry.provider.db.log.entity.JsonLogEntityFactory;
-import org.apache.sentry.provider.db.log.util.Constants;
-import org.apache.sentry.provider.db.service.model.MSentryGMPrivilege;
-import org.apache.sentry.provider.db.service.model.MSentryRole;
-import org.apache.sentry.core.common.utils.PolicyStoreConstants;
-import org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessor;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
-import org.apache.sentry.service.thrift.ServiceConstants.ThriftConstants;
-import org.apache.sentry.service.thrift.ServiceConstants;
-import org.apache.sentry.service.thrift.Status;
-import org.apache.sentry.service.thrift.TSentryResponseStatus;
-import org.apache.thrift.TException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Splitter;
-import com.google.common.base.Strings;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-public class SentryGenericPolicyProcessor implements SentryGenericPolicyService.Iface {
- private static final Logger LOGGER = LoggerFactory.getLogger(SentryGenericPolicyProcessor.class);
- private static final Logger AUDIT_LOGGER = LoggerFactory
- .getLogger(Constants.AUDIT_LOGGER_NAME_GENERIC);
- private final Configuration conf;
- private final ImmutableSet<String> adminGroups;
- private final SentryStoreLayer store;
- private final NotificationHandlerInvoker handerInvoker;
-
- public static final String SENTRY_GENERIC_SERVICE_NAME = "SentryGenericPolicyService";
- private static final String ACCESS_DENIAL_MESSAGE = "Access denied to ";
-
- SentryGenericPolicyProcessor(Configuration conf) throws Exception {
- this.store = new DelegateSentryStore(conf);
- this.handerInvoker = new NotificationHandlerInvoker(createHandlers(conf));
- this.conf = conf;
- adminGroups = ImmutableSet.copyOf((Sets.newHashSet(conf.getStrings(
- ServerConfig.ADMIN_GROUPS, new String[]{}))));
- }
-
- @VisibleForTesting
- SentryGenericPolicyProcessor(Configuration conf, SentryStoreLayer store) throws Exception {
- this.store = store;
- this.handerInvoker = new NotificationHandlerInvoker(createHandlers(conf));
- this.conf = conf;
- adminGroups = ImmutableSet.copyOf(toTrimmed(Sets.newHashSet(conf.getStrings(
- ServerConfig.ADMIN_GROUPS, new String[]{}))));
- }
-
- private void authorize(String requestorUser, Set<String> requestorGroups)
- throws SentryAccessDeniedException {
- if (!inAdminGroups(requestorGroups)) {
- String msg = "User: " + requestorUser + " is part of " + requestorGroups +
- " which does not, intersect admin groups " + adminGroups;
- LOGGER.warn(msg);
- throw new SentryAccessDeniedException(ACCESS_DENIAL_MESSAGE + requestorUser);
- }
- }
-
- private Set<String> toTrimmedLower(Set<String> s) {
- if (s == null) {
- return Collections.emptySet();
- }
- Set<String> result = new HashSet<>(s.size());
- for (String v : s) {
- result.add(v.trim().toLowerCase());
- }
- return result;
- }
-
- private Set<String> toTrimmed(Set<String> s) {
- if (s == null) {
- return Collections.emptySet();
- }
- Set<String> result = new HashSet<>(s.size());
- for (String v : s) {
- result.add(v.trim());
- }
- return result;
- }
-
- private String toTrimmedLower(String s) {
- if (Strings.isNullOrEmpty(s)){
- return "";
- }
- return s.trim().toLowerCase();
- }
-
- private static Set<String> getRequestorGroups(Configuration conf, String userName) throws SentryUserException {
- return SentryPolicyStoreProcessor.getGroupsFromUserName(conf, userName);
- }
-
- private boolean inAdminGroups(Set<String> requestorGroups) {
- return !Sets.intersection(adminGroups, requestorGroups).isEmpty();
- }
-
- static List<NotificationHandler> createHandlers(Configuration conf) throws SentrySiteConfigurationException {
-
- List<NotificationHandler> handlers = Lists.newArrayList();
- Iterable<String> notificationHandlers = Splitter.onPattern("[\\s,]").trimResults()
- .omitEmptyStrings().split(conf.get(PolicyStoreConstants.SENTRY_GENERIC_POLICY_NOTIFICATION, ""));
- try {
- for (String notificationHandler : notificationHandlers) {
- handlers.add(createInstance(notificationHandler, conf, NotificationHandler.class));
- }
- } catch (Exception e) {
- throw new SentrySiteConfigurationException("Create notificationHandlers error: " + e.getMessage(), e);
- }
- return handlers;
- }
-
- @SuppressWarnings("unchecked")
- private static <T> T createInstance(String className, Configuration conf, Class<T> iface) throws Exception {
- T result;
- try {
- Class<?> clazz = Class.forName(className);
- if (!iface.isAssignableFrom(clazz)) {
- throw new IllegalArgumentException("Class " + clazz + " is not a " +
- iface.getName());
- }
- Constructor<T> meth = (Constructor<T>)clazz.getDeclaredConstructor(Configuration.class);
- meth.setAccessible(true);
- result = meth.newInstance(new Object[]{conf});
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- return result;
- }
-
- private <T> Response<T> requestHandle(RequestHandler<T> handler) {
- Response<T> response = new Response<T>();
- try {
- response = handler.handle();
- } catch (SentryAccessDeniedException e) {
- String msg = "Sentry access denied: " + e.getMessage();
- LOGGER.error(msg, e);
- response.status = Status.AccessDenied(e.getMessage(), e);
- } catch (SentryAlreadyExistsException e) {
- String msg = "Sentry object already exists: " + e.getMessage();
- LOGGER.error(msg, e);
- response.status = Status.AlreadyExists(e.getMessage(), e);
- } catch (SentryNoSuchObjectException e) {
- String msg = "Sentry object doesn't exist: " + e.getMessage();
- LOGGER.error(msg, e);
- response.status = Status.NoSuchObject(e.getMessage(), e);
- } catch (SentryInvalidInputException e) {
- String msg = "Invalid input privilege object: " + e.getMessage();
- LOGGER.error(msg, e);
- response.status = Status.InvalidInput(msg, e);
- } catch (SentryThriftAPIMismatchException e) {
- String msg = "Sentry thrift API mismatch error: " + e.getMessage();
- LOGGER.error(msg, e);
- response.status = Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e);
- } catch (Exception e) {
- String msg = "Unknown error:" + e.getMessage();
- LOGGER.error(msg, e);
- response.status = Status.RuntimeError(msg, e);
- }
- return response;
- }
-
- private PrivilegeObject toPrivilegeObject(TSentryPrivilege tSentryPrivilege) {
- Boolean grantOption;
- if (tSentryPrivilege.getGrantOption().equals(TSentryGrantOption.TRUE)) {
- grantOption = true;
- } else if (tSentryPrivilege.getGrantOption().equals(TSentryGrantOption.FALSE)) {
- grantOption = false;
- } else {
- grantOption = null;
- }
- return new Builder().setComponent(tSentryPrivilege.getComponent())
- .setService(tSentryPrivilege.getServiceName())
- .setAuthorizables(toAuthorizables(tSentryPrivilege.getAuthorizables()))
- .setAction(tSentryPrivilege.getAction())
- .withGrantOption(grantOption)
- .build();
- }
-
- private TSentryPrivilege fromPrivilegeObject(PrivilegeObject privilege) {
-
- TSentryPrivilege tPrivilege = new TSentryPrivilege(privilege.getComponent(), privilege.getService(),
- fromAuthorizable(privilege.getAuthorizables()),
- privilege.getAction());
- if (privilege.getGrantOption() == null) {
- tPrivilege.setGrantOption(TSentryGrantOption.UNSET);
- } else if (privilege.getGrantOption()) {
- tPrivilege.setGrantOption(TSentryGrantOption.TRUE);
- } else {
- tPrivilege.setGrantOption(TSentryGrantOption.FALSE);
- }
- return tPrivilege;
- }
-
- private List<TAuthorizable> fromAuthorizable(List<? extends Authorizable> authorizables) {
- List<TAuthorizable> tAuthorizables = Lists.newArrayList();
- for (Authorizable authorizable : authorizables) {
- tAuthorizables.add(new TAuthorizable(authorizable.getTypeName(), authorizable.getName()));
- }
- return tAuthorizables;
- }
-
- private String fromAuthorizableToStr(List<? extends Authorizable> authorizables) {
- if (authorizables != null && !authorizables.isEmpty()) {
- List<String> privileges = Lists.newArrayList();
-
- for (Authorizable authorizable : authorizables) {
-
- privileges.add(SentryConstants.KV_JOINER.join(authorizable.getTypeName(),
- authorizable.getName()));
- }
-
- return SentryConstants.AUTHORIZABLE_JOINER.join(privileges);
- } else {
- return "";
- }
- }
-
- private List<? extends Authorizable> toAuthorizables(List<TAuthorizable> tAuthorizables) {
- List<Authorizable> authorizables = Lists.newArrayList();
- if (tAuthorizables == null) {
- return authorizables;
- }
- for (final TAuthorizable tAuthorizable : tAuthorizables) {
- authorizables.add(new Authorizable() {
- @Override
- public String getTypeName() {
- return tAuthorizable.getType();
- }
- @Override
- public String getName() {
- return tAuthorizable.getName();
- }
- });
- }
- return authorizables;
- }
-
- private List<? extends Authorizable> toAuthorizables(String privilegeStr) {
- List<Authorizable> authorizables = Lists.newArrayList();
- if (privilegeStr == null) {
- return authorizables;
- }
-
- for (String authorizable : SentryConstants.AUTHORIZABLE_SPLITTER.split(privilegeStr)) {
- KeyValue tempKV = new KeyValue(authorizable);
- final String key = tempKV.getKey();
- final String value = tempKV.getValue();
-
- authorizables.add(new Authorizable() {
- @Override
- public String getTypeName() {
- return key;
- }
-
- @Override
- public String getName() {
- return value;
- }
- });
- }
-
- return authorizables;
- }
-
- // Construct the role to set of privileges mapping based on the
- // MSentryGMPrivilege information.
- private TSentryPrivilegeMap toTSentryPrivilegeMap(Set<MSentryGMPrivilege> mPrivileges) {
-
- // Mapping of <Role, Set<Privilege>>.
- Map<String, Set<TSentryPrivilege>> tPrivilegeMap = Maps.newTreeMap();
-
- for (MSentryGMPrivilege mPrivilege : mPrivileges) {
- for (MSentryRole role : mPrivilege.getRoles()) {
-
- TSentryPrivilege tPrivilege = toTSentryPrivilege(mPrivilege);
-
- if (tPrivilegeMap.containsKey(role.getRoleName())) {
- tPrivilegeMap.get(role.getRoleName()).add(tPrivilege);
- } else {
- Set<TSentryPrivilege> tPrivilegeSet = Sets.newTreeSet();
- tPrivilegeSet.add(tPrivilege);
- tPrivilegeMap.put(role.getRoleName(), tPrivilegeSet);
- }
- }
- }
-
- return new TSentryPrivilegeMap(tPrivilegeMap);
- }
-
- // Construct TSentryPrivilege based on MSentryGMPrivilege information.
- private TSentryPrivilege toTSentryPrivilege(MSentryGMPrivilege mPrivilege) {
-
- TSentryPrivilege tPrivilege = new TSentryPrivilege(mPrivilege.getComponentName(),
- mPrivilege.getServiceName(), fromAuthorizable(mPrivilege.getAuthorizables()), mPrivilege.getAction());
-
- if (mPrivilege.getGrantOption() == null) {
- tPrivilege.setGrantOption(TSentryGrantOption.UNSET);
- } else if (mPrivilege.getGrantOption()) {
- tPrivilege.setGrantOption(TSentryGrantOption.TRUE);
- } else {
- tPrivilege.setGrantOption(TSentryGrantOption.FALSE);
- }
-
- return tPrivilege;
- }
-
- private Set<String> buildPermissions(Set<PrivilegeObject> privileges) {
- Set<String> permissions = Sets.newHashSet();
- for (PrivilegeObject privilege : privileges) {
- List<String> hierarchy = Lists.newArrayList();
- if (hasComponentServerPrivilege(privilege.getComponent())) {
- hierarchy.add(KV_JOINER.join("server", privilege.getService()));
- }
- for (Authorizable authorizable : privilege.getAuthorizables()) {
- hierarchy.add(KV_JOINER.join(authorizable.getTypeName(),authorizable.getName()));
- }
- hierarchy.add(KV_JOINER.join("action", privilege.getAction()));
- permissions.add(AUTHORIZABLE_JOINER.join(hierarchy));
- }
- return permissions;
- }
-
- private boolean hasComponentServerPrivilege(String component) {
- //judge the component whether has the server privilege, for example: sqoop has the privilege on the server
- return AuthorizationComponent.SQOOP.equalsIgnoreCase(component);
- }
-
- @Override
- public TCreateSentryRoleResponse create_sentry_role(
- final TCreateSentryRoleRequest request) throws TException {
- Response<Void> respose = requestHandle(new RequestHandler<Void>() {
- @Override
- public Response<Void> handle() throws Exception {
- validateClientVersion(request.getProtocol_version());
- authorize(request.getRequestorUserName(),
- getRequestorGroups(conf, request.getRequestorUserName()));
- store.createRole(request.getComponent(), request.getRoleName(),
- request.getRequestorUserName());
- return new Response<Void>(Status.OK());
- }
- });
-
- TCreateSentryRoleResponse tResponse = new TCreateSentryRoleResponse(respose.status);
- if (Status.OK.getCode() == respose.status.getValue()) {
- handerInvoker.create_sentry_role(request, tResponse);
- }
-
- try {
- AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
- .createJsonLogEntity(request, tResponse, conf).toJsonFormatLog());
- } catch (Exception e) {
- // if any exception, log the exception.
- String msg = "Error in creating audit log for create role: " + e.getMessage();
- LOGGER.error(msg, e);
- }
- return tResponse;
- }
-
- @Override
- public TDropSentryRoleResponse drop_sentry_role(final TDropSentryRoleRequest request)
- throws TException {
- Response<Void> respose = requestHandle(new RequestHandler<Void>() {
- @Override
- public Response<Void> handle() throws Exception {
- validateClientVersion(request.getProtocol_version());
- authorize(request.getRequestorUserName(),
- getRequestorGroups(conf, request.getRequestorUserName()));
- store.dropRole(request.getComponent(), request.getRoleName(),
- request.getRequestorUserName());
- return new Response<Void>(Status.OK());
- }
- });
-
- TDropSentryRoleResponse tResponse = new TDropSentryRoleResponse(respose.status);
- if (Status.OK.getCode() == respose.status.getValue()) {
- handerInvoker.drop_sentry_role(request, tResponse);
- }
-
- try {
- AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
- .createJsonLogEntity(request, tResponse, conf).toJsonFormatLog());
- } catch (Exception e) {
- // if any exception, log the exception.
- String msg = "Error in creating audit log for drop role: " + e.getMessage();
- LOGGER.error(msg, e);
- }
- return tResponse;
- }
-
- @Override
- public TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(
- final TAlterSentryRoleGrantPrivilegeRequest request) throws TException {
- Response<Void> respose = requestHandle(new RequestHandler<Void>() {
- @Override
- public Response<Void> handle() throws Exception {
- validateClientVersion(request.getProtocol_version());
- store.alterRoleGrantPrivilege(request.getComponent(),
- request.getRoleName(),
- toPrivilegeObject(request.getPrivilege()),
- request.getRequestorUserName());
- return new Response<Void>(Status.OK());
- }
- });
-
- TAlterSentryRoleGrantPrivilegeResponse tResponse = new TAlterSentryRoleGrantPrivilegeResponse(respose.status);
- if (Status.OK.getCode() == respose.status.getValue()) {
- handerInvoker.alter_sentry_role_grant_privilege(request, tResponse);
- }
-
- try {
- AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
- .createJsonLogEntity(request, tResponse, conf).toJsonFormatLog());
- } catch (Exception e) {
- // if any exception, log the exception.
- String msg = "Error in creating audit log for grant privilege to role: " + e.getMessage();
- LOGGER.error(msg, e);
- }
- return tResponse;
- }
-
- @Override
- public TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(
- final TAlterSentryRoleRevokePrivilegeRequest request) throws TException {
- Response<Void> respose = requestHandle(new RequestHandler<Void>() {
- @Override
- public Response<Void> handle() throws Exception {
- validateClientVersion(request.getProtocol_version());
- store.alterRoleRevokePrivilege(request.getComponent(),
- request.getRoleName(),
- toPrivilegeObject(request.getPrivilege()),
- request.getRequestorUserName());
- return new Response<Void>(Status.OK());
- }
- });
-
- TAlterSentryRoleRevokePrivilegeResponse tResponse =
- new TAlterSentryRoleRevokePrivilegeResponse(respose.status);
- if (Status.OK.getCode() == respose.status.getValue()) {
- handerInvoker.alter_sentry_role_revoke_privilege(request, tResponse);
- }
-
- try {
- AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
- .createJsonLogEntity(request, tResponse, conf).toJsonFormatLog());
- } catch (Exception e) {
- // if any exception, log the exception.
- String msg = "Error in creating audit log for revoke privilege from role: " + e.getMessage();
- LOGGER.error(msg, e);
- }
- return tResponse;
- }
-
- @Override
- public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(
- final TAlterSentryRoleAddGroupsRequest request) throws TException {
- Response<Void> respose = requestHandle(new RequestHandler<Void>() {
- @Override
- public Response<Void> handle() throws Exception {
- validateClientVersion(request.getProtocol_version());
- authorize(request.getRequestorUserName(),
- getRequestorGroups(conf, request.getRequestorUserName()));
- store.alterRoleAddGroups(request.getComponent(),
- request.getRoleName(),
- request.getGroups(),
- request.getRequestorUserName());
- return new Response<Void>(Status.OK());
- }
- });
-
- TAlterSentryRoleAddGroupsResponse tResponse =
- new TAlterSentryRoleAddGroupsResponse(respose.status);
- if (Status.OK.getCode() == respose.status.getValue()) {
- handerInvoker.alter_sentry_role_add_groups(request, tResponse);
- }
-
- try {
- AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
- .createJsonLogEntity(request, tResponse, conf).toJsonFormatLog());
- } catch (Exception e) {
- // if any exception, log the exception.
- String msg = "Error in creating audit log for add role to group: " + e.getMessage();
- LOGGER.error(msg, e);
- }
- return tResponse;
- }
-
- @Override
- public TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(
- final TAlterSentryRoleDeleteGroupsRequest request) throws TException {
- Response<Void> respose = requestHandle(new RequestHandler<Void>() {
- @Override
- public Response<Void> handle() throws Exception {
- validateClientVersion(request.getProtocol_version());
- authorize(request.getRequestorUserName(),
- getRequestorGroups(conf, request.getRequestorUserName()));
- store.alterRoleDeleteGroups(request.getComponent(),
- request.getRoleName(),
- request.getGroups(),
- request.getRequestorUserName());
- return new Response<Void>(Status.OK());
- }
- });
-
- TAlterSentryRoleDeleteGroupsResponse tResponse =
- new TAlterSentryRoleDeleteGroupsResponse(respose.status);
- if (Status.OK.getCode() == respose.status.getValue()) {
- handerInvoker.alter_sentry_role_delete_groups(request, tResponse);
- }
-
- try {
- AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
- .createJsonLogEntity(request, tResponse, conf).toJsonFormatLog());
- } catch (Exception e) {
- // if any exception, log the exception.
- String msg = "Error in creating audit log for delete role from group: " +
- e.getMessage();
- LOGGER.error(msg, e);
- }
- return tResponse;
- }
-
- @Override
- public TListSentryRolesResponse list_sentry_roles_by_group(
- final TListSentryRolesRequest request) throws TException {
- Response<Set<TSentryRole>> respose = requestHandle(new RequestHandler<Set<TSentryRole>>() {
- @Override
- public Response<Set<TSentryRole>> handle() throws Exception {
- validateClientVersion(request.getProtocol_version());
- Set<String> groups = getRequestorGroups(conf, request.getRequestorUserName());
- if (!AccessConstants.ALL.equalsIgnoreCase(request.getGroupName())) {
- boolean admin = inAdminGroups(groups);
- //Only admin users can list all roles in the system ( groupname = null)
- //Non admin users are only allowed to list only groups which they belong to
- if(!admin && (request.getGroupName() == null || !groups.contains(request.getGroupName()))) {
- throw new SentryAccessDeniedException(ACCESS_DENIAL_MESSAGE + request.getRequestorUserName());
- }
- groups.clear();
- groups.add(request.getGroupName());
- }
-
- Set<String> roleNames = store.getRolesByGroups(request.getComponent(), groups);
- Set<TSentryRole> tSentryRoles = Sets.newHashSet();
- for (String roleName : roleNames) {
- Set<String> groupsForRoleName = store.getGroupsByRoles(request.getComponent(), Sets.newHashSet(roleName));
- tSentryRoles.add(new TSentryRole(roleName, groupsForRoleName));
- }
- return new Response<Set<TSentryRole>>(Status.OK(), tSentryRoles);
- }
- });
- TListSentryRolesResponse tResponse = new TListSentryRolesResponse();
- tResponse.setStatus(respose.status);
- tResponse.setRoles(respose.content);
- return tResponse;
- }
-
- @Override
- public TListSentryPrivilegesResponse list_sentry_privileges_by_role(
- final TListSentryPrivilegesRequest request) throws TException {
- Response<Set<TSentryPrivilege>> respose = requestHandle(new RequestHandler<Set<TSentryPrivilege>>() {
- @Override
- public Response<Set<TSentryPrivilege>> handle() throws Exception {
- validateClientVersion(request.getProtocol_version());
- Set<String> groups = getRequestorGroups(conf, request.getRequestorUserName());
- if (!inAdminGroups(groups)) {
- Set<String> roleNamesForGroups = toTrimmedLower(store.getRolesByGroups(request.getComponent(), groups));
- if (!roleNamesForGroups.contains(toTrimmedLower(request.getRoleName()))) {
- throw new SentryAccessDeniedException(ACCESS_DENIAL_MESSAGE + request.getRequestorUserName());
- }
- }
- Set<PrivilegeObject> privileges = store.getPrivilegesByProvider(request.getComponent(),
- request.getServiceName(),
- Sets.newHashSet(request.getRoleName()),
- null, toAuthorizables(request.getAuthorizables()));
- Set<TSentryPrivilege> tSentryPrivileges = Sets.newHashSet();
- for (PrivilegeObject privilege : privileges) {
- tSentryPrivileges.add(fromPrivilegeObject(privilege));
- }
- return new Response<Set<TSentryPrivilege>>(Status.OK(), tSentryPrivileges);
- }
- });
- TListSentryPrivilegesResponse tResponse = new TListSentryPrivilegesResponse();
- tResponse.setStatus(respose.status);
- tResponse.setPrivileges(respose.content);
- return tResponse;
- }
-
- @Override
- public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(
- final TListSentryPrivilegesForProviderRequest request) throws TException {
- Response<Set<String>> respose = requestHandle(new RequestHandler<Set<String>>() {
- @Override
- public Response<Set<String>> handle() throws Exception {
- validateClientVersion(request.getProtocol_version());
- Set<String> activeRoleNames = toTrimmedLower(request.getRoleSet().getRoles());
- Set<String> roleNamesForGroups = store.getRolesByGroups(request.getComponent(), request.getGroups());
- Set<String> rolesToQuery = request.getRoleSet().isAll() ? roleNamesForGroups : Sets.intersection(activeRoleNames, roleNamesForGroups);
- Set<PrivilegeObject> privileges = store.getPrivilegesByProvider(request.getComponent(),
- request.getServiceName(),
- rolesToQuery, null,
- toAuthorizables(request.getAuthorizables()));
- return new Response<Set<String>>(Status.OK(), buildPermissions(privileges));
- }
- });
- TListSentryPrivilegesForProviderResponse tResponse = new TListSentryPrivilegesForProviderResponse();
- tResponse.setStatus(respose.status);
- tResponse.setPrivileges(respose.content);
- return tResponse;
- }
-
- @Override
- public TListSentryPrivilegesByAuthResponse list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request) throws TException {
-
- TListSentryPrivilegesByAuthResponse response = new TListSentryPrivilegesByAuthResponse();
- Map<String, TSentryPrivilegeMap> authRoleMap = Maps.newHashMap();
-
- // Group names are case sensitive.
- Set<String> requestedGroups = request.getGroups();
- String subject = request.getRequestorUserName();
- TSentryActiveRoleSet activeRoleSet = request.getRoleSet();
- Set<String> validActiveRoles = Sets.newHashSet();
-
- try {
- validateClientVersion(request.getProtocol_version());
- Set<String> memberGroups = getRequestorGroups(conf, subject);
-
- // Disallow non-admin users to lookup groups that
- // they are not part of.
- if(!inAdminGroups(memberGroups)) {
-
- if (requestedGroups != null && !requestedGroups.isEmpty()) {
- for (String requestedGroup : requestedGroups) {
-
- // If user doesn't belong to one of the requested groups,
- // then raise security exception.
- if (!memberGroups.contains(requestedGroup)) {
- throw new SentryAccessDeniedException(ACCESS_DENIAL_MESSAGE + subject);
- }
- }
- } else {
- // Non-admin's search is limited to its own groups.
- requestedGroups = memberGroups;
- }
-
- Set<String> grantedRoles = toTrimmedLower(store.getRolesByGroups(request.getComponent(), requestedGroups));
-
- // If activeRoleSet is not null, disallow non-admin to lookup roles that they are not part of.
- if (activeRoleSet != null && !activeRoleSet.isAll()) {
-
- Set<String> activeRoleNames = toTrimmedLower(activeRoleSet.getRoles());
- for (String activeRole : activeRoleNames) {
- if (!grantedRoles.contains(activeRole)) {
- throw new SentryAccessDeniedException(ACCESS_DENIAL_MESSAGE
- + subject);
- }
- }
-
- // For non-admin, valid active roles are intersection of active roles and granted roles.
- validActiveRoles.addAll(activeRoleSet.isAll() ? grantedRoles : Sets.intersection(activeRoleNames, grantedRoles));
- } else {
- // For non-admin, if activeRoleSet is null, valid active roles would be the granted roles.
- validActiveRoles.addAll(grantedRoles);
- }
- } else {
- // For admin, if requestedGroups are empty, requested roles will be all roles.
- Set<String> requestedRoles = toTrimmedLower(store.getAllRoleNames());
- if (requestedGroups != null && !requestedGroups.isEmpty()) {
- requestedRoles = toTrimmedLower(store.getRolesByGroups(request.getComponent(), requestedGroups));
- }
-
- // If activeRoleSet (which is optional) is not null, valid active role will be intersection
- // of active roles and requested roles. Otherwise, valid active roles are the requested roles.
- if (activeRoleSet != null && !activeRoleSet.isAll()) {
- validActiveRoles.addAll(Sets.intersection(toTrimmedLower(activeRoleSet.getRoles()), requestedRoles));
- } else {
- validActiveRoles.addAll(requestedRoles);
- }
- }
-
- // If user is not part of any group.. return empty response
- if (request.getAuthorizablesSet() != null) {
- for (String authorizablesStr : request.getAuthorizablesSet()) {
-
- List<? extends Authorizable> authorizables = toAuthorizables(authorizablesStr);
- Set<MSentryGMPrivilege> sentryPrivileges = store.getPrivilegesByAuthorizable(request.getComponent(), request.getServiceName(), validActiveRoles, authorizables);
- authRoleMap.put(fromAuthorizableToStr(authorizables), toTSentryPrivilegeMap(sentryPrivileges));
- }
- }
-
- response.setPrivilegesMapByAuth(authRoleMap);
- response.setStatus(Status.OK());
- } catch (SentryAccessDeniedException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryThriftAPIMismatchException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
- } catch (Exception e) {
- String msg = "Unknown error for request: " + request + ", message: "
- + e.getMessage();
- LOGGER.error(msg, e);
- response.setStatus(Status.RuntimeError(msg, e));
- }
-
- return response;
- }
-
- @Override
- public TDropPrivilegesResponse drop_sentry_privilege(
- final TDropPrivilegesRequest request) throws TException {
- Response<Void> respose = requestHandle(new RequestHandler<Void>() {
- @Override
- public Response<Void> handle() throws Exception {
- validateClientVersion(request.getProtocol_version());
- authorize(request.getRequestorUserName(),
- getRequestorGroups(conf, request.getRequestorUserName()));
- store.dropPrivilege(request.getComponent(),
- toPrivilegeObject(request.getPrivilege()),
- request.getRequestorUserName());
- return new Response<Void>(Status.OK());
- }
- });
-
- TDropPrivilegesResponse tResponse = new TDropPrivilegesResponse(respose.status);
- if (Status.OK.getCode() == respose.status.getValue()) {
- handerInvoker.drop_sentry_privilege(request, tResponse);
- }
- return tResponse;
- }
-
- @Override
- public TRenamePrivilegesResponse rename_sentry_privilege(
- final TRenamePrivilegesRequest request) throws TException {
- Response<Void> respose = requestHandle(new RequestHandler<Void>() {
- @Override
- public Response<Void> handle() throws Exception {
- validateClientVersion(request.getProtocol_version());
- authorize(request.getRequestorUserName(),
- getRequestorGroups(conf, request.getRequestorUserName()));
- store.renamePrivilege(request.getComponent(), request.getServiceName(),
- toAuthorizables(request.getOldAuthorizables()),
- toAuthorizables(request.getNewAuthorizables()),
- request.getRequestorUserName());
- return new Response<Void>(Status.OK());
- }
- });
-
- TRenamePrivilegesResponse tResponse = new TRenamePrivilegesResponse(respose.status);
- if (Status.OK.getCode() == respose.status.getValue()) {
- handerInvoker.rename_sentry_privilege(request, tResponse);
- }
- return tResponse;
- }
-
- private static class Response<T> {
- private TSentryResponseStatus status;
- private T content;
-
- Response() {
- }
-
- Response(TSentryResponseStatus status) {
- this(status, null);
- }
-
- Response(TSentryResponseStatus status, T content) {
- this.status = status;
- this.content = content;
- }
- }
- private interface RequestHandler <T>{
- Response<T> handle() throws Exception ;
- }
-
- private static void validateClientVersion(int protocolVersion) throws SentryThriftAPIMismatchException {
- if (ServiceConstants.ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT != protocolVersion) {
- String msg = "Sentry thrift API protocol version mismatch: Client thrift version " +
- "is: " + protocolVersion + " , server thrift version " +
- "is " + ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT;
- throw new SentryThriftAPIMismatchException(msg);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericPolicyProcessorFactory.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericPolicyProcessorFactory.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericPolicyProcessorFactory.java
deleted file mode 100644
index 9fb1de6..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericPolicyProcessorFactory.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.generic.service.thrift;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.sentry.provider.db.service.persistent.SentryStore;
-import org.apache.sentry.service.thrift.ProcessorFactory;
-import org.apache.thrift.TMultiplexedProcessor;
-import org.apache.thrift.TProcessor;
-
-public class SentryGenericPolicyProcessorFactory extends ProcessorFactory {
-
- public SentryGenericPolicyProcessorFactory(Configuration conf) {
- super(conf);
- }
-
- @Override
- public boolean register(TMultiplexedProcessor multiplexedProcessor,
- SentryStore _) throws Exception {
- SentryGenericPolicyProcessor processHandler = new SentryGenericPolicyProcessor(conf);
- TProcessor processor = new SentryGenericPolicyProcessorWrapper<SentryGenericPolicyService.Iface>(
- processHandler);
- multiplexedProcessor.registerProcessor(
- SentryGenericPolicyProcessor.SENTRY_GENERIC_SERVICE_NAME, processor);
- return true;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericPolicyProcessorWrapper.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericPolicyProcessorWrapper.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericPolicyProcessorWrapper.java
deleted file mode 100644
index a0fc2cc..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericPolicyProcessorWrapper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.generic.service.thrift;
-
-import org.apache.sentry.core.common.utils.ThriftUtil;
-import org.apache.thrift.TException;
-import org.apache.thrift.protocol.TProtocol;
-
-public class SentryGenericPolicyProcessorWrapper<I extends SentryGenericPolicyService.Iface>
- extends SentryGenericPolicyService.Processor<SentryGenericPolicyService.Iface> {
-
- public SentryGenericPolicyProcessorWrapper(I iface) {
- super(iface);
- }
-
- @Override
- public boolean process(TProtocol in, TProtocol out) throws TException {
- // set the ip and impersonator for audit log
- ThriftUtil.setIpAddress(in);
- ThriftUtil.setImpersonator(in);
- return super.process(in, out);
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericServiceClient.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericServiceClient.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericServiceClient.java
deleted file mode 100644
index dd49952..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericServiceClient.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.generic.service.thrift;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.sentry.core.common.exception.SentryUserException;
-import org.apache.sentry.core.common.ActiveRoleSet;
-import org.apache.sentry.core.common.Authorizable;
-
-public interface SentryGenericServiceClient extends AutoCloseable {
-
- /**
- * Create a sentry role
- * @param requestorUserName: user on whose behalf the request is issued
- * @param roleName: Name of the role
- * @param component: The request is issued to which component
- * @throws SentryUserException
- */
- void createRole(String requestorUserName, String roleName,
- String component) throws SentryUserException;
-
- void createRoleIfNotExist(String requestorUserName,
- String roleName, String component) throws SentryUserException;
-
- /**
- * Drop a sentry role
- * @param requestorUserName: user on whose behalf the request is issued
- * @param roleName: Name of the role
- * @param component: The request is issued to which component
- * @throws SentryUserException
- */
- void dropRole(String requestorUserName, String roleName,
- String component) throws SentryUserException;
-
- void dropRoleIfExists(String requestorUserName, String roleName,
- String component) throws SentryUserException;
-
- /**
- * Grant a sentry role to groups.
- * @param requestorUserName: user on whose behalf the request is issued
- * @param roleName: Name of the role
- * @param component: The request is issued to which component
- * @param groups: The name of groups
- * @throws SentryUserException
- */
- void grantRoleToGroups(String requestorUserName, String roleName,
- String component, Set<String> groups) throws SentryUserException;
-
- /**
- * revoke a sentry role from groups.
- * @param requestorUserName: user on whose behalf the request is issued
- * @param roleName: Name of the role
- * @param component: The request is issued to which component
- * @param groups: The name of groups
- * @throws SentryUserException
- */
- void revokeRoleFromGroups(String requestorUserName, String roleName,
- String component, Set<String> groups) throws SentryUserException;
-
- /**
- * grant privilege
- * @param requestorUserName: user on whose behalf the request is issued
- * @param roleName: Name of the role
- * @param component: The request is issued to which component
- * @param privilege
- * @throws SentryUserException
- */
- void grantPrivilege(String requestorUserName, String roleName,
- String component, TSentryPrivilege privilege) throws SentryUserException;
-
- /**
- * revoke privilege
- * @param requestorUserName: user on whose behalf the request is issued
- * @param roleName: Name of the role
- * @param component: The request is issued to which component
- * @param privilege
- * @throws SentryUserException
- */
- void revokePrivilege(String requestorUserName, String roleName,
- String component, TSentryPrivilege privilege) throws SentryUserException;
-
- /**
- * drop privilege
- * @param requestorUserName: user on whose behalf the request is issued
- * @param component: The request is issued to which component
- * @param privilege
- * @throws SentryUserException
- */
- void dropPrivilege(String requestorUserName, String component,
- TSentryPrivilege privilege) throws SentryUserException;
-
- /**
- * rename privilege
- * @param requestorUserName: user on whose behalf the request is issued
- * @param component: The request is issued to which component
- * @param serviceName: The Authorizable belongs to which service
- * @param oldAuthorizables
- * @param newAuthorizables
- * @throws SentryUserException
- */
- void renamePrivilege(String requestorUserName, String component,
- String serviceName, List<? extends Authorizable> oldAuthorizables,
- List<? extends Authorizable> newAuthorizables) throws SentryUserException;
-
- /**
- * Gets sentry role objects for a given groupName using the Sentry service
- * @param requestorUserName : user on whose behalf the request is issued
- * @param groupName : groupName to look up ( if null returns all roles for groups related to requestorUserName)
- * @param component: The request is issued to which component
- * @return Set of thrift sentry role objects
- * @throws SentryUserException
- */
- Set<TSentryRole> listRolesByGroupName(
- String requestorUserName,
- String groupName,
- String component)
- throws SentryUserException;
-
- Set<TSentryRole> listUserRoles(String requestorUserName, String component)
- throws SentryUserException;
-
- Set<TSentryRole> listAllRoles(String requestorUserName, String component)
- throws SentryUserException;
-
- /**
- * Gets sentry privileges for a given roleName and Authorizable Hierarchy using the Sentry service
- * @param requestorUserName: user on whose behalf the request is issued
- * @param roleName:
- * @param component: The request is issued to which component
- * @param serviceName
- * @param authorizables
- * @return
- * @throws SentryUserException
- */
- Set<TSentryPrivilege> listPrivilegesByRoleName(
- String requestorUserName, String roleName, String component,
- String serviceName, List<? extends Authorizable> authorizables)
- throws SentryUserException;
-
- Set<TSentryPrivilege> listAllPrivilegesByRoleName(
- String requestorUserName, String roleName, String component,
- String serviceName) throws SentryUserException;
-
- /**
- * get sentry permissions from provider as followings:
- * @param: component: The request is issued to which component
- * @param: serviceName: The privilege belongs to which service
- * @param: roleSet
- * @param: groupNames
- * @param: the authorizables
- * @returns the set of permissions
- * @throws SentryUserException
- */
- Set<String> listPrivilegesForProvider(String component,
- String serviceName, ActiveRoleSet roleSet, Set<String> groups,
- List<? extends Authorizable> authorizables) throws SentryUserException;
-
- /**
- * Get sentry privileges based on valid active roles and the authorize objects. Note that
- * it is client responsibility to ensure the requestor username, etc. is not impersonated.
- *
- * @param component: The request respond to which component.
- * @param serviceName: The name of service.
- * @param requestorUserName: The requestor user name.
- * @param authorizablesSet: The set of authorize objects. One authorize object is represented
- * as a string. e.g resourceType1=resourceName1->resourceType2=resourceName2->resourceType3=resourceName3.
- * @param groups: The requested groups.
- * @param roleSet: The active roles set.
- *
- * @returns The mapping of authorize objects and TSentryPrivilegeMap(<role, set<privileges>).
- * @throws SentryUserException
- */
- Map<String, TSentryPrivilegeMap> listPrivilegesbyAuthorizable(String component,
- String serviceName, String requestorUserName, Set<String> authorizablesSet,
- Set<String> groups, ActiveRoleSet roleSet) throws SentryUserException;
-}
[27/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilegeMap.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilegeMap.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilegeMap.java
deleted file mode 100644
index 6577cb5..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilegeMap.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/**
- * 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.provider.db.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 TSentryPrivilegeMap implements org.apache.thrift.TBase<TSentryPrivilegeMap, TSentryPrivilegeMap._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryPrivilegeMap> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryPrivilegeMap");
-
- private static final org.apache.thrift.protocol.TField PRIVILEGE_MAP_FIELD_DESC = new org.apache.thrift.protocol.TField("privilegeMap", org.apache.thrift.protocol.TType.MAP, (short)1);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryPrivilegeMapStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryPrivilegeMapTupleSchemeFactory());
- }
-
- private Map<String,Set<TSentryPrivilege>> privilegeMap; // 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 {
- PRIVILEGE_MAP((short)1, "privilegeMap");
-
- 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: // PRIVILEGE_MAP
- return PRIVILEGE_MAP;
- 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.PRIVILEGE_MAP, new org.apache.thrift.meta_data.FieldMetaData("privilegeMap", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class)))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryPrivilegeMap.class, metaDataMap);
- }
-
- public TSentryPrivilegeMap() {
- }
-
- public TSentryPrivilegeMap(
- Map<String,Set<TSentryPrivilege>> privilegeMap)
- {
- this();
- this.privilegeMap = privilegeMap;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryPrivilegeMap(TSentryPrivilegeMap other) {
- if (other.isSetPrivilegeMap()) {
- Map<String,Set<TSentryPrivilege>> __this__privilegeMap = new HashMap<String,Set<TSentryPrivilege>>(other.privilegeMap.size());
- for (Map.Entry<String, Set<TSentryPrivilege>> other_element : other.privilegeMap.entrySet()) {
-
- String other_element_key = other_element.getKey();
- Set<TSentryPrivilege> other_element_value = other_element.getValue();
-
- String __this__privilegeMap_copy_key = other_element_key;
-
- Set<TSentryPrivilege> __this__privilegeMap_copy_value = new HashSet<TSentryPrivilege>(other_element_value.size());
- for (TSentryPrivilege other_element_value_element : other_element_value) {
- __this__privilegeMap_copy_value.add(new TSentryPrivilege(other_element_value_element));
- }
-
- __this__privilegeMap.put(__this__privilegeMap_copy_key, __this__privilegeMap_copy_value);
- }
- this.privilegeMap = __this__privilegeMap;
- }
- }
-
- public TSentryPrivilegeMap deepCopy() {
- return new TSentryPrivilegeMap(this);
- }
-
- @Override
- public void clear() {
- this.privilegeMap = null;
- }
-
- public int getPrivilegeMapSize() {
- return (this.privilegeMap == null) ? 0 : this.privilegeMap.size();
- }
-
- public void putToPrivilegeMap(String key, Set<TSentryPrivilege> val) {
- if (this.privilegeMap == null) {
- this.privilegeMap = new HashMap<String,Set<TSentryPrivilege>>();
- }
- this.privilegeMap.put(key, val);
- }
-
- public Map<String,Set<TSentryPrivilege>> getPrivilegeMap() {
- return this.privilegeMap;
- }
-
- public void setPrivilegeMap(Map<String,Set<TSentryPrivilege>> privilegeMap) {
- this.privilegeMap = privilegeMap;
- }
-
- public void unsetPrivilegeMap() {
- this.privilegeMap = null;
- }
-
- /** Returns true if field privilegeMap is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivilegeMap() {
- return this.privilegeMap != null;
- }
-
- public void setPrivilegeMapIsSet(boolean value) {
- if (!value) {
- this.privilegeMap = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case PRIVILEGE_MAP:
- if (value == null) {
- unsetPrivilegeMap();
- } else {
- setPrivilegeMap((Map<String,Set<TSentryPrivilege>>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PRIVILEGE_MAP:
- return getPrivilegeMap();
-
- }
- 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 PRIVILEGE_MAP:
- return isSetPrivilegeMap();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryPrivilegeMap)
- return this.equals((TSentryPrivilegeMap)that);
- return false;
- }
-
- public boolean equals(TSentryPrivilegeMap that) {
- if (that == null)
- return false;
-
- boolean this_present_privilegeMap = true && this.isSetPrivilegeMap();
- boolean that_present_privilegeMap = true && that.isSetPrivilegeMap();
- if (this_present_privilegeMap || that_present_privilegeMap) {
- if (!(this_present_privilegeMap && that_present_privilegeMap))
- return false;
- if (!this.privilegeMap.equals(that.privilegeMap))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List<Object> list = new ArrayList<Object>();
-
- boolean present_privilegeMap = true && (isSetPrivilegeMap());
- list.add(present_privilegeMap);
- if (present_privilegeMap)
- list.add(privilegeMap);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryPrivilegeMap other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetPrivilegeMap()).compareTo(other.isSetPrivilegeMap());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivilegeMap()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilegeMap, other.privilegeMap);
- 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("TSentryPrivilegeMap(");
- boolean first = true;
-
- sb.append("privilegeMap:");
- if (this.privilegeMap == null) {
- sb.append("null");
- } else {
- sb.append(this.privilegeMap);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetPrivilegeMap()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilegeMap' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TSentryPrivilegeMapStandardSchemeFactory implements SchemeFactory {
- public TSentryPrivilegeMapStandardScheme getScheme() {
- return new TSentryPrivilegeMapStandardScheme();
- }
- }
-
- private static class TSentryPrivilegeMapStandardScheme extends StandardScheme<TSentryPrivilegeMap> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryPrivilegeMap 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: // PRIVILEGE_MAP
- if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
- {
- org.apache.thrift.protocol.TMap _map112 = iprot.readMapBegin();
- struct.privilegeMap = new HashMap<String,Set<TSentryPrivilege>>(2*_map112.size);
- String _key113;
- Set<TSentryPrivilege> _val114;
- for (int _i115 = 0; _i115 < _map112.size; ++_i115)
- {
- _key113 = iprot.readString();
- {
- org.apache.thrift.protocol.TSet _set116 = iprot.readSetBegin();
- _val114 = new HashSet<TSentryPrivilege>(2*_set116.size);
- TSentryPrivilege _elem117;
- for (int _i118 = 0; _i118 < _set116.size; ++_i118)
- {
- _elem117 = new TSentryPrivilege();
- _elem117.read(iprot);
- _val114.add(_elem117);
- }
- iprot.readSetEnd();
- }
- struct.privilegeMap.put(_key113, _val114);
- }
- iprot.readMapEnd();
- }
- struct.setPrivilegeMapIsSet(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, TSentryPrivilegeMap struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.privilegeMap != null) {
- oprot.writeFieldBegin(PRIVILEGE_MAP_FIELD_DESC);
- {
- oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.SET, struct.privilegeMap.size()));
- for (Map.Entry<String, Set<TSentryPrivilege>> _iter119 : struct.privilegeMap.entrySet())
- {
- oprot.writeString(_iter119.getKey());
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, _iter119.getValue().size()));
- for (TSentryPrivilege _iter120 : _iter119.getValue())
- {
- _iter120.write(oprot);
- }
- oprot.writeSetEnd();
- }
- }
- oprot.writeMapEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryPrivilegeMapTupleSchemeFactory implements SchemeFactory {
- public TSentryPrivilegeMapTupleScheme getScheme() {
- return new TSentryPrivilegeMapTupleScheme();
- }
- }
-
- private static class TSentryPrivilegeMapTupleScheme extends TupleScheme<TSentryPrivilegeMap> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryPrivilegeMap struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- {
- oprot.writeI32(struct.privilegeMap.size());
- for (Map.Entry<String, Set<TSentryPrivilege>> _iter121 : struct.privilegeMap.entrySet())
- {
- oprot.writeString(_iter121.getKey());
- {
- oprot.writeI32(_iter121.getValue().size());
- for (TSentryPrivilege _iter122 : _iter121.getValue())
- {
- _iter122.write(oprot);
- }
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryPrivilegeMap struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- {
- org.apache.thrift.protocol.TMap _map123 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.SET, iprot.readI32());
- struct.privilegeMap = new HashMap<String,Set<TSentryPrivilege>>(2*_map123.size);
- String _key124;
- Set<TSentryPrivilege> _val125;
- for (int _i126 = 0; _i126 < _map123.size; ++_i126)
- {
- _key124 = iprot.readString();
- {
- org.apache.thrift.protocol.TSet _set127 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- _val125 = new HashSet<TSentryPrivilege>(2*_set127.size);
- TSentryPrivilege _elem128;
- for (int _i129 = 0; _i129 < _set127.size; ++_i129)
- {
- _elem128 = new TSentryPrivilege();
- _elem128.read(iprot);
- _val125.add(_elem128);
- }
- }
- struct.privilegeMap.put(_key124, _val125);
- }
- }
- struct.setPrivilegeMapIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryRole.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryRole.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryRole.java
deleted file mode 100644
index f4d4196..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryRole.java
+++ /dev/null
@@ -1,645 +0,0 @@
-/**
- * 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.provider.db.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 TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentryRole._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryRole> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryRole");
-
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)2);
- private static final org.apache.thrift.protocol.TField GRANTOR_PRINCIPAL_FIELD_DESC = new org.apache.thrift.protocol.TField("grantorPrincipal", org.apache.thrift.protocol.TType.STRING, (short)3);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryRoleStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryRoleTupleSchemeFactory());
- }
-
- private String roleName; // required
- private Set<TSentryGroup> groups; // required
- private String grantorPrincipal; // 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 {
- ROLE_NAME((short)1, "roleName"),
- GROUPS((short)2, "groups"),
- GRANTOR_PRINCIPAL((short)3, "grantorPrincipal");
-
- 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: // ROLE_NAME
- return ROLE_NAME;
- case 2: // GROUPS
- return GROUPS;
- case 3: // GRANTOR_PRINCIPAL
- return GRANTOR_PRINCIPAL;
- 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.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryGroup.class))));
- tmpMap.put(_Fields.GRANTOR_PRINCIPAL, new org.apache.thrift.meta_data.FieldMetaData("grantorPrincipal", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryRole.class, metaDataMap);
- }
-
- public TSentryRole() {
- }
-
- public TSentryRole(
- String roleName,
- Set<TSentryGroup> groups,
- String grantorPrincipal)
- {
- this();
- this.roleName = roleName;
- this.groups = groups;
- this.grantorPrincipal = grantorPrincipal;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryRole(TSentryRole other) {
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetGroups()) {
- Set<TSentryGroup> __this__groups = new HashSet<TSentryGroup>(other.groups.size());
- for (TSentryGroup other_element : other.groups) {
- __this__groups.add(new TSentryGroup(other_element));
- }
- this.groups = __this__groups;
- }
- if (other.isSetGrantorPrincipal()) {
- this.grantorPrincipal = other.grantorPrincipal;
- }
- }
-
- public TSentryRole deepCopy() {
- return new TSentryRole(this);
- }
-
- @Override
- public void clear() {
- this.roleName = null;
- this.groups = null;
- this.grantorPrincipal = null;
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public int getGroupsSize() {
- return (this.groups == null) ? 0 : this.groups.size();
- }
-
- public java.util.Iterator<TSentryGroup> getGroupsIterator() {
- return (this.groups == null) ? null : this.groups.iterator();
- }
-
- public void addToGroups(TSentryGroup elem) {
- if (this.groups == null) {
- this.groups = new HashSet<TSentryGroup>();
- }
- this.groups.add(elem);
- }
-
- public Set<TSentryGroup> getGroups() {
- return this.groups;
- }
-
- public void setGroups(Set<TSentryGroup> groups) {
- this.groups = groups;
- }
-
- public void unsetGroups() {
- this.groups = null;
- }
-
- /** Returns true if field groups is set (has been assigned a value) and false otherwise */
- public boolean isSetGroups() {
- return this.groups != null;
- }
-
- public void setGroupsIsSet(boolean value) {
- if (!value) {
- this.groups = null;
- }
- }
-
- public String getGrantorPrincipal() {
- return this.grantorPrincipal;
- }
-
- public void setGrantorPrincipal(String grantorPrincipal) {
- this.grantorPrincipal = grantorPrincipal;
- }
-
- public void unsetGrantorPrincipal() {
- this.grantorPrincipal = null;
- }
-
- /** Returns true if field grantorPrincipal is set (has been assigned a value) and false otherwise */
- public boolean isSetGrantorPrincipal() {
- return this.grantorPrincipal != null;
- }
-
- public void setGrantorPrincipalIsSet(boolean value) {
- if (!value) {
- this.grantorPrincipal = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case GROUPS:
- if (value == null) {
- unsetGroups();
- } else {
- setGroups((Set<TSentryGroup>)value);
- }
- break;
-
- case GRANTOR_PRINCIPAL:
- if (value == null) {
- unsetGrantorPrincipal();
- } else {
- setGrantorPrincipal((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case ROLE_NAME:
- return getRoleName();
-
- case GROUPS:
- return getGroups();
-
- case GRANTOR_PRINCIPAL:
- return getGrantorPrincipal();
-
- }
- 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 ROLE_NAME:
- return isSetRoleName();
- case GROUPS:
- return isSetGroups();
- case GRANTOR_PRINCIPAL:
- return isSetGrantorPrincipal();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryRole)
- return this.equals((TSentryRole)that);
- return false;
- }
-
- public boolean equals(TSentryRole that) {
- if (that == null)
- return false;
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- boolean this_present_groups = true && this.isSetGroups();
- boolean that_present_groups = true && that.isSetGroups();
- if (this_present_groups || that_present_groups) {
- if (!(this_present_groups && that_present_groups))
- return false;
- if (!this.groups.equals(that.groups))
- return false;
- }
-
- boolean this_present_grantorPrincipal = true && this.isSetGrantorPrincipal();
- boolean that_present_grantorPrincipal = true && that.isSetGrantorPrincipal();
- if (this_present_grantorPrincipal || that_present_grantorPrincipal) {
- if (!(this_present_grantorPrincipal && that_present_grantorPrincipal))
- return false;
- if (!this.grantorPrincipal.equals(that.grantorPrincipal))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List<Object> list = new ArrayList<Object>();
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- boolean present_groups = true && (isSetGroups());
- list.add(present_groups);
- if (present_groups)
- list.add(groups);
-
- boolean present_grantorPrincipal = true && (isSetGrantorPrincipal());
- list.add(present_grantorPrincipal);
- if (present_grantorPrincipal)
- list.add(grantorPrincipal);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryRole other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGroups()).compareTo(other.isSetGroups());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroups()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, other.groups);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGrantorPrincipal()).compareTo(other.isSetGrantorPrincipal());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGrantorPrincipal()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.grantorPrincipal, other.grantorPrincipal);
- 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("TSentryRole(");
- boolean first = true;
-
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("groups:");
- if (this.groups == null) {
- sb.append("null");
- } else {
- sb.append(this.groups);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("grantorPrincipal:");
- if (this.grantorPrincipal == null) {
- sb.append("null");
- } else {
- sb.append(this.grantorPrincipal);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- if (!isSetGroups()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'groups' is unset! Struct:" + toString());
- }
-
- if (!isSetGrantorPrincipal()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'grantorPrincipal' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TSentryRoleStandardSchemeFactory implements SchemeFactory {
- public TSentryRoleStandardScheme getScheme() {
- return new TSentryRoleStandardScheme();
- }
- }
-
- private static class TSentryRoleStandardScheme extends StandardScheme<TSentryRole> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryRole 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: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // GROUPS
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set56 = iprot.readSetBegin();
- struct.groups = new HashSet<TSentryGroup>(2*_set56.size);
- TSentryGroup _elem57;
- for (int _i58 = 0; _i58 < _set56.size; ++_i58)
- {
- _elem57 = new TSentryGroup();
- _elem57.read(iprot);
- struct.groups.add(_elem57);
- }
- iprot.readSetEnd();
- }
- struct.setGroupsIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // GRANTOR_PRINCIPAL
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.grantorPrincipal = iprot.readString();
- struct.setGrantorPrincipalIsSet(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, TSentryRole struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.groups != null) {
- oprot.writeFieldBegin(GROUPS_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.groups.size()));
- for (TSentryGroup _iter59 : struct.groups)
- {
- _iter59.write(oprot);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- if (struct.grantorPrincipal != null) {
- oprot.writeFieldBegin(GRANTOR_PRINCIPAL_FIELD_DESC);
- oprot.writeString(struct.grantorPrincipal);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryRoleTupleSchemeFactory implements SchemeFactory {
- public TSentryRoleTupleScheme getScheme() {
- return new TSentryRoleTupleScheme();
- }
- }
-
- private static class TSentryRoleTupleScheme extends TupleScheme<TSentryRole> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryRole struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeString(struct.roleName);
- {
- oprot.writeI32(struct.groups.size());
- for (TSentryGroup _iter60 : struct.groups)
- {
- _iter60.write(oprot);
- }
- }
- oprot.writeString(struct.grantorPrincipal);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryRole struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set61 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.groups = new HashSet<TSentryGroup>(2*_set61.size);
- TSentryGroup _elem62;
- for (int _i63 = 0; _i63 < _set61.size; ++_i63)
- {
- _elem62 = new TSentryGroup();
- _elem62.read(iprot);
- struct.groups.add(_elem62);
- }
- }
- struct.setGroupsIsSet(true);
- struct.grantorPrincipal = iprot.readString();
- struct.setGrantorPrincipalIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentrySyncIDRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentrySyncIDRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentrySyncIDRequest.java
deleted file mode 100644
index f8f8185..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentrySyncIDRequest.java
+++ /dev/null
@@ -1,484 +0,0 @@
-/**
- * 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.provider.db.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 TSentrySyncIDRequest implements org.apache.thrift.TBase<TSentrySyncIDRequest, TSentrySyncIDRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TSentrySyncIDRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentrySyncIDRequest");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentrySyncIDRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentrySyncIDRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // 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 {
- PROTOCOL_VERSION((short)1, "protocol_version"),
- 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: // PROTOCOL_VERSION
- return PROTOCOL_VERSION;
- 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 __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)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentrySyncIDRequest.class, metaDataMap);
- }
-
- public TSentrySyncIDRequest() {
- this.protocol_version = 2;
-
- }
-
- public TSentrySyncIDRequest(
- int protocol_version,
- long id)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.id = id;
- setIdIsSet(true);
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentrySyncIDRequest(TSentrySyncIDRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- this.id = other.id;
- }
-
- public TSentrySyncIDRequest deepCopy() {
- return new TSentrySyncIDRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- setIdIsSet(false);
- this.id = 0;
- }
-
- 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 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;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- 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 PROTOCOL_VERSION:
- return isSetProtocol_version();
- case ID:
- return isSetId();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentrySyncIDRequest)
- return this.equals((TSentrySyncIDRequest)that);
- return false;
- }
-
- public boolean equals(TSentrySyncIDRequest 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentrySyncIDRequest 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;
- }
- }
- 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("TSentrySyncIDRequest(");
- 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;
- 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());
- }
-
- // check for sub-struct validity
- }
-
- 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 TSentrySyncIDRequestStandardSchemeFactory implements SchemeFactory {
- public TSentrySyncIDRequestStandardScheme getScheme() {
- return new TSentrySyncIDRequestStandardScheme();
- }
- }
-
- private static class TSentrySyncIDRequestStandardScheme extends StandardScheme<TSentrySyncIDRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentrySyncIDRequest 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;
- 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, TSentrySyncIDRequest 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();
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentrySyncIDRequestTupleSchemeFactory implements SchemeFactory {
- public TSentrySyncIDRequestTupleScheme getScheme() {
- return new TSentrySyncIDRequestTupleScheme();
- }
- }
-
- private static class TSentrySyncIDRequestTupleScheme extends TupleScheme<TSentrySyncIDRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentrySyncIDRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeI64(struct.id);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentrySyncIDRequest 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);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentrySyncIDResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentrySyncIDResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentrySyncIDResponse.java
deleted file mode 100644
index d6b5f3a..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentrySyncIDResponse.java
+++ /dev/null
@@ -1,493 +0,0 @@
-/**
- * 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.provider.db.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 TSentrySyncIDResponse implements org.apache.thrift.TBase<TSentrySyncIDResponse, TSentrySyncIDResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TSentrySyncIDResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentrySyncIDResponse");
-
- 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 TSentrySyncIDResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentrySyncIDResponseTupleSchemeFactory());
- }
-
- 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(TSentrySyncIDResponse.class, metaDataMap);
- }
-
- public TSentrySyncIDResponse() {
- }
-
- public TSentrySyncIDResponse(
- 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 TSentrySyncIDResponse(TSentrySyncIDResponse 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 TSentrySyncIDResponse deepCopy() {
- return new TSentrySyncIDResponse(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 TSentrySyncIDResponse)
- return this.equals((TSentrySyncIDResponse)that);
- return false;
- }
-
- public boolean equals(TSentrySyncIDResponse 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(TSentrySyncIDResponse 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("TSentrySyncIDResponse(");
- 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 TSentrySyncIDResponseStandardSchemeFactory implements SchemeFactory {
- public TSentrySyncIDResponseStandardScheme getScheme() {
- return new TSentrySyncIDResponseStandardScheme();
- }
- }
-
- private static class TSentrySyncIDResponseStandardScheme extends StandardScheme<TSentrySyncIDResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentrySyncIDResponse 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, TSentrySyncIDResponse 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 TSentrySyncIDResponseTupleSchemeFactory implements SchemeFactory {
- public TSentrySyncIDResponseTupleScheme getScheme() {
- return new TSentrySyncIDResponseTupleScheme();
- }
- }
-
- private static class TSentrySyncIDResponseTupleScheme extends TupleScheme<TSentrySyncIDResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentrySyncIDResponse 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, TSentrySyncIDResponse 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);
- }
- }
-
-}
-
[04/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesForProviderRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesForProviderRequest.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesForProviderRequest.java
new file mode 100644
index 0000000..1f3fa84
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesForProviderRequest.java
@@ -0,0 +1,1011 @@
+/**
+ * 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.generic.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 TListSentryPrivilegesForProviderRequest implements org.apache.thrift.TBase<TListSentryPrivilegesForProviderRequest, TListSentryPrivilegesForProviderRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesForProviderRequest> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesForProviderRequest");
+
+ 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 COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField SERVICE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("serviceName", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)4);
+ private static final org.apache.thrift.protocol.TField ROLE_SET_FIELD_DESC = new org.apache.thrift.protocol.TField("roleSet", org.apache.thrift.protocol.TType.STRUCT, (short)5);
+ private static final org.apache.thrift.protocol.TField AUTHORIZABLES_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizables", org.apache.thrift.protocol.TType.LIST, (short)6);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TListSentryPrivilegesForProviderRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TListSentryPrivilegesForProviderRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String component; // required
+ private String serviceName; // required
+ private Set<String> groups; // required
+ private TSentryActiveRoleSet roleSet; // required
+ private List<TAuthorizable> authorizables; // optional
+
+ /** 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"),
+ COMPONENT((short)2, "component"),
+ SERVICE_NAME((short)3, "serviceName"),
+ GROUPS((short)4, "groups"),
+ ROLE_SET((short)5, "roleSet"),
+ AUTHORIZABLES((short)6, "authorizables");
+
+ 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: // COMPONENT
+ return COMPONENT;
+ case 3: // SERVICE_NAME
+ return SERVICE_NAME;
+ case 4: // GROUPS
+ return GROUPS;
+ case 5: // ROLE_SET
+ return ROLE_SET;
+ case 6: // AUTHORIZABLES
+ return AUTHORIZABLES;
+ 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 byte __isset_bitfield = 0;
+ private static final _Fields optionals[] = {_Fields.AUTHORIZABLES};
+ 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.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.SERVICE_NAME, new org.apache.thrift.meta_data.FieldMetaData("serviceName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ tmpMap.put(_Fields.ROLE_SET, new org.apache.thrift.meta_data.FieldMetaData("roleSet", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryActiveRoleSet.class)));
+ tmpMap.put(_Fields.AUTHORIZABLES, new org.apache.thrift.meta_data.FieldMetaData("authorizables", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAuthorizable.class))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesForProviderRequest.class, metaDataMap);
+ }
+
+ public TListSentryPrivilegesForProviderRequest() {
+ this.protocol_version = 2;
+
+ }
+
+ public TListSentryPrivilegesForProviderRequest(
+ int protocol_version,
+ String component,
+ String serviceName,
+ Set<String> groups,
+ TSentryActiveRoleSet roleSet)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.component = component;
+ this.serviceName = serviceName;
+ this.groups = groups;
+ this.roleSet = roleSet;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TListSentryPrivilegesForProviderRequest(TListSentryPrivilegesForProviderRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetComponent()) {
+ this.component = other.component;
+ }
+ if (other.isSetServiceName()) {
+ this.serviceName = other.serviceName;
+ }
+ if (other.isSetGroups()) {
+ Set<String> __this__groups = new HashSet<String>(other.groups);
+ this.groups = __this__groups;
+ }
+ if (other.isSetRoleSet()) {
+ this.roleSet = new TSentryActiveRoleSet(other.roleSet);
+ }
+ if (other.isSetAuthorizables()) {
+ List<TAuthorizable> __this__authorizables = new ArrayList<TAuthorizable>(other.authorizables.size());
+ for (TAuthorizable other_element : other.authorizables) {
+ __this__authorizables.add(new TAuthorizable(other_element));
+ }
+ this.authorizables = __this__authorizables;
+ }
+ }
+
+ public TListSentryPrivilegesForProviderRequest deepCopy() {
+ return new TListSentryPrivilegesForProviderRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 2;
+
+ this.component = null;
+ this.serviceName = null;
+ this.groups = null;
+ this.roleSet = null;
+ this.authorizables = 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 String getComponent() {
+ return this.component;
+ }
+
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ public void unsetComponent() {
+ this.component = null;
+ }
+
+ /** Returns true if field component is set (has been assigned a value) and false otherwise */
+ public boolean isSetComponent() {
+ return this.component != null;
+ }
+
+ public void setComponentIsSet(boolean value) {
+ if (!value) {
+ this.component = null;
+ }
+ }
+
+ public String getServiceName() {
+ return this.serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public void unsetServiceName() {
+ this.serviceName = null;
+ }
+
+ /** Returns true if field serviceName is set (has been assigned a value) and false otherwise */
+ public boolean isSetServiceName() {
+ return this.serviceName != null;
+ }
+
+ public void setServiceNameIsSet(boolean value) {
+ if (!value) {
+ this.serviceName = null;
+ }
+ }
+
+ public int getGroupsSize() {
+ return (this.groups == null) ? 0 : this.groups.size();
+ }
+
+ public java.util.Iterator<String> getGroupsIterator() {
+ return (this.groups == null) ? null : this.groups.iterator();
+ }
+
+ public void addToGroups(String elem) {
+ if (this.groups == null) {
+ this.groups = new HashSet<String>();
+ }
+ this.groups.add(elem);
+ }
+
+ public Set<String> getGroups() {
+ return this.groups;
+ }
+
+ public void setGroups(Set<String> groups) {
+ this.groups = groups;
+ }
+
+ public void unsetGroups() {
+ this.groups = null;
+ }
+
+ /** Returns true if field groups is set (has been assigned a value) and false otherwise */
+ public boolean isSetGroups() {
+ return this.groups != null;
+ }
+
+ public void setGroupsIsSet(boolean value) {
+ if (!value) {
+ this.groups = null;
+ }
+ }
+
+ public TSentryActiveRoleSet getRoleSet() {
+ return this.roleSet;
+ }
+
+ public void setRoleSet(TSentryActiveRoleSet roleSet) {
+ this.roleSet = roleSet;
+ }
+
+ public void unsetRoleSet() {
+ this.roleSet = null;
+ }
+
+ /** Returns true if field roleSet is set (has been assigned a value) and false otherwise */
+ public boolean isSetRoleSet() {
+ return this.roleSet != null;
+ }
+
+ public void setRoleSetIsSet(boolean value) {
+ if (!value) {
+ this.roleSet = null;
+ }
+ }
+
+ public int getAuthorizablesSize() {
+ return (this.authorizables == null) ? 0 : this.authorizables.size();
+ }
+
+ public java.util.Iterator<TAuthorizable> getAuthorizablesIterator() {
+ return (this.authorizables == null) ? null : this.authorizables.iterator();
+ }
+
+ public void addToAuthorizables(TAuthorizable elem) {
+ if (this.authorizables == null) {
+ this.authorizables = new ArrayList<TAuthorizable>();
+ }
+ this.authorizables.add(elem);
+ }
+
+ public List<TAuthorizable> getAuthorizables() {
+ return this.authorizables;
+ }
+
+ public void setAuthorizables(List<TAuthorizable> authorizables) {
+ this.authorizables = authorizables;
+ }
+
+ public void unsetAuthorizables() {
+ this.authorizables = null;
+ }
+
+ /** Returns true if field authorizables is set (has been assigned a value) and false otherwise */
+ public boolean isSetAuthorizables() {
+ return this.authorizables != null;
+ }
+
+ public void setAuthorizablesIsSet(boolean value) {
+ if (!value) {
+ this.authorizables = 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 COMPONENT:
+ if (value == null) {
+ unsetComponent();
+ } else {
+ setComponent((String)value);
+ }
+ break;
+
+ case SERVICE_NAME:
+ if (value == null) {
+ unsetServiceName();
+ } else {
+ setServiceName((String)value);
+ }
+ break;
+
+ case GROUPS:
+ if (value == null) {
+ unsetGroups();
+ } else {
+ setGroups((Set<String>)value);
+ }
+ break;
+
+ case ROLE_SET:
+ if (value == null) {
+ unsetRoleSet();
+ } else {
+ setRoleSet((TSentryActiveRoleSet)value);
+ }
+ break;
+
+ case AUTHORIZABLES:
+ if (value == null) {
+ unsetAuthorizables();
+ } else {
+ setAuthorizables((List<TAuthorizable>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return getProtocol_version();
+
+ case COMPONENT:
+ return getComponent();
+
+ case SERVICE_NAME:
+ return getServiceName();
+
+ case GROUPS:
+ return getGroups();
+
+ case ROLE_SET:
+ return getRoleSet();
+
+ case AUTHORIZABLES:
+ return getAuthorizables();
+
+ }
+ 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 COMPONENT:
+ return isSetComponent();
+ case SERVICE_NAME:
+ return isSetServiceName();
+ case GROUPS:
+ return isSetGroups();
+ case ROLE_SET:
+ return isSetRoleSet();
+ case AUTHORIZABLES:
+ return isSetAuthorizables();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TListSentryPrivilegesForProviderRequest)
+ return this.equals((TListSentryPrivilegesForProviderRequest)that);
+ return false;
+ }
+
+ public boolean equals(TListSentryPrivilegesForProviderRequest 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_component = true && this.isSetComponent();
+ boolean that_present_component = true && that.isSetComponent();
+ if (this_present_component || that_present_component) {
+ if (!(this_present_component && that_present_component))
+ return false;
+ if (!this.component.equals(that.component))
+ return false;
+ }
+
+ boolean this_present_serviceName = true && this.isSetServiceName();
+ boolean that_present_serviceName = true && that.isSetServiceName();
+ if (this_present_serviceName || that_present_serviceName) {
+ if (!(this_present_serviceName && that_present_serviceName))
+ return false;
+ if (!this.serviceName.equals(that.serviceName))
+ return false;
+ }
+
+ boolean this_present_groups = true && this.isSetGroups();
+ boolean that_present_groups = true && that.isSetGroups();
+ if (this_present_groups || that_present_groups) {
+ if (!(this_present_groups && that_present_groups))
+ return false;
+ if (!this.groups.equals(that.groups))
+ return false;
+ }
+
+ boolean this_present_roleSet = true && this.isSetRoleSet();
+ boolean that_present_roleSet = true && that.isSetRoleSet();
+ if (this_present_roleSet || that_present_roleSet) {
+ if (!(this_present_roleSet && that_present_roleSet))
+ return false;
+ if (!this.roleSet.equals(that.roleSet))
+ return false;
+ }
+
+ boolean this_present_authorizables = true && this.isSetAuthorizables();
+ boolean that_present_authorizables = true && that.isSetAuthorizables();
+ if (this_present_authorizables || that_present_authorizables) {
+ if (!(this_present_authorizables && that_present_authorizables))
+ return false;
+ if (!this.authorizables.equals(that.authorizables))
+ 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_component = true && (isSetComponent());
+ list.add(present_component);
+ if (present_component)
+ list.add(component);
+
+ boolean present_serviceName = true && (isSetServiceName());
+ list.add(present_serviceName);
+ if (present_serviceName)
+ list.add(serviceName);
+
+ boolean present_groups = true && (isSetGroups());
+ list.add(present_groups);
+ if (present_groups)
+ list.add(groups);
+
+ boolean present_roleSet = true && (isSetRoleSet());
+ list.add(present_roleSet);
+ if (present_roleSet)
+ list.add(roleSet);
+
+ boolean present_authorizables = true && (isSetAuthorizables());
+ list.add(present_authorizables);
+ if (present_authorizables)
+ list.add(authorizables);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TListSentryPrivilegesForProviderRequest 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(isSetComponent()).compareTo(other.isSetComponent());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetComponent()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetServiceName()).compareTo(other.isSetServiceName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetServiceName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serviceName, other.serviceName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGroups()).compareTo(other.isSetGroups());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGroups()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, other.groups);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleSet()).compareTo(other.isSetRoleSet());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleSet()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleSet, other.roleSet);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetAuthorizables()).compareTo(other.isSetAuthorizables());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAuthorizables()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizables, other.authorizables);
+ 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("TListSentryPrivilegesForProviderRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("component:");
+ if (this.component == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.component);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("serviceName:");
+ if (this.serviceName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.serviceName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("groups:");
+ if (this.groups == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.groups);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("roleSet:");
+ if (this.roleSet == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roleSet);
+ }
+ first = false;
+ if (isSetAuthorizables()) {
+ if (!first) sb.append(", ");
+ sb.append("authorizables:");
+ if (this.authorizables == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.authorizables);
+ }
+ 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 (!isSetComponent()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
+ }
+
+ if (!isSetServiceName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'serviceName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetGroups()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'groups' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRoleSet()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleSet' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (roleSet != null) {
+ roleSet.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 TListSentryPrivilegesForProviderRequestStandardSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesForProviderRequestStandardScheme getScheme() {
+ return new TListSentryPrivilegesForProviderRequestStandardScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesForProviderRequestStandardScheme extends StandardScheme<TListSentryPrivilegesForProviderRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesForProviderRequest 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: // COMPONENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // SERVICE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.serviceName = iprot.readString();
+ struct.setServiceNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // GROUPS
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set80 = iprot.readSetBegin();
+ struct.groups = new HashSet<String>(2*_set80.size);
+ String _elem81;
+ for (int _i82 = 0; _i82 < _set80.size; ++_i82)
+ {
+ _elem81 = iprot.readString();
+ struct.groups.add(_elem81);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setGroupsIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 5: // ROLE_SET
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.roleSet = new TSentryActiveRoleSet();
+ struct.roleSet.read(iprot);
+ struct.setRoleSetIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 6: // AUTHORIZABLES
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list83 = iprot.readListBegin();
+ struct.authorizables = new ArrayList<TAuthorizable>(_list83.size);
+ TAuthorizable _elem84;
+ for (int _i85 = 0; _i85 < _list83.size; ++_i85)
+ {
+ _elem84 = new TAuthorizable();
+ _elem84.read(iprot);
+ struct.authorizables.add(_elem84);
+ }
+ iprot.readListEnd();
+ }
+ struct.setAuthorizablesIsSet(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, TListSentryPrivilegesForProviderRequest 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();
+ if (struct.component != null) {
+ oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
+ oprot.writeString(struct.component);
+ oprot.writeFieldEnd();
+ }
+ if (struct.serviceName != null) {
+ oprot.writeFieldBegin(SERVICE_NAME_FIELD_DESC);
+ oprot.writeString(struct.serviceName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.groups != null) {
+ oprot.writeFieldBegin(GROUPS_FIELD_DESC);
+ {
+ oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.groups.size()));
+ for (String _iter86 : struct.groups)
+ {
+ oprot.writeString(_iter86);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.roleSet != null) {
+ oprot.writeFieldBegin(ROLE_SET_FIELD_DESC);
+ struct.roleSet.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.authorizables != null) {
+ if (struct.isSetAuthorizables()) {
+ oprot.writeFieldBegin(AUTHORIZABLES_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.authorizables.size()));
+ for (TAuthorizable _iter87 : struct.authorizables)
+ {
+ _iter87.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TListSentryPrivilegesForProviderRequestTupleSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesForProviderRequestTupleScheme getScheme() {
+ return new TListSentryPrivilegesForProviderRequestTupleScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesForProviderRequestTupleScheme extends TupleScheme<TListSentryPrivilegesForProviderRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.component);
+ oprot.writeString(struct.serviceName);
+ {
+ oprot.writeI32(struct.groups.size());
+ for (String _iter88 : struct.groups)
+ {
+ oprot.writeString(_iter88);
+ }
+ }
+ struct.roleSet.write(oprot);
+ BitSet optionals = new BitSet();
+ if (struct.isSetAuthorizables()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetAuthorizables()) {
+ {
+ oprot.writeI32(struct.authorizables.size());
+ for (TAuthorizable _iter89 : struct.authorizables)
+ {
+ _iter89.write(oprot);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ struct.serviceName = iprot.readString();
+ struct.setServiceNameIsSet(true);
+ {
+ org.apache.thrift.protocol.TSet _set90 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.groups = new HashSet<String>(2*_set90.size);
+ String _elem91;
+ for (int _i92 = 0; _i92 < _set90.size; ++_i92)
+ {
+ _elem91 = iprot.readString();
+ struct.groups.add(_elem91);
+ }
+ }
+ struct.setGroupsIsSet(true);
+ struct.roleSet = new TSentryActiveRoleSet();
+ struct.roleSet.read(iprot);
+ struct.setRoleSetIsSet(true);
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TList _list93 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.authorizables = new ArrayList<TAuthorizable>(_list93.size);
+ TAuthorizable _elem94;
+ for (int _i95 = 0; _i95 < _list93.size; ++_i95)
+ {
+ _elem94 = new TAuthorizable();
+ _elem94.read(iprot);
+ struct.authorizables.add(_elem94);
+ }
+ }
+ struct.setAuthorizablesIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesForProviderResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesForProviderResponse.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesForProviderResponse.java
new file mode 100644
index 0000000..92f6e4d
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryPrivilegesForProviderResponse.java
@@ -0,0 +1,541 @@
+/**
+ * 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.generic.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 TListSentryPrivilegesForProviderResponse implements org.apache.thrift.TBase<TListSentryPrivilegesForProviderResponse, TListSentryPrivilegesForProviderResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesForProviderResponse> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesForProviderResponse");
+
+ 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 PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TListSentryPrivilegesForProviderResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TListSentryPrivilegesForProviderResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
+ private Set<String> privileges; // 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"),
+ PRIVILEGES((short)2, "privileges");
+
+ 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: // PRIVILEGES
+ return PRIVILEGES;
+ 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
+ tmpMap.put(_Fields.PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("privileges", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesForProviderResponse.class, metaDataMap);
+ }
+
+ public TListSentryPrivilegesForProviderResponse() {
+ }
+
+ public TListSentryPrivilegesForProviderResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status,
+ Set<String> privileges)
+ {
+ this();
+ this.status = status;
+ this.privileges = privileges;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TListSentryPrivilegesForProviderResponse(TListSentryPrivilegesForProviderResponse other) {
+ if (other.isSetStatus()) {
+ this.status = other.status;
+ }
+ if (other.isSetPrivileges()) {
+ Set<String> __this__privileges = new HashSet<String>(other.privileges);
+ this.privileges = __this__privileges;
+ }
+ }
+
+ public TListSentryPrivilegesForProviderResponse deepCopy() {
+ return new TListSentryPrivilegesForProviderResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ this.privileges = null;
+ }
+
+ 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 int getPrivilegesSize() {
+ return (this.privileges == null) ? 0 : this.privileges.size();
+ }
+
+ public java.util.Iterator<String> getPrivilegesIterator() {
+ return (this.privileges == null) ? null : this.privileges.iterator();
+ }
+
+ public void addToPrivileges(String elem) {
+ if (this.privileges == null) {
+ this.privileges = new HashSet<String>();
+ }
+ this.privileges.add(elem);
+ }
+
+ public Set<String> getPrivileges() {
+ return this.privileges;
+ }
+
+ public void setPrivileges(Set<String> privileges) {
+ this.privileges = privileges;
+ }
+
+ public void unsetPrivileges() {
+ this.privileges = null;
+ }
+
+ /** Returns true if field privileges is set (has been assigned a value) and false otherwise */
+ public boolean isSetPrivileges() {
+ return this.privileges != null;
+ }
+
+ public void setPrivilegesIsSet(boolean value) {
+ if (!value) {
+ this.privileges = null;
+ }
+ }
+
+ 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 PRIVILEGES:
+ if (value == null) {
+ unsetPrivileges();
+ } else {
+ setPrivileges((Set<String>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ case PRIVILEGES:
+ return getPrivileges();
+
+ }
+ 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 PRIVILEGES:
+ return isSetPrivileges();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TListSentryPrivilegesForProviderResponse)
+ return this.equals((TListSentryPrivilegesForProviderResponse)that);
+ return false;
+ }
+
+ public boolean equals(TListSentryPrivilegesForProviderResponse 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_privileges = true && this.isSetPrivileges();
+ boolean that_present_privileges = true && that.isSetPrivileges();
+ if (this_present_privileges || that_present_privileges) {
+ if (!(this_present_privileges && that_present_privileges))
+ return false;
+ if (!this.privileges.equals(that.privileges))
+ 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_privileges = true && (isSetPrivileges());
+ list.add(present_privileges);
+ if (present_privileges)
+ list.add(privileges);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TListSentryPrivilegesForProviderResponse 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(isSetPrivileges()).compareTo(other.isSetPrivileges());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPrivileges()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, other.privileges);
+ 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("TListSentryPrivilegesForProviderResponse(");
+ 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("privileges:");
+ if (this.privileges == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.privileges);
+ }
+ 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 (!isSetPrivileges()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'privileges' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TListSentryPrivilegesForProviderResponseStandardSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesForProviderResponseStandardScheme getScheme() {
+ return new TListSentryPrivilegesForProviderResponseStandardScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesForProviderResponseStandardScheme extends StandardScheme<TListSentryPrivilegesForProviderResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesForProviderResponse 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: // PRIVILEGES
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set96 = iprot.readSetBegin();
+ struct.privileges = new HashSet<String>(2*_set96.size);
+ String _elem97;
+ for (int _i98 = 0; _i98 < _set96.size; ++_i98)
+ {
+ _elem97 = iprot.readString();
+ struct.privileges.add(_elem97);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setPrivilegesIsSet(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, TListSentryPrivilegesForProviderResponse 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();
+ }
+ if (struct.privileges != null) {
+ oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
+ {
+ oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.privileges.size()));
+ for (String _iter99 : struct.privileges)
+ {
+ oprot.writeString(_iter99);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TListSentryPrivilegesForProviderResponseTupleSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesForProviderResponseTupleScheme getScheme() {
+ return new TListSentryPrivilegesForProviderResponseTupleScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesForProviderResponseTupleScheme extends TupleScheme<TListSentryPrivilegesForProviderResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ struct.status.write(oprot);
+ {
+ oprot.writeI32(struct.privileges.size());
+ for (String _iter100 : struct.privileges)
+ {
+ oprot.writeString(_iter100);
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderResponse 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);
+ {
+ org.apache.thrift.protocol.TSet _set101 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.privileges = new HashSet<String>(2*_set101.size);
+ String _elem102;
+ for (int _i103 = 0; _i103 < _set101.size; ++_i103)
+ {
+ _elem102 = iprot.readString();
+ struct.privileges.add(_elem102);
+ }
+ }
+ struct.setPrivilegesIsSet(true);
+ }
+ }
+
+}
+
[29/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryExportMappingDataResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryExportMappingDataResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryExportMappingDataResponse.java
deleted file mode 100644
index 883ee8a..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryExportMappingDataResponse.java
+++ /dev/null
@@ -1,500 +0,0 @@
-/**
- * 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.provider.db.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 TSentryExportMappingDataResponse implements org.apache.thrift.TBase<TSentryExportMappingDataResponse, TSentryExportMappingDataResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryExportMappingDataResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryExportMappingDataResponse");
-
- 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 MAPPING_DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("mappingData", org.apache.thrift.protocol.TType.STRUCT, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryExportMappingDataResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryExportMappingDataResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
- private TSentryMappingData mappingData; // 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"),
- MAPPING_DATA((short)2, "mappingData");
-
- 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: // MAPPING_DATA
- return MAPPING_DATA;
- 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.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.MAPPING_DATA, new org.apache.thrift.meta_data.FieldMetaData("mappingData", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryMappingData.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryExportMappingDataResponse.class, metaDataMap);
- }
-
- public TSentryExportMappingDataResponse() {
- }
-
- public TSentryExportMappingDataResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status,
- TSentryMappingData mappingData)
- {
- this();
- this.status = status;
- this.mappingData = mappingData;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryExportMappingDataResponse(TSentryExportMappingDataResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- if (other.isSetMappingData()) {
- this.mappingData = new TSentryMappingData(other.mappingData);
- }
- }
-
- public TSentryExportMappingDataResponse deepCopy() {
- return new TSentryExportMappingDataResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- this.mappingData = null;
- }
-
- 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 TSentryMappingData getMappingData() {
- return this.mappingData;
- }
-
- public void setMappingData(TSentryMappingData mappingData) {
- this.mappingData = mappingData;
- }
-
- public void unsetMappingData() {
- this.mappingData = null;
- }
-
- /** Returns true if field mappingData is set (has been assigned a value) and false otherwise */
- public boolean isSetMappingData() {
- return this.mappingData != null;
- }
-
- public void setMappingDataIsSet(boolean value) {
- if (!value) {
- this.mappingData = null;
- }
- }
-
- 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 MAPPING_DATA:
- if (value == null) {
- unsetMappingData();
- } else {
- setMappingData((TSentryMappingData)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- case MAPPING_DATA:
- return getMappingData();
-
- }
- 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 MAPPING_DATA:
- return isSetMappingData();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryExportMappingDataResponse)
- return this.equals((TSentryExportMappingDataResponse)that);
- return false;
- }
-
- public boolean equals(TSentryExportMappingDataResponse 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_mappingData = true && this.isSetMappingData();
- boolean that_present_mappingData = true && that.isSetMappingData();
- if (this_present_mappingData || that_present_mappingData) {
- if (!(this_present_mappingData && that_present_mappingData))
- return false;
- if (!this.mappingData.equals(that.mappingData))
- 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_mappingData = true && (isSetMappingData());
- list.add(present_mappingData);
- if (present_mappingData)
- list.add(mappingData);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryExportMappingDataResponse 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(isSetMappingData()).compareTo(other.isSetMappingData());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetMappingData()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mappingData, other.mappingData);
- 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("TSentryExportMappingDataResponse(");
- 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("mappingData:");
- if (this.mappingData == null) {
- sb.append("null");
- } else {
- sb.append(this.mappingData);
- }
- 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 (!isSetMappingData()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'mappingData' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (status != null) {
- status.validate();
- }
- if (mappingData != null) {
- mappingData.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 TSentryExportMappingDataResponseStandardSchemeFactory implements SchemeFactory {
- public TSentryExportMappingDataResponseStandardScheme getScheme() {
- return new TSentryExportMappingDataResponseStandardScheme();
- }
- }
-
- private static class TSentryExportMappingDataResponseStandardScheme extends StandardScheme<TSentryExportMappingDataResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryExportMappingDataResponse 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: // MAPPING_DATA
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.mappingData = new TSentryMappingData();
- struct.mappingData.read(iprot);
- struct.setMappingDataIsSet(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, TSentryExportMappingDataResponse 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();
- }
- if (struct.mappingData != null) {
- oprot.writeFieldBegin(MAPPING_DATA_FIELD_DESC);
- struct.mappingData.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryExportMappingDataResponseTupleSchemeFactory implements SchemeFactory {
- public TSentryExportMappingDataResponseTupleScheme getScheme() {
- return new TSentryExportMappingDataResponseTupleScheme();
- }
- }
-
- private static class TSentryExportMappingDataResponseTupleScheme extends TupleScheme<TSentryExportMappingDataResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryExportMappingDataResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- struct.mappingData.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryExportMappingDataResponse 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.mappingData = new TSentryMappingData();
- struct.mappingData.read(iprot);
- struct.setMappingDataIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGrantOption.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGrantOption.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGrantOption.java
deleted file mode 100644
index c056bcc..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGrantOption.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.provider.db.service.thrift;
-
-
-import java.util.Map;
-import java.util.HashMap;
-import org.apache.thrift.TEnum;
-
-public enum TSentryGrantOption implements org.apache.thrift.TEnum {
- TRUE(1),
- FALSE(0),
- UNSET(-1);
-
- private final int value;
-
- private TSentryGrantOption(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 TSentryGrantOption findByValue(int value) {
- switch (value) {
- case 1:
- return TRUE;
- case 0:
- return FALSE;
- case -1:
- return UNSET;
- default:
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGroup.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGroup.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGroup.java
deleted file mode 100644
index 1cce90c..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGroup.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/**
- * 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.provider.db.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 TSentryGroup implements org.apache.thrift.TBase<TSentryGroup, TSentryGroup._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryGroup> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryGroup");
-
- private static final org.apache.thrift.protocol.TField GROUP_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("groupName", org.apache.thrift.protocol.TType.STRING, (short)1);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryGroupStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryGroupTupleSchemeFactory());
- }
-
- private String groupName; // 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 {
- GROUP_NAME((short)1, "groupName");
-
- 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: // GROUP_NAME
- return GROUP_NAME;
- 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.GROUP_NAME, new org.apache.thrift.meta_data.FieldMetaData("groupName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryGroup.class, metaDataMap);
- }
-
- public TSentryGroup() {
- }
-
- public TSentryGroup(
- String groupName)
- {
- this();
- this.groupName = groupName;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryGroup(TSentryGroup other) {
- if (other.isSetGroupName()) {
- this.groupName = other.groupName;
- }
- }
-
- public TSentryGroup deepCopy() {
- return new TSentryGroup(this);
- }
-
- @Override
- public void clear() {
- this.groupName = null;
- }
-
- public String getGroupName() {
- return this.groupName;
- }
-
- public void setGroupName(String groupName) {
- this.groupName = groupName;
- }
-
- public void unsetGroupName() {
- this.groupName = null;
- }
-
- /** Returns true if field groupName is set (has been assigned a value) and false otherwise */
- public boolean isSetGroupName() {
- return this.groupName != null;
- }
-
- public void setGroupNameIsSet(boolean value) {
- if (!value) {
- this.groupName = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case GROUP_NAME:
- if (value == null) {
- unsetGroupName();
- } else {
- setGroupName((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case GROUP_NAME:
- return getGroupName();
-
- }
- 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 GROUP_NAME:
- return isSetGroupName();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryGroup)
- return this.equals((TSentryGroup)that);
- return false;
- }
-
- public boolean equals(TSentryGroup that) {
- if (that == null)
- return false;
-
- boolean this_present_groupName = true && this.isSetGroupName();
- boolean that_present_groupName = true && that.isSetGroupName();
- if (this_present_groupName || that_present_groupName) {
- if (!(this_present_groupName && that_present_groupName))
- return false;
- if (!this.groupName.equals(that.groupName))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List<Object> list = new ArrayList<Object>();
-
- boolean present_groupName = true && (isSetGroupName());
- list.add(present_groupName);
- if (present_groupName)
- list.add(groupName);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryGroup other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetGroupName()).compareTo(other.isSetGroupName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroupName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groupName, other.groupName);
- 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("TSentryGroup(");
- boolean first = true;
-
- sb.append("groupName:");
- if (this.groupName == null) {
- sb.append("null");
- } else {
- sb.append(this.groupName);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetGroupName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'groupName' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TSentryGroupStandardSchemeFactory implements SchemeFactory {
- public TSentryGroupStandardScheme getScheme() {
- return new TSentryGroupStandardScheme();
- }
- }
-
- private static class TSentryGroupStandardScheme extends StandardScheme<TSentryGroup> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryGroup 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: // GROUP_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.groupName = iprot.readString();
- struct.setGroupNameIsSet(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, TSentryGroup struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.groupName != null) {
- oprot.writeFieldBegin(GROUP_NAME_FIELD_DESC);
- oprot.writeString(struct.groupName);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryGroupTupleSchemeFactory implements SchemeFactory {
- public TSentryGroupTupleScheme getScheme() {
- return new TSentryGroupTupleScheme();
- }
- }
-
- private static class TSentryGroupTupleScheme extends TupleScheme<TSentryGroup> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryGroup struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeString(struct.groupName);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryGroup struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.groupName = iprot.readString();
- struct.setGroupNameIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryImportMappingDataRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryImportMappingDataRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryImportMappingDataRequest.java
deleted file mode 100644
index 936299b..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryImportMappingDataRequest.java
+++ /dev/null
@@ -1,693 +0,0 @@
-/**
- * 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.provider.db.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 TSentryImportMappingDataRequest implements org.apache.thrift.TBase<TSentryImportMappingDataRequest, TSentryImportMappingDataRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryImportMappingDataRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryImportMappingDataRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField OVERWRITE_ROLE_FIELD_DESC = new org.apache.thrift.protocol.TField("overwriteRole", org.apache.thrift.protocol.TType.BOOL, (short)3);
- private static final org.apache.thrift.protocol.TField MAPPING_DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("mappingData", org.apache.thrift.protocol.TType.STRUCT, (short)4);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryImportMappingDataRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryImportMappingDataRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private boolean overwriteRole; // required
- private TSentryMappingData mappingData; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- OVERWRITE_ROLE((short)3, "overwriteRole"),
- MAPPING_DATA((short)4, "mappingData");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // OVERWRITE_ROLE
- return OVERWRITE_ROLE;
- case 4: // MAPPING_DATA
- return MAPPING_DATA;
- 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 __OVERWRITEROLE_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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.OVERWRITE_ROLE, new org.apache.thrift.meta_data.FieldMetaData("overwriteRole", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
- tmpMap.put(_Fields.MAPPING_DATA, new org.apache.thrift.meta_data.FieldMetaData("mappingData", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryMappingData.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryImportMappingDataRequest.class, metaDataMap);
- }
-
- public TSentryImportMappingDataRequest() {
- this.protocol_version = 1;
-
- this.overwriteRole = false;
-
- }
-
- public TSentryImportMappingDataRequest(
- int protocol_version,
- String requestorUserName,
- boolean overwriteRole,
- TSentryMappingData mappingData)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.overwriteRole = overwriteRole;
- setOverwriteRoleIsSet(true);
- this.mappingData = mappingData;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryImportMappingDataRequest(TSentryImportMappingDataRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- this.overwriteRole = other.overwriteRole;
- if (other.isSetMappingData()) {
- this.mappingData = new TSentryMappingData(other.mappingData);
- }
- }
-
- public TSentryImportMappingDataRequest deepCopy() {
- return new TSentryImportMappingDataRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 1;
-
- this.requestorUserName = null;
- this.overwriteRole = false;
-
- this.mappingData = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public boolean isOverwriteRole() {
- return this.overwriteRole;
- }
-
- public void setOverwriteRole(boolean overwriteRole) {
- this.overwriteRole = overwriteRole;
- setOverwriteRoleIsSet(true);
- }
-
- public void unsetOverwriteRole() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __OVERWRITEROLE_ISSET_ID);
- }
-
- /** Returns true if field overwriteRole is set (has been assigned a value) and false otherwise */
- public boolean isSetOverwriteRole() {
- return EncodingUtils.testBit(__isset_bitfield, __OVERWRITEROLE_ISSET_ID);
- }
-
- public void setOverwriteRoleIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __OVERWRITEROLE_ISSET_ID, value);
- }
-
- public TSentryMappingData getMappingData() {
- return this.mappingData;
- }
-
- public void setMappingData(TSentryMappingData mappingData) {
- this.mappingData = mappingData;
- }
-
- public void unsetMappingData() {
- this.mappingData = null;
- }
-
- /** Returns true if field mappingData is set (has been assigned a value) and false otherwise */
- public boolean isSetMappingData() {
- return this.mappingData != null;
- }
-
- public void setMappingDataIsSet(boolean value) {
- if (!value) {
- this.mappingData = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case OVERWRITE_ROLE:
- if (value == null) {
- unsetOverwriteRole();
- } else {
- setOverwriteRole((Boolean)value);
- }
- break;
-
- case MAPPING_DATA:
- if (value == null) {
- unsetMappingData();
- } else {
- setMappingData((TSentryMappingData)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case OVERWRITE_ROLE:
- return isOverwriteRole();
-
- case MAPPING_DATA:
- return getMappingData();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case OVERWRITE_ROLE:
- return isSetOverwriteRole();
- case MAPPING_DATA:
- return isSetMappingData();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryImportMappingDataRequest)
- return this.equals((TSentryImportMappingDataRequest)that);
- return false;
- }
-
- public boolean equals(TSentryImportMappingDataRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_overwriteRole = true;
- boolean that_present_overwriteRole = true;
- if (this_present_overwriteRole || that_present_overwriteRole) {
- if (!(this_present_overwriteRole && that_present_overwriteRole))
- return false;
- if (this.overwriteRole != that.overwriteRole)
- return false;
- }
-
- boolean this_present_mappingData = true && this.isSetMappingData();
- boolean that_present_mappingData = true && that.isSetMappingData();
- if (this_present_mappingData || that_present_mappingData) {
- if (!(this_present_mappingData && that_present_mappingData))
- return false;
- if (!this.mappingData.equals(that.mappingData))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_overwriteRole = true;
- list.add(present_overwriteRole);
- if (present_overwriteRole)
- list.add(overwriteRole);
-
- boolean present_mappingData = true && (isSetMappingData());
- list.add(present_mappingData);
- if (present_mappingData)
- list.add(mappingData);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryImportMappingDataRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetOverwriteRole()).compareTo(other.isSetOverwriteRole());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetOverwriteRole()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.overwriteRole, other.overwriteRole);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetMappingData()).compareTo(other.isSetMappingData());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetMappingData()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mappingData, other.mappingData);
- 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("TSentryImportMappingDataRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("overwriteRole:");
- sb.append(this.overwriteRole);
- first = false;
- if (!first) sb.append(", ");
- sb.append("mappingData:");
- if (this.mappingData == null) {
- sb.append("null");
- } else {
- sb.append(this.mappingData);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetOverwriteRole()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'overwriteRole' is unset! Struct:" + toString());
- }
-
- if (!isSetMappingData()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'mappingData' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (mappingData != null) {
- mappingData.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 TSentryImportMappingDataRequestStandardSchemeFactory implements SchemeFactory {
- public TSentryImportMappingDataRequestStandardScheme getScheme() {
- return new TSentryImportMappingDataRequestStandardScheme();
- }
- }
-
- private static class TSentryImportMappingDataRequestStandardScheme extends StandardScheme<TSentryImportMappingDataRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryImportMappingDataRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // OVERWRITE_ROLE
- if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
- struct.overwriteRole = iprot.readBool();
- struct.setOverwriteRoleIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // MAPPING_DATA
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.mappingData = new TSentryMappingData();
- struct.mappingData.read(iprot);
- struct.setMappingDataIsSet(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, TSentryImportMappingDataRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldBegin(OVERWRITE_ROLE_FIELD_DESC);
- oprot.writeBool(struct.overwriteRole);
- oprot.writeFieldEnd();
- if (struct.mappingData != null) {
- oprot.writeFieldBegin(MAPPING_DATA_FIELD_DESC);
- struct.mappingData.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryImportMappingDataRequestTupleSchemeFactory implements SchemeFactory {
- public TSentryImportMappingDataRequestTupleScheme getScheme() {
- return new TSentryImportMappingDataRequestTupleScheme();
- }
- }
-
- private static class TSentryImportMappingDataRequestTupleScheme extends TupleScheme<TSentryImportMappingDataRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryImportMappingDataRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeBool(struct.overwriteRole);
- struct.mappingData.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryImportMappingDataRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.overwriteRole = iprot.readBool();
- struct.setOverwriteRoleIsSet(true);
- struct.mappingData = new TSentryMappingData();
- struct.mappingData.read(iprot);
- struct.setMappingDataIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryImportMappingDataResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryImportMappingDataResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryImportMappingDataResponse.java
deleted file mode 100644
index 952c478..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryImportMappingDataResponse.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/**
- * 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.provider.db.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 TSentryImportMappingDataResponse implements org.apache.thrift.TBase<TSentryImportMappingDataResponse, TSentryImportMappingDataResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryImportMappingDataResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryImportMappingDataResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryImportMappingDataResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryImportMappingDataResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.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)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryImportMappingDataResponse.class, metaDataMap);
- }
-
- public TSentryImportMappingDataResponse() {
- }
-
- public TSentryImportMappingDataResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryImportMappingDataResponse(TSentryImportMappingDataResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- }
-
- public TSentryImportMappingDataResponse deepCopy() {
- return new TSentryImportMappingDataResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryImportMappingDataResponse)
- return this.equals((TSentryImportMappingDataResponse)that);
- return false;
- }
-
- public boolean equals(TSentryImportMappingDataResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryImportMappingDataResponse 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;
- }
- }
- 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("TSentryImportMappingDataResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // 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 {
- 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 TSentryImportMappingDataResponseStandardSchemeFactory implements SchemeFactory {
- public TSentryImportMappingDataResponseStandardScheme getScheme() {
- return new TSentryImportMappingDataResponseStandardScheme();
- }
- }
-
- private static class TSentryImportMappingDataResponseStandardScheme extends StandardScheme<TSentryImportMappingDataResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryImportMappingDataResponse 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;
- 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, TSentryImportMappingDataResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryImportMappingDataResponseTupleSchemeFactory implements SchemeFactory {
- public TSentryImportMappingDataResponseTupleScheme getScheme() {
- return new TSentryImportMappingDataResponseTupleScheme();
- }
- }
-
- private static class TSentryImportMappingDataResponseTupleScheme extends TupleScheme<TSentryImportMappingDataResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryImportMappingDataResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryImportMappingDataResponse 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);
- }
- }
-
-}
-
[42/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesRequest.java
deleted file mode 100644
index ada86ae..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesRequest.java
+++ /dev/null
@@ -1,957 +0,0 @@
-/**
- * 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.provider.db.generic.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 TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TListSentryPrivilegesRequest, TListSentryPrivilegesRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
- private static final org.apache.thrift.protocol.TField SERVICE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("serviceName", org.apache.thrift.protocol.TType.STRING, (short)5);
- private static final org.apache.thrift.protocol.TField AUTHORIZABLES_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizables", org.apache.thrift.protocol.TType.LIST, (short)6);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryPrivilegesRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryPrivilegesRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private String component; // required
- private String serviceName; // required
- private List<TAuthorizable> authorizables; // optional
-
- /** 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName"),
- COMPONENT((short)4, "component"),
- SERVICE_NAME((short)5, "serviceName"),
- AUTHORIZABLES((short)6, "authorizables");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- case 4: // COMPONENT
- return COMPONENT;
- case 5: // SERVICE_NAME
- return SERVICE_NAME;
- case 6: // AUTHORIZABLES
- return AUTHORIZABLES;
- 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 byte __isset_bitfield = 0;
- private static final _Fields optionals[] = {_Fields.AUTHORIZABLES};
- 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.SERVICE_NAME, new org.apache.thrift.meta_data.FieldMetaData("serviceName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.AUTHORIZABLES, new org.apache.thrift.meta_data.FieldMetaData("authorizables", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAuthorizable.class))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesRequest.class, metaDataMap);
- }
-
- public TListSentryPrivilegesRequest() {
- this.protocol_version = 2;
-
- }
-
- public TListSentryPrivilegesRequest(
- int protocol_version,
- String requestorUserName,
- String roleName,
- String component,
- String serviceName)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- this.component = component;
- this.serviceName = serviceName;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryPrivilegesRequest(TListSentryPrivilegesRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetComponent()) {
- this.component = other.component;
- }
- if (other.isSetServiceName()) {
- this.serviceName = other.serviceName;
- }
- if (other.isSetAuthorizables()) {
- List<TAuthorizable> __this__authorizables = new ArrayList<TAuthorizable>(other.authorizables.size());
- for (TAuthorizable other_element : other.authorizables) {
- __this__authorizables.add(new TAuthorizable(other_element));
- }
- this.authorizables = __this__authorizables;
- }
- }
-
- public TListSentryPrivilegesRequest deepCopy() {
- return new TListSentryPrivilegesRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.component = null;
- this.serviceName = null;
- this.authorizables = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public String getComponent() {
- return this.component;
- }
-
- public void setComponent(String component) {
- this.component = component;
- }
-
- public void unsetComponent() {
- this.component = null;
- }
-
- /** Returns true if field component is set (has been assigned a value) and false otherwise */
- public boolean isSetComponent() {
- return this.component != null;
- }
-
- public void setComponentIsSet(boolean value) {
- if (!value) {
- this.component = null;
- }
- }
-
- public String getServiceName() {
- return this.serviceName;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- public void unsetServiceName() {
- this.serviceName = null;
- }
-
- /** Returns true if field serviceName is set (has been assigned a value) and false otherwise */
- public boolean isSetServiceName() {
- return this.serviceName != null;
- }
-
- public void setServiceNameIsSet(boolean value) {
- if (!value) {
- this.serviceName = null;
- }
- }
-
- public int getAuthorizablesSize() {
- return (this.authorizables == null) ? 0 : this.authorizables.size();
- }
-
- public java.util.Iterator<TAuthorizable> getAuthorizablesIterator() {
- return (this.authorizables == null) ? null : this.authorizables.iterator();
- }
-
- public void addToAuthorizables(TAuthorizable elem) {
- if (this.authorizables == null) {
- this.authorizables = new ArrayList<TAuthorizable>();
- }
- this.authorizables.add(elem);
- }
-
- public List<TAuthorizable> getAuthorizables() {
- return this.authorizables;
- }
-
- public void setAuthorizables(List<TAuthorizable> authorizables) {
- this.authorizables = authorizables;
- }
-
- public void unsetAuthorizables() {
- this.authorizables = null;
- }
-
- /** Returns true if field authorizables is set (has been assigned a value) and false otherwise */
- public boolean isSetAuthorizables() {
- return this.authorizables != null;
- }
-
- public void setAuthorizablesIsSet(boolean value) {
- if (!value) {
- this.authorizables = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case COMPONENT:
- if (value == null) {
- unsetComponent();
- } else {
- setComponent((String)value);
- }
- break;
-
- case SERVICE_NAME:
- if (value == null) {
- unsetServiceName();
- } else {
- setServiceName((String)value);
- }
- break;
-
- case AUTHORIZABLES:
- if (value == null) {
- unsetAuthorizables();
- } else {
- setAuthorizables((List<TAuthorizable>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case COMPONENT:
- return getComponent();
-
- case SERVICE_NAME:
- return getServiceName();
-
- case AUTHORIZABLES:
- return getAuthorizables();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case COMPONENT:
- return isSetComponent();
- case SERVICE_NAME:
- return isSetServiceName();
- case AUTHORIZABLES:
- return isSetAuthorizables();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryPrivilegesRequest)
- return this.equals((TListSentryPrivilegesRequest)that);
- return false;
- }
-
- public boolean equals(TListSentryPrivilegesRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- boolean this_present_component = true && this.isSetComponent();
- boolean that_present_component = true && that.isSetComponent();
- if (this_present_component || that_present_component) {
- if (!(this_present_component && that_present_component))
- return false;
- if (!this.component.equals(that.component))
- return false;
- }
-
- boolean this_present_serviceName = true && this.isSetServiceName();
- boolean that_present_serviceName = true && that.isSetServiceName();
- if (this_present_serviceName || that_present_serviceName) {
- if (!(this_present_serviceName && that_present_serviceName))
- return false;
- if (!this.serviceName.equals(that.serviceName))
- return false;
- }
-
- boolean this_present_authorizables = true && this.isSetAuthorizables();
- boolean that_present_authorizables = true && that.isSetAuthorizables();
- if (this_present_authorizables || that_present_authorizables) {
- if (!(this_present_authorizables && that_present_authorizables))
- return false;
- if (!this.authorizables.equals(that.authorizables))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- boolean present_component = true && (isSetComponent());
- list.add(present_component);
- if (present_component)
- list.add(component);
-
- boolean present_serviceName = true && (isSetServiceName());
- list.add(present_serviceName);
- if (present_serviceName)
- list.add(serviceName);
-
- boolean present_authorizables = true && (isSetAuthorizables());
- list.add(present_authorizables);
- if (present_authorizables)
- list.add(authorizables);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TListSentryPrivilegesRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetComponent()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetServiceName()).compareTo(other.isSetServiceName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetServiceName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serviceName, other.serviceName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetAuthorizables()).compareTo(other.isSetAuthorizables());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAuthorizables()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizables, other.authorizables);
- 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("TListSentryPrivilegesRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("component:");
- if (this.component == null) {
- sb.append("null");
- } else {
- sb.append(this.component);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("serviceName:");
- if (this.serviceName == null) {
- sb.append("null");
- } else {
- sb.append(this.serviceName);
- }
- first = false;
- if (isSetAuthorizables()) {
- if (!first) sb.append(", ");
- sb.append("authorizables:");
- if (this.authorizables == null) {
- sb.append("null");
- } else {
- sb.append(this.authorizables);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- if (!isSetComponent()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
- }
-
- if (!isSetServiceName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'serviceName' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TListSentryPrivilegesRequestStandardSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesRequestStandardScheme getScheme() {
- return new TListSentryPrivilegesRequestStandardScheme();
- }
- }
-
- private static class TListSentryPrivilegesRequestStandardScheme extends StandardScheme<TListSentryPrivilegesRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // COMPONENT
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // SERVICE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.serviceName = iprot.readString();
- struct.setServiceNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 6: // AUTHORIZABLES
- if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list40 = iprot.readListBegin();
- struct.authorizables = new ArrayList<TAuthorizable>(_list40.size);
- TAuthorizable _elem41;
- for (int _i42 = 0; _i42 < _list40.size; ++_i42)
- {
- _elem41 = new TAuthorizable();
- _elem41.read(iprot);
- struct.authorizables.add(_elem41);
- }
- iprot.readListEnd();
- }
- struct.setAuthorizablesIsSet(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, TListSentryPrivilegesRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.component != null) {
- oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
- oprot.writeString(struct.component);
- oprot.writeFieldEnd();
- }
- if (struct.serviceName != null) {
- oprot.writeFieldBegin(SERVICE_NAME_FIELD_DESC);
- oprot.writeString(struct.serviceName);
- oprot.writeFieldEnd();
- }
- if (struct.authorizables != null) {
- if (struct.isSetAuthorizables()) {
- oprot.writeFieldBegin(AUTHORIZABLES_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.authorizables.size()));
- for (TAuthorizable _iter43 : struct.authorizables)
- {
- _iter43.write(oprot);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryPrivilegesRequestTupleSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesRequestTupleScheme getScheme() {
- return new TListSentryPrivilegesRequestTupleScheme();
- }
- }
-
- private static class TListSentryPrivilegesRequestTupleScheme extends TupleScheme<TListSentryPrivilegesRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- oprot.writeString(struct.component);
- oprot.writeString(struct.serviceName);
- BitSet optionals = new BitSet();
- if (struct.isSetAuthorizables()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetAuthorizables()) {
- {
- oprot.writeI32(struct.authorizables.size());
- for (TAuthorizable _iter44 : struct.authorizables)
- {
- _iter44.write(oprot);
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- struct.serviceName = iprot.readString();
- struct.setServiceNameIsSet(true);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- {
- org.apache.thrift.protocol.TList _list45 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.authorizables = new ArrayList<TAuthorizable>(_list45.size);
- TAuthorizable _elem46;
- for (int _i47 = 0; _i47 < _list45.size; ++_i47)
- {
- _elem46 = new TAuthorizable();
- _elem46.read(iprot);
- struct.authorizables.add(_elem46);
- }
- }
- struct.setAuthorizablesIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesResponse.java
deleted file mode 100644
index 8b567e9..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesResponse.java
+++ /dev/null
@@ -1,555 +0,0 @@
-/**
- * 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.provider.db.generic.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 TListSentryPrivilegesResponse implements org.apache.thrift.TBase<TListSentryPrivilegesResponse, TListSentryPrivilegesResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesResponse");
-
- 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 PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryPrivilegesResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryPrivilegesResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
- private Set<TSentryPrivilege> privileges; // optional
-
- /** 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"),
- PRIVILEGES((short)2, "privileges");
-
- 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: // PRIVILEGES
- return PRIVILEGES;
- 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 _Fields optionals[] = {_Fields.PRIVILEGES};
- 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.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
- tmpMap.put(_Fields.PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("privileges", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesResponse.class, metaDataMap);
- }
-
- public TListSentryPrivilegesResponse() {
- }
-
- public TListSentryPrivilegesResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryPrivilegesResponse(TListSentryPrivilegesResponse other) {
- if (other.isSetStatus()) {
- this.status = other.status;
- }
- if (other.isSetPrivileges()) {
- Set<TSentryPrivilege> __this__privileges = new HashSet<TSentryPrivilege>(other.privileges.size());
- for (TSentryPrivilege other_element : other.privileges) {
- __this__privileges.add(new TSentryPrivilege(other_element));
- }
- this.privileges = __this__privileges;
- }
- }
-
- public TListSentryPrivilegesResponse deepCopy() {
- return new TListSentryPrivilegesResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- this.privileges = null;
- }
-
- 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 int getPrivilegesSize() {
- return (this.privileges == null) ? 0 : this.privileges.size();
- }
-
- public java.util.Iterator<TSentryPrivilege> getPrivilegesIterator() {
- return (this.privileges == null) ? null : this.privileges.iterator();
- }
-
- public void addToPrivileges(TSentryPrivilege elem) {
- if (this.privileges == null) {
- this.privileges = new HashSet<TSentryPrivilege>();
- }
- this.privileges.add(elem);
- }
-
- public Set<TSentryPrivilege> getPrivileges() {
- return this.privileges;
- }
-
- public void setPrivileges(Set<TSentryPrivilege> privileges) {
- this.privileges = privileges;
- }
-
- public void unsetPrivileges() {
- this.privileges = null;
- }
-
- /** Returns true if field privileges is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivileges() {
- return this.privileges != null;
- }
-
- public void setPrivilegesIsSet(boolean value) {
- if (!value) {
- this.privileges = null;
- }
- }
-
- 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 PRIVILEGES:
- if (value == null) {
- unsetPrivileges();
- } else {
- setPrivileges((Set<TSentryPrivilege>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- case PRIVILEGES:
- return getPrivileges();
-
- }
- 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 PRIVILEGES:
- return isSetPrivileges();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryPrivilegesResponse)
- return this.equals((TListSentryPrivilegesResponse)that);
- return false;
- }
-
- public boolean equals(TListSentryPrivilegesResponse 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_privileges = true && this.isSetPrivileges();
- boolean that_present_privileges = true && that.isSetPrivileges();
- if (this_present_privileges || that_present_privileges) {
- if (!(this_present_privileges && that_present_privileges))
- return false;
- if (!this.privileges.equals(that.privileges))
- 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_privileges = true && (isSetPrivileges());
- list.add(present_privileges);
- if (present_privileges)
- list.add(privileges);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TListSentryPrivilegesResponse 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(isSetPrivileges()).compareTo(other.isSetPrivileges());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivileges()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, other.privileges);
- 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("TListSentryPrivilegesResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- if (isSetPrivileges()) {
- if (!first) sb.append(", ");
- sb.append("privileges:");
- if (this.privileges == null) {
- sb.append("null");
- } else {
- sb.append(this.privileges);
- }
- 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());
- }
-
- // check for sub-struct validity
- }
-
- 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 TListSentryPrivilegesResponseStandardSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesResponseStandardScheme getScheme() {
- return new TListSentryPrivilegesResponseStandardScheme();
- }
- }
-
- private static class TListSentryPrivilegesResponseStandardScheme extends StandardScheme<TListSentryPrivilegesResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesResponse 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: // PRIVILEGES
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set48 = iprot.readSetBegin();
- struct.privileges = new HashSet<TSentryPrivilege>(2*_set48.size);
- TSentryPrivilege _elem49;
- for (int _i50 = 0; _i50 < _set48.size; ++_i50)
- {
- _elem49 = new TSentryPrivilege();
- _elem49.read(iprot);
- struct.privileges.add(_elem49);
- }
- iprot.readSetEnd();
- }
- struct.setPrivilegesIsSet(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, TListSentryPrivilegesResponse 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();
- }
- if (struct.privileges != null) {
- if (struct.isSetPrivileges()) {
- oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.privileges.size()));
- for (TSentryPrivilege _iter51 : struct.privileges)
- {
- _iter51.write(oprot);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryPrivilegesResponseTupleSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesResponseTupleScheme getScheme() {
- return new TListSentryPrivilegesResponseTupleScheme();
- }
- }
-
- private static class TListSentryPrivilegesResponseTupleScheme extends TupleScheme<TListSentryPrivilegesResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- BitSet optionals = new BitSet();
- if (struct.isSetPrivileges()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetPrivileges()) {
- {
- oprot.writeI32(struct.privileges.size());
- for (TSentryPrivilege _iter52 : struct.privileges)
- {
- _iter52.write(oprot);
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesResponse 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);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- {
- org.apache.thrift.protocol.TSet _set53 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.privileges = new HashSet<TSentryPrivilege>(2*_set53.size);
- TSentryPrivilege _elem54;
- for (int _i55 = 0; _i55 < _set53.size; ++_i55)
- {
- _elem54 = new TSentryPrivilege();
- _elem54.read(iprot);
- struct.privileges.add(_elem54);
- }
- }
- struct.setPrivilegesIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryRolesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryRolesRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryRolesRequest.java
deleted file mode 100644
index 9ec5aef..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryRolesRequest.java
+++ /dev/null
@@ -1,701 +0,0 @@
-/**
- * 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.provider.db.generic.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 TListSentryRolesRequest implements org.apache.thrift.TBase<TListSentryRolesRequest, TListSentryRolesRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryRolesRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryRolesRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField GROUP_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("groupName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryRolesRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryRolesRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String groupName; // optional
- private String component; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- GROUP_NAME((short)3, "groupName"),
- COMPONENT((short)4, "component");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // GROUP_NAME
- return GROUP_NAME;
- case 4: // COMPONENT
- return COMPONENT;
- 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 byte __isset_bitfield = 0;
- private static final _Fields optionals[] = {_Fields.GROUP_NAME};
- 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.GROUP_NAME, new org.apache.thrift.meta_data.FieldMetaData("groupName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryRolesRequest.class, metaDataMap);
- }
-
- public TListSentryRolesRequest() {
- this.protocol_version = 2;
-
- }
-
- public TListSentryRolesRequest(
- int protocol_version,
- String requestorUserName,
- String component)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.component = component;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryRolesRequest(TListSentryRolesRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetGroupName()) {
- this.groupName = other.groupName;
- }
- if (other.isSetComponent()) {
- this.component = other.component;
- }
- }
-
- public TListSentryRolesRequest deepCopy() {
- return new TListSentryRolesRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.groupName = null;
- this.component = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getGroupName() {
- return this.groupName;
- }
-
- public void setGroupName(String groupName) {
- this.groupName = groupName;
- }
-
- public void unsetGroupName() {
- this.groupName = null;
- }
-
- /** Returns true if field groupName is set (has been assigned a value) and false otherwise */
- public boolean isSetGroupName() {
- return this.groupName != null;
- }
-
- public void setGroupNameIsSet(boolean value) {
- if (!value) {
- this.groupName = null;
- }
- }
-
- public String getComponent() {
- return this.component;
- }
-
- public void setComponent(String component) {
- this.component = component;
- }
-
- public void unsetComponent() {
- this.component = null;
- }
-
- /** Returns true if field component is set (has been assigned a value) and false otherwise */
- public boolean isSetComponent() {
- return this.component != null;
- }
-
- public void setComponentIsSet(boolean value) {
- if (!value) {
- this.component = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case GROUP_NAME:
- if (value == null) {
- unsetGroupName();
- } else {
- setGroupName((String)value);
- }
- break;
-
- case COMPONENT:
- if (value == null) {
- unsetComponent();
- } else {
- setComponent((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case GROUP_NAME:
- return getGroupName();
-
- case COMPONENT:
- return getComponent();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case GROUP_NAME:
- return isSetGroupName();
- case COMPONENT:
- return isSetComponent();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryRolesRequest)
- return this.equals((TListSentryRolesRequest)that);
- return false;
- }
-
- public boolean equals(TListSentryRolesRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_groupName = true && this.isSetGroupName();
- boolean that_present_groupName = true && that.isSetGroupName();
- if (this_present_groupName || that_present_groupName) {
- if (!(this_present_groupName && that_present_groupName))
- return false;
- if (!this.groupName.equals(that.groupName))
- return false;
- }
-
- boolean this_present_component = true && this.isSetComponent();
- boolean that_present_component = true && that.isSetComponent();
- if (this_present_component || that_present_component) {
- if (!(this_present_component && that_present_component))
- return false;
- if (!this.component.equals(that.component))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_groupName = true && (isSetGroupName());
- list.add(present_groupName);
- if (present_groupName)
- list.add(groupName);
-
- boolean present_component = true && (isSetComponent());
- list.add(present_component);
- if (present_component)
- list.add(component);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TListSentryRolesRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGroupName()).compareTo(other.isSetGroupName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroupName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groupName, other.groupName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetComponent()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
- 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("TListSentryRolesRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (isSetGroupName()) {
- if (!first) sb.append(", ");
- sb.append("groupName:");
- if (this.groupName == null) {
- sb.append("null");
- } else {
- sb.append(this.groupName);
- }
- first = false;
- }
- if (!first) sb.append(", ");
- sb.append("component:");
- if (this.component == null) {
- sb.append("null");
- } else {
- sb.append(this.component);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetComponent()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TListSentryRolesRequestStandardSchemeFactory implements SchemeFactory {
- public TListSentryRolesRequestStandardScheme getScheme() {
- return new TListSentryRolesRequestStandardScheme();
- }
- }
-
- private static class TListSentryRolesRequestStandardScheme extends StandardScheme<TListSentryRolesRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryRolesRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // GROUP_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.groupName = iprot.readString();
- struct.setGroupNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // COMPONENT
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.component = iprot.readString();
- struct.setComponentIsSet(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, TListSentryRolesRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.groupName != null) {
- if (struct.isSetGroupName()) {
- oprot.writeFieldBegin(GROUP_NAME_FIELD_DESC);
- oprot.writeString(struct.groupName);
- oprot.writeFieldEnd();
- }
- }
- if (struct.component != null) {
- oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
- oprot.writeString(struct.component);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryRolesRequestTupleSchemeFactory implements SchemeFactory {
- public TListSentryRolesRequestTupleScheme getScheme() {
- return new TListSentryRolesRequestTupleScheme();
- }
- }
-
- private static class TListSentryRolesRequestTupleScheme extends TupleScheme<TListSentryRolesRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.component);
- BitSet optionals = new BitSet();
- if (struct.isSetGroupName()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetGroupName()) {
- oprot.writeString(struct.groupName);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.groupName = iprot.readString();
- struct.setGroupNameIsSet(true);
- }
- }
- }
-
-}
-
[12/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java
deleted file mode 100644
index 27bbc93..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java
+++ /dev/null
@@ -1,1102 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless createRequired by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import org.apache.sentry.core.common.ActiveRoleSet;
-import org.apache.sentry.core.common.Authorizable;
-import org.apache.sentry.core.model.db.AccessConstants;
-import org.apache.sentry.core.model.db.AccessURI;
-import org.apache.sentry.core.model.db.Database;
-import org.apache.sentry.core.model.db.Server;
-import org.apache.sentry.core.model.db.Table;
-import org.apache.sentry.core.common.exception.SentryAccessDeniedException;
-import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.junit.Test;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-
-public class TestSentryServiceIntegration extends SentryServiceIntegrationBase {
-
- @Test
- public void testCreateDropShowRole() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- String roleName = "admin_r";
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName);
-
- client.createRole(requestorUserName, roleName);
-
- Set<TSentryRole> roles = client.listAllRoles(requestorUserName);
- assertEquals("Incorrect number of roles", 1, roles.size());
-
- for (TSentryRole role:roles) {
- assertTrue(role.getRoleName(), role.getRoleName().equalsIgnoreCase(roleName));
- }
- client.dropRole(requestorUserName, roleName);
- }});
- }
-
- @Test
- public void testGranRevokePrivilegeOnTableForRole() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
- String roleName1 = "admin_r1";
- String roleName2 = "admin_r2";
-
- client.dropRoleIfExists(requestorUserName, roleName1);
- client.createRole(requestorUserName, roleName1);
-
- client.grantTablePrivilege(requestorUserName, roleName1, "server", "db1", "table1", "ALL");
- client.grantTablePrivilege(requestorUserName, roleName1, "server", "db1", "table2", "ALL");
- client.grantTablePrivilege(requestorUserName, roleName1, "server", "db2", "table3", "ALL");
- client.grantTablePrivilege(requestorUserName, roleName1, "server", "db2", "table4", "ALL");
-
-
- client.dropRoleIfExists(requestorUserName, roleName2);
- client.createRole(requestorUserName, roleName2);
-
- client.grantTablePrivilege(requestorUserName, roleName2, "server", "db1", "table1", "ALL");
- client.grantTablePrivilege(requestorUserName, roleName2, "server", "db1", "table2", "ALL");
- client.grantTablePrivilege(requestorUserName, roleName2, "server", "db2", "table3", "ALL");
- client.grantTablePrivilege(requestorUserName, roleName2, "server", "db2", "table4", "ALL");
-
- Set<TSentryPrivilege> listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
- assertEquals("Privilege not assigned to role1 !!", 4, listPrivilegesByRoleName.size());
-
- listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
- assertEquals("Privilege not assigned to role2 !!", 4, listPrivilegesByRoleName.size());
-
-
- client.revokeTablePrivilege(requestorUserName, roleName1, "server", "db1", "table1", "ALL");
- listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
- assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 3);
- listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
- assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 4);
-
- client.revokeTablePrivilege(requestorUserName, roleName2, "server", "db1", "table1", "ALL");
- listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
- assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 3);
- listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
- assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 3);
-
- client.revokeTablePrivilege(requestorUserName, roleName1, "server", "db1", "table2", "ALL");
- client.revokeTablePrivilege(requestorUserName, roleName1, "server", "db2", "table3", "ALL");
- client.revokeTablePrivilege(requestorUserName, roleName1, "server", "db2", "table4", "ALL");
- listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
- assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 0);
-
- client.revokeTablePrivilege(requestorUserName, roleName2, "server", "db1", "table2", "ALL");
- client.revokeTablePrivilege(requestorUserName, roleName2, "server", "db2", "table3", "ALL");
- client.revokeTablePrivilege(requestorUserName, roleName2, "server", "db2", "table4", "ALL");
- listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
- assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 0);
- }});
- }
-
- @Test
- public void testAddDeleteRolesForUser() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
-
- // user1->group1
- // user2->group1
- // user3->group1, group2
- // user4->group2, group3
- // group1->r1
- // group2->r2
- // group3->r2
- // user2->r3
- // user4->r3
- String roleName1 = "r1";
- String roleName2 = "r2";
- String roleName3 = "r3";
- String user1 = "u1";
- String user2 = "u2";
- String user3 = "u3";
- String user4 = "u4";
- String group1 = "g1";
- String group2 = "g2";
- String group3 = "g3";
- Map<String, Set<String>> userToGroups = Maps.newHashMap();
- userToGroups.put(user1, Sets.newHashSet(group1));
- userToGroups.put(user2, Sets.newHashSet(group1));
- userToGroups.put(user3, Sets.newHashSet(group1, group2));
- userToGroups.put(user4, Sets.newHashSet(group2, group3));
-
- setLocalGroupMapping(user1, Sets.newHashSet(group1));
- setLocalGroupMapping(user2, Sets.newHashSet(group1));
- setLocalGroupMapping(user3, Sets.newHashSet(group1, group2));
- setLocalGroupMapping(user4, Sets.newHashSet(group2, group3));
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName1);
- client.dropRoleIfExists(requestorUserName, roleName2);
- client.dropRoleIfExists(requestorUserName, roleName3);
- client.createRole(requestorUserName, roleName1);
- client.createRole(requestorUserName, roleName2);
- client.createRole(requestorUserName, roleName3);
-
- client.grantRoleToGroup(requestorUserName, group1, roleName1);
- client.grantRoleToUser(requestorUserName, user2, roleName2);
- client.grantRoleToUser(requestorUserName, user3, roleName2);
- client.grantRoleToUser(requestorUserName, user2, roleName3);
- client.grantRoleToUsers(requestorUserName, roleName3, Sets.newHashSet(user4));
- // following test cases also test the grantRoleToUser() and grantRoleToUsers() implicity
- // admin always can get the role list
- Set<TSentryRole> roles = client.listRolesByUserName(requestorUserName, user1);
- assertEquals(0, roles.size());
- // the role list includes the role for user and the role for user's group
- roles = client.listRolesByUserName(requestorUserName, user2);
- assertEquals(2, roles.size());
- for (TSentryRole role : roles) {
- assertTrue(roleName2.equals(role.getRoleName()) || roleName3.equals(role.getRoleName()));
- }
- // user has 2 groups whose role list are different
- roles = client.listRolesByUserName(requestorUserName, user3);
- assertEquals(1, roles.size());
- for (TSentryRole role : roles) {
- assertTrue(roleName2.equals(role.getRoleName()));
- }
- // user has 2 groups whose role list are the same
- roles = client.listRolesByUserName(requestorUserName, user4);
- assertEquals(1, roles.size());
- for (TSentryRole role : roles) {
- assertTrue(roleName3.equals(role.getRoleName()));
- }
- // user can get his own role list if he isn't an admin
- roles = client.listRolesByUserName(user3, user3);
- assertEquals(1, roles.size());
- // user can't get other's role list if he isn't an admin
- try {
- client.listRolesByUserName(user3, user2);
- fail("SentryAccessDeniedException should be caught.");
- } catch (SentryAccessDeniedException e) {
- // excepted exception
- }
- // the user's name can't be empty
- try {
- client.listRolesByUserName(user3, "");
- fail("SentryAccessDeniedException should be caught.");
- } catch (SentryAccessDeniedException e) {
- // excepted exception
- }
- client.revokeRoleFromUser(requestorUserName, user2, roleName3);
- client.revokeRoleFromUsers(requestorUserName, roleName3, Sets.newHashSet(user4));
- // test the result of revokeRoleFromUser() and revokeRoleFromUsers()
- roles = client.listRolesByUserName(requestorUserName, user2);
- assertEquals(1, roles.size());
- for (TSentryRole role : roles) {
- assertTrue(roleName2.equals(role.getRoleName()));
- }
- roles = client.listRolesByUserName(requestorUserName, user4);
- assertEquals(0, roles.size());
- }
- });
- }
-
- @Test
- public void testGranRevokePrivilegeForRoleWithUG() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
-
- // user1_1->group1
- // user1_2->group1
- // user2_1->group2
- // user2_2->group2
- // group1->r1
- // group2->r2
- // user1_1->r3
- // user2_1->r4
- String roleName1 = "r1";
- String roleName2 = "r2";
- String roleName3 = "r3";
- String roleName4 = "r4";
- String user1_1 = "u1_1";
- String user1_2 = "u1_2";
- String user2_1 = "u2_1";
- String user2_2 = "u2_2";
- String group1 = "g1";
- String group2 = "g2";
- Map<String, String> userToGroup = Maps.newHashMap();
- userToGroup.put(user1_1, group1);
- userToGroup.put(user1_2, group1);
- userToGroup.put(user2_1, group2);
- userToGroup.put(user2_2, user2_1);
-
- Set<String> groupSet = Sets.newHashSet(group1);
- setLocalGroupMapping(user1_1, groupSet);
- setLocalGroupMapping(user1_2, groupSet);
- groupSet = Sets.newHashSet(group2);
- setLocalGroupMapping(user2_1, groupSet);
- setLocalGroupMapping(user2_2, groupSet);
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName1);
- client.dropRoleIfExists(requestorUserName, roleName2);
- client.dropRoleIfExists(requestorUserName, roleName3);
- client.dropRoleIfExists(requestorUserName, roleName4);
- client.createRole(requestorUserName, roleName1);
- client.createRole(requestorUserName, roleName2);
- client.createRole(requestorUserName, roleName3);
- client.createRole(requestorUserName, roleName4);
-
- client.grantRoleToGroup(requestorUserName, group1, roleName1);
- client.grantRoleToGroup(requestorUserName, group2, roleName2);
- client.grantRoleToUser(requestorUserName, user1_1, roleName3);
- client.grantRoleToUsers(requestorUserName, roleName4, Sets.newHashSet(user2_1));
-
- client
- .grantTablePrivilege(requestorUserName, roleName1, "server", "db1", "table1_1", "ALL");
- client
- .grantTablePrivilege(requestorUserName, roleName1, "server", "db1", "table1_2", "ALL");
- client
- .grantTablePrivilege(requestorUserName, roleName2, "server", "db1", "table2_1", "ALL");
- client
- .grantTablePrivilege(requestorUserName, roleName2, "server", "db1", "table2_2", "ALL");
- client
- .grantTablePrivilege(requestorUserName, roleName3, "server", "db1", "table3_1", "ALL");
- client
- .grantTablePrivilege(requestorUserName, roleName3, "server", "db1", "table3_2", "ALL");
- client
- .grantTablePrivilege(requestorUserName, roleName4, "server", "db1", "table4_1", "ALL");
- client
- .grantTablePrivilege(requestorUserName, roleName4, "server", "db1", "table4_2", "ALL");
-
- Set<String> listPrivilegesForProvider = client.listPrivilegesForProvider(
- Sets.newHashSet(group1), Sets.newHashSet(""), ActiveRoleSet.ALL, (Authorizable[]) null);
- assertEquals("Privilege not correctly assigned to roles !!", Sets.newHashSet(
- "server=server->db=db1->table=table1_1->action=all",
- "server=server->db=db1->table=table1_2->action=all"), listPrivilegesForProvider);
-
- listPrivilegesForProvider = client.listPrivilegesForProvider(
- Sets.newHashSet(userToGroup.get(user1_2)),
- Sets.newHashSet(user1_2), ActiveRoleSet.ALL, (Authorizable[]) null);
- assertEquals("Privilege not correctly assigned to roles !!", Sets.newHashSet(
- "server=server->db=db1->table=table1_1->action=all",
- "server=server->db=db1->table=table1_2->action=all"), listPrivilegesForProvider);
-
- listPrivilegesForProvider = client.listPrivilegesForProvider(
- Sets.newHashSet(userToGroup.get(user1_1)),
- Sets.newHashSet(user1_1), ActiveRoleSet.ALL, (Authorizable[]) null);
- assertEquals("Privilege not correctly assigned to roles !!", Sets.newHashSet(
- "server=server->db=db1->table=table1_1->action=all",
- "server=server->db=db1->table=table1_2->action=all",
- "server=server->db=db1->table=table3_1->action=all",
- "server=server->db=db1->table=table3_2->action=all"), listPrivilegesForProvider);
-
- listPrivilegesForProvider = client.listPrivilegesForProvider(Sets.newHashSet(group1),
- Sets.newHashSet(user1_1, user1_2), ActiveRoleSet.ALL, (Authorizable[]) null);
- assertEquals("Privilege not correctly assigned to roles !!", Sets.newHashSet(
- "server=server->db=db1->table=table1_1->action=all",
- "server=server->db=db1->table=table1_2->action=all",
- "server=server->db=db1->table=table3_1->action=all",
- "server=server->db=db1->table=table3_2->action=all"), listPrivilegesForProvider);
-
- listPrivilegesForProvider = client.listPrivilegesForProvider(
- Sets.newHashSet(group1, group2), Sets.newHashSet(user1_1, user1_2, user2_1, user2_2),
- ActiveRoleSet.ALL, (Authorizable[]) null);
- assertEquals("Privilege not correctly assigned to roles !!", Sets.newHashSet(
- "server=server->db=db1->table=table1_1->action=all",
- "server=server->db=db1->table=table1_2->action=all",
- "server=server->db=db1->table=table2_1->action=all",
- "server=server->db=db1->table=table2_2->action=all",
- "server=server->db=db1->table=table3_1->action=all",
- "server=server->db=db1->table=table3_2->action=all",
- "server=server->db=db1->table=table4_1->action=all",
- "server=server->db=db1->table=table4_2->action=all"), listPrivilegesForProvider);
-
- client.revokeRoleFromUser(requestorUserName, user1_1, roleName3);
- client.revokeRoleFromUsers(requestorUserName, roleName4, Sets.newHashSet(user2_1));
- }
- });
- }
-
- @Test
- public void testMultipleRolesSamePrivilege() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
- String roleName1 = "admin_r1";
- String roleName2 = "admin_r2";
-
- client.dropRoleIfExists(requestorUserName, roleName1);
- client.createRole(requestorUserName, roleName1);
-
- client.dropRoleIfExists(requestorUserName, roleName2);
- client.createRole(requestorUserName, roleName2);
-
- client.grantTablePrivilege(requestorUserName, roleName1, "server", "db", "table", "ALL");
- Set<TSentryPrivilege> listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
- assertTrue("Privilege not assigned to role1 !!", listPrivilegesByRoleName.size() == 1);
-
- client.grantTablePrivilege(requestorUserName, roleName2, "server", "db", "table", "ALL");
- listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
- assertTrue("Privilege not assigned to role2 !!", listPrivilegesByRoleName.size() == 1);
- }});
- }
-
- @Test
- public void testShowRoleGrant() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- String roleName = "admin_testdb";
- String groupName = "group1";
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName);
- client.createRole(requestorUserName, roleName);
-
- Set<TSentryRole> roles = client.listAllRoles(requestorUserName);
- assertEquals("Incorrect number of roles", 1, roles.size());
-
- client.grantRoleToGroup(requestorUserName, groupName, roleName);
- Set<TSentryRole> groupRoles = client.listRolesByGroupName(requestorUserName, groupName);
- assertTrue(groupRoles.size() == 1);
- for (TSentryRole role:groupRoles) {
- assertTrue(role.getRoleName(), role.getRoleName().equalsIgnoreCase(roleName));
- assertTrue(role.getGroups().size() == 1);
- for (TSentryGroup group :role.getGroups()) {
- assertTrue(group.getGroupName(), group.getGroupName().equalsIgnoreCase(groupName));
- }
- }
-
- client.dropRole(requestorUserName, roleName);
- }});
- }
-
- @Test
- public void testShowGrant() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- String roleName = "admin_testdb";
- String server = "server1";
- String db = "testDB";
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName);
- client.createRole(requestorUserName, roleName);
-
- Set<TSentryRole> roles = client.listAllRoles(requestorUserName);
- assertEquals("Incorrect number of roles", 1, roles.size());
-
- client.grantDatabasePrivilege(requestorUserName, roleName, server, db, AccessConstants.ALL);
- Set<TSentryPrivilege> privileges = client.listAllPrivilegesByRoleName(requestorUserName, roleName);
- assertTrue(privileges.size() == 1);
-
- client.revokeDatabasePrivilege(requestorUserName, roleName, server, db, AccessConstants.ALL);
- client.dropRole(requestorUserName, roleName);
- }});
- }
-
- //See SENTRY-166
- @Test
- public void testUriWithEquals() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- String roleName = "admin_testdb";
- String server = "server1";
- String uri = "file://u/w/h/t/partition=value/";
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- // Creating associated role
- client.dropRoleIfExists(requestorUserName, roleName);
- client.createRole(requestorUserName, roleName);
- Set<TSentryRole> roles = client.listAllRoles(requestorUserName);
- assertEquals("Incorrect number of roles", 1, roles.size());
-
- client.grantURIPrivilege(requestorUserName, roleName, server, uri);
- Set<TSentryPrivilege> privileges = client.listAllPrivilegesByRoleName(requestorUserName, roleName);
- assertTrue(privileges.size() == 1);
-
- // Revoking the same privilege
- client.revokeURIPrivilege(requestorUserName, roleName, server, uri);
- privileges = client.listAllPrivilegesByRoleName(requestorUserName, roleName);
- assertTrue(privileges.size() == 0);
-
- // Clean up
- client.dropRole(requestorUserName, roleName);
- }});
- }
-
-
- //See SENTRY-181
- @Test
- public void testSameGrantTwice() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
- String roleName = "admin_r1";
-
- client.createRole(requestorUserName, roleName);
- client.grantTablePrivilege(requestorUserName, roleName, "server", "db1", "table1", "ALL");
- client.grantTablePrivilege(requestorUserName, roleName, "server", "db1", "table1", "ALL");
- assertEquals(1, client.listAllPrivilegesByRoleName(requestorUserName, roleName).size());
- }});
- }
-
- @Test
- public void testGrantRevokeWithGrantOption() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- // Grant a privilege with Grant Option
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
- String roleName = "admin_r1";
- boolean grantOption = true;
- boolean withoutGrantOption = false;
-
- client.dropRoleIfExists(requestorUserName, roleName);
- client.createRole(requestorUserName, roleName);
-
- client.grantTablePrivilege(requestorUserName, roleName, "server", "db1", "table1", "ALL", grantOption);
- assertEquals(1, client.listAllPrivilegesByRoleName(requestorUserName, roleName).size());
-
- // Try to revoke the privilege without grantOption and can't revoke the privilege.
- client.revokeTablePrivilege(requestorUserName, roleName, "server", "db1", "table1", "ALL", withoutGrantOption);
- assertEquals(1, client.listAllPrivilegesByRoleName(requestorUserName, roleName).size());
-
- // Try to revoke the privilege with grantOption, the privilege will be revoked.
- client.revokeTablePrivilege(requestorUserName, roleName, "server", "db1", "table1", "ALL", grantOption);
- assertEquals(0, client.listAllPrivilegesByRoleName(requestorUserName, roleName).size());
- }});
- }
-
- @Test
- public void testGrantTwoPrivilegeDiffInGrantOption() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- // Grant a privilege with 'Grant Option'.
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
- String roleName = "admin_r1";
- boolean grantOption = true;
- boolean withoutGrantOption = false;
-
- client.dropRoleIfExists(requestorUserName, roleName);
- client.createRole(requestorUserName, roleName);
-
- client.grantTablePrivilege(requestorUserName, roleName, "server", "db1", "table1", "ALL", grantOption);
- assertEquals(1, client.listAllPrivilegesByRoleName(requestorUserName, roleName).size());
-
- // Grant a privilege without 'Grant Option'.
- client.grantTablePrivilege(requestorUserName, roleName, "server", "db1", "table1", "ALL", withoutGrantOption);
- assertEquals(2, client.listAllPrivilegesByRoleName(requestorUserName, roleName).size());
-
- // Use 'grantOption = null', the two privileges will be revoked.
- client.revokeTablePrivilege(requestorUserName, roleName, "server", "db1", "table1", "ALL", null);
- assertEquals(0, client.listAllPrivilegesByRoleName(requestorUserName, roleName).size());
- }});
- }
-
- @Test
- public void testGranRevokePrivilegeOnColumnForRole() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
- String roleName1 = "admin_r1";
- String roleName2 = "admin_r2";
-
- client.dropRoleIfExists(requestorUserName, roleName1);
- client.createRole(requestorUserName, roleName1);
-
- client.grantColumnPrivilege(requestorUserName, roleName1, "server", "db1", "table1", "col1", "ALL");
- client.grantColumnPrivilege(requestorUserName, roleName1, "server", "db1", "table1", "col2", "ALL");
- client.grantColumnPrivilege(requestorUserName, roleName1, "server", "db1", "table2", "col1", "ALL");
- client.grantColumnPrivilege(requestorUserName, roleName1, "server", "db1", "table2", "col2", "ALL");
- client.grantColumnPrivilege(requestorUserName, roleName1, "server", "db2", "table1", "col1", "ALL");
- client.grantColumnPrivilege(requestorUserName, roleName1, "server", "db2", "table2", "col1", "ALL");
-
-
- client.dropRoleIfExists(requestorUserName, roleName2);
- client.createRole(requestorUserName, roleName2);
-
- client.grantColumnPrivilege(requestorUserName, roleName2, "server", "db1", "table1", "col1", "ALL");
- client.grantColumnPrivilege(requestorUserName, roleName2, "server", "db1", "table1", "col2", "ALL");
- client.grantColumnPrivilege(requestorUserName, roleName2, "server", "db1", "table2", "col1", "ALL");
- client.grantColumnPrivilege(requestorUserName, roleName2, "server", "db1", "table2", "col2", "ALL");
- client.grantColumnPrivilege(requestorUserName, roleName2, "server", "db2", "table1", "col1", "ALL");
- client.grantColumnPrivilege(requestorUserName, roleName2, "server", "db2", "table2", "col1", "ALL");
-
- Set<TSentryPrivilege> listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
- assertEquals("Privilege not assigned to role1 !!", 6, listPrivilegesByRoleName.size());
-
- listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
- assertEquals("Privilege not assigned to role2 !!", 6, listPrivilegesByRoleName.size());
-
-
- client.revokeColumnPrivilege(requestorUserName, roleName1, "server", "db1", "table1", "col1", "ALL");
- listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
- assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 5);
- listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
- assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 6);
-
- client.revokeTablePrivilege(requestorUserName, roleName2, "server", "db1", "table1", "ALL");
- listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
- assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 4);
- listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
- assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 5);
-
- client.revokeDatabasePrivilege(requestorUserName, roleName1, "server", "db1", "ALL");
- listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
- assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 2);
- client.revokeColumnPrivilege(requestorUserName, roleName1, "server", "db2", "table1", "col1", "ALL");
- client.revokeColumnPrivilege(requestorUserName, roleName1, "server", "db2", "table2", "col1", "ALL");
- listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
- assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 0);
-
- client.revokeColumnPrivilege(requestorUserName, roleName2, "server", "db1", "table2", "col1", "ALL");
- client.revokeColumnPrivilege(requestorUserName, roleName2, "server", "db1", "table2", "col2", "ALL");
- client.revokeColumnPrivilege(requestorUserName, roleName2, "server", "db2", "table1", "col1", "ALL");
- client.revokeColumnPrivilege(requestorUserName, roleName2, "server", "db2", "table2", "col1", "ALL");
- listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
- assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 0);
- }});
- }
-
- @Test
- public void testListByAuthDB() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- String roleName1 = "role1";
- String roleName2 = "role2";
- Set<String> testRoleSet = Sets.newHashSet(roleName1, roleName2);
- String group1 = "group1";
- String group2 = "group2";
- Set<String> testGroupSet = Sets.newHashSet(group1, group2);
- String server = "server1";
- String db = "testDB";
- String db2 = "testDB2";
- String tab = "testTab";
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- String group1user = "group1user";
- setLocalGroupMapping(group1user, Sets.newHashSet(group1));
- String group2user = "group2user";
- setLocalGroupMapping(group2user, Sets.newHashSet(group2));
- setLocalGroupMapping("random", Sets.newHashSet("foo"));
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName1);
- client.createRole(requestorUserName, roleName1);
- client.dropRoleIfExists(requestorUserName, roleName2);
- client.createRole(requestorUserName, roleName2);
-
- TSentryPrivilege role1db1 = client.grantDatabasePrivilege(
- requestorUserName, roleName1, server, db, AccessConstants.SELECT);
- client.grantTablePrivilege(requestorUserName, roleName1, server, db, tab,
- AccessConstants.ALL);
- client.grantTablePrivilege(requestorUserName, roleName1, server, db2, tab,
- AccessConstants.SELECT);
- client.grantURIPrivilege(requestorUserName, roleName1, server, "hdfs:///fooUri");
- client.grantRoleToGroup(requestorUserName, group1, roleName1);
-
- TSentryPrivilege role2db1 = client.grantDatabasePrivilege(
- requestorUserName, roleName2, server, db,
- AccessConstants.ALL);
- client.grantDatabasePrivilege(requestorUserName, roleName2, server, db2,
- AccessConstants.SELECT);
- client.grantTablePrivilege(requestorUserName, roleName2, server, db2, tab,
- AccessConstants.ALL);
- client.grantRoleToGroup(requestorUserName, group2, roleName2);
-
- // build expected output
- TSentryPrivilegeMap db1RoleToPrivMap = new TSentryPrivilegeMap(
- new TreeMap<String, Set<TSentryPrivilege>>());
- db1RoleToPrivMap.getPrivilegeMap()
- .put(roleName1, Sets.newHashSet(role1db1));
- db1RoleToPrivMap.getPrivilegeMap()
- .put(roleName2, Sets.newHashSet(role2db1));
- Map<TSentryAuthorizable, TSentryPrivilegeMap> expectedResults = Maps
- .newTreeMap();
- List<? extends Authorizable> db1Authrizable = Lists.newArrayList(
- new Server(server), new Database(db));
- expectedResults.put(
- SentryPolicyServiceClientDefaultImpl.setupSentryAuthorizable(db1Authrizable),
- db1RoleToPrivMap);
-
- Set<List<? extends Authorizable>> authorizableSet = Sets.newHashSet();
- authorizableSet.add(db1Authrizable);
-
- // verify for null group and null roleset
- Map<TSentryAuthorizable, TSentryPrivilegeMap> authPrivMap = client
- .listPrivilegsbyAuthorizable(requestorUserName, authorizableSet, null, null);
- assertEquals(expectedResults, authPrivMap);
-
- // verify for null group and specific roleset
- authPrivMap = client.listPrivilegsbyAuthorizable(requestorUserName, authorizableSet,
- null, new ActiveRoleSet(testRoleSet));
- assertEquals(expectedResults, authPrivMap);
-
- // verify for null group and specific roleset
- authPrivMap = client.listPrivilegsbyAuthorizable(requestorUserName, authorizableSet, null,
- ActiveRoleSet.ALL);
- assertEquals(expectedResults, authPrivMap);
-
- // verify for specific group and null roleset
- authPrivMap = client.listPrivilegsbyAuthorizable(requestorUserName, authorizableSet,
- testGroupSet, null);
- assertEquals(expectedResults, authPrivMap);
-
- // verify for specific group and specific roleset
- authPrivMap = client.listPrivilegsbyAuthorizable(requestorUserName, authorizableSet,
- testGroupSet, new ActiveRoleSet(testRoleSet));
- assertEquals(expectedResults, authPrivMap);
-
- // verify for specific group and ALL roleset
- authPrivMap = client.listPrivilegsbyAuthorizable(requestorUserName, authorizableSet,
- testGroupSet, ActiveRoleSet.ALL);
- assertEquals(expectedResults, authPrivMap);
-
- // verify users not belonging to any group are not shown anything
- authPrivMap = client
- .listPrivilegsbyAuthorizable("random", authorizableSet,
- new HashSet<String>(), ActiveRoleSet.ALL);
- expectedResults.clear();
- expectedResults.put(
- SentryPolicyServiceClientDefaultImpl.setupSentryAuthorizable(db1Authrizable),
- new TSentryPrivilegeMap(new HashMap<String, Set<TSentryPrivilege>>()));
- assertEquals(expectedResults, authPrivMap);
- }});
- }
-
- @Test
- public void testListByAuthTab() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- String roleName1 = "role1";
- String roleName2 = "role2";
- String server = "server1";
- String db = "testDB";
- String db2 = "testDB2";
- String tab = "testTab";
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName1);
- client.createRole(requestorUserName, roleName1);
- client.dropRoleIfExists(requestorUserName, roleName2);
- client.createRole(requestorUserName, roleName2);
-
- client.grantDatabasePrivilege(
- requestorUserName, roleName1, server, db, AccessConstants.SELECT);
- client.grantTablePrivilege(requestorUserName, roleName1, server, db, tab,
- AccessConstants.ALL);
- TSentryPrivilege role1db2tab = client.grantTablePrivilege(
- requestorUserName, roleName1, server, db2, tab,
- AccessConstants.SELECT);
-
- client.grantDatabasePrivilege(
- requestorUserName, roleName2, server, db,
- AccessConstants.ALL);
- client.grantDatabasePrivilege(requestorUserName, roleName2, server, db2,
- AccessConstants.SELECT);
- TSentryPrivilege role2db2tab = client.grantTablePrivilege(
- requestorUserName, roleName2, server, db2, tab,
- AccessConstants.ALL);
- client.grantURIPrivilege(requestorUserName, roleName1, server,
- "hdfs:///fooUri");
-
- // build expected output
- TSentryPrivilegeMap db1RoleToPrivMap = new TSentryPrivilegeMap(
- new TreeMap<String, Set<TSentryPrivilege>>());
- db1RoleToPrivMap.getPrivilegeMap().put(roleName1,
- Sets.newHashSet(role1db2tab));
- db1RoleToPrivMap.getPrivilegeMap().put(roleName2,
- Sets.newHashSet(role2db2tab));
- Map<TSentryAuthorizable, TSentryPrivilegeMap> expectedResults = Maps
- .newTreeMap();
- List<? extends Authorizable> db2TabAuthrizable = Lists.newArrayList(
- new Server(server), new Database(db2), new Table(tab));
- expectedResults.put(
- SentryPolicyServiceClientDefaultImpl.setupSentryAuthorizable(db2TabAuthrizable),
- db1RoleToPrivMap);
-
- Set<List<? extends Authorizable>> authorizableSet = Sets.newHashSet();
- authorizableSet.add(db2TabAuthrizable);
- Map<TSentryAuthorizable, TSentryPrivilegeMap> authPrivMap = client
- .listPrivilegsbyAuthorizable(requestorUserName, authorizableSet, null, null);
-
- assertEquals(expectedResults, authPrivMap);
- }});
- }
-
- @Test
- public void testListByAuthUri() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- String roleName1 = "role1";
- String roleName2 = "role2";
- String server = "server1";
- String db = "testDB";
- String db2 = "testDB2";
- String tab = "testTab";
- String uri1 = "hdfs:///fooUri";
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName1);
- client.createRole(requestorUserName, roleName1);
- client.dropRoleIfExists(requestorUserName, roleName2);
- client.createRole(requestorUserName, roleName2);
-
- client.grantDatabasePrivilege(requestorUserName, roleName1, server, db,
- AccessConstants.SELECT);
- client.grantTablePrivilege(requestorUserName, roleName1, server, db, tab,
- AccessConstants.ALL);
- client.grantTablePrivilege(requestorUserName, roleName1, server, db2, tab,
- AccessConstants.SELECT);
- TSentryPrivilege role1uri1 = client.grantURIPrivilege(requestorUserName,
- roleName1, server, uri1);
-
- client.grantDatabasePrivilege(requestorUserName, roleName2, server, db,
- AccessConstants.ALL);
- client.grantDatabasePrivilege(requestorUserName, roleName2, server, db2,
- AccessConstants.SELECT);
- client.grantTablePrivilege(requestorUserName, roleName2, server, db2, tab,
- AccessConstants.ALL);
- TSentryPrivilege role2uri2 = client.grantURIPrivilege(requestorUserName,
- roleName2, server, uri1);
-
- // build expected output
- TSentryPrivilegeMap db1RoleToPrivMap = new TSentryPrivilegeMap(
- new TreeMap<String, Set<TSentryPrivilege>>());
- db1RoleToPrivMap.getPrivilegeMap().put(roleName1,
- Sets.newHashSet(role1uri1));
- db1RoleToPrivMap.getPrivilegeMap().put(roleName2,
- Sets.newHashSet(role2uri2));
- Map<TSentryAuthorizable, TSentryPrivilegeMap> expectedResults = Maps
- .newTreeMap();
- List<? extends Authorizable> uri1Authrizable = Lists.newArrayList(
- new Server(server), new AccessURI(uri1));
- expectedResults.put(
- SentryPolicyServiceClientDefaultImpl.setupSentryAuthorizable(uri1Authrizable),
- db1RoleToPrivMap);
-
- Set<List<? extends Authorizable>> authorizableSet = Sets.newHashSet();
- authorizableSet.add(uri1Authrizable);
- Map<TSentryAuthorizable, TSentryPrivilegeMap> authPrivMap = client
- .listPrivilegsbyAuthorizable(requestorUserName, authorizableSet, null, null);
-
- assertEquals(expectedResults, authPrivMap);
- }});
- }
-
- /**
- * List privileges by authorizables executed by non-admin user
- * Test various positive and negative cases for non-admin user
- * @throws Exception
- */
- @Test
- public void testListByAuthTabForNonAdmin() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- String user1 = "user1";
- String group1 = "group1";
- String group2 = "group2";
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- Set<String> userGroupNames1 = Sets.newHashSet(group1);
- Set<String> userGroupNames2 = Sets.newHashSet(group2);
- String roleName1 = "role1";
- String roleName2 = "role2";
- String server = "server1";
- String db = "testDB";
- String db2 = "testDB2";
- String tab = "testTab";
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- setLocalGroupMapping(user1, userGroupNames1);
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName1);
- client.createRole(requestorUserName, roleName1);
- client.dropRoleIfExists(requestorUserName, roleName2);
- client.createRole(requestorUserName, roleName2);
-
- client.grantDatabasePrivilege(requestorUserName, roleName1, server, db,
- AccessConstants.SELECT);
- client.grantTablePrivilege(requestorUserName, roleName1, server, db, tab,
- AccessConstants.ALL);
- TSentryPrivilege role1db2tab = client.grantTablePrivilege(
- requestorUserName, roleName1, server, db2, tab, AccessConstants.SELECT);
- client.grantRoleToGroup(requestorUserName, group1, roleName1);
-
- client.grantDatabasePrivilege(requestorUserName, roleName2, server, db,
- AccessConstants.ALL);
- client.grantDatabasePrivilege(requestorUserName, roleName2, server, db2,
- AccessConstants.SELECT);
- client.grantTablePrivilege(requestorUserName, roleName2, server, db2, tab,
- AccessConstants.ALL);
- client.grantURIPrivilege(requestorUserName, roleName1, server,
- "hdfs:///fooUri");
-
- // build expected output. user1 should see privileges on tab1 from role1
- TSentryPrivilegeMap db1RoleToPrivMap = new TSentryPrivilegeMap(
- new TreeMap<String, Set<TSentryPrivilege>>());
- db1RoleToPrivMap.getPrivilegeMap().put(roleName1, Sets.newHashSet(role1db2tab));
- Map<TSentryAuthorizable, TSentryPrivilegeMap> expectedResults = Maps.newTreeMap();
- List<? extends Authorizable> db2TabAuthorizable = Lists.newArrayList(
- new Server(server), new Database(db2), new Table(tab));
- expectedResults.put(
- SentryPolicyServiceClientDefaultImpl.setupSentryAuthorizable(db2TabAuthorizable),
- db1RoleToPrivMap);
-
- Set<List<? extends Authorizable>> authorizableSet = Sets.newHashSet();
- authorizableSet.add(db2TabAuthorizable);
-
- // list privileges with null group and roles
- Map<TSentryAuthorizable, TSentryPrivilegeMap> authPrivMap = client
- .listPrivilegsbyAuthorizable(user1, authorizableSet, null, null);
- assertEquals(expectedResults, authPrivMap);
-
- // list privileges with empty group set and null roles
- authPrivMap = client.listPrivilegsbyAuthorizable(user1, authorizableSet,
- new HashSet<String>(), null);
- assertEquals(expectedResults, authPrivMap);
-
- // list privileges with null group set and ALL roleset
- authPrivMap = client.listPrivilegsbyAuthorizable(user1, authorizableSet,
- null, new ActiveRoleSet(true));
- assertEquals(expectedResults, authPrivMap);
-
- // list privileges with user1's group set and null roles
- authPrivMap = client.listPrivilegsbyAuthorizable(user1, authorizableSet,
- userGroupNames1, null);
- assertEquals(expectedResults, authPrivMap);
-
- // list privileges with user1's group set and ALL roles
- authPrivMap = client.listPrivilegsbyAuthorizable(user1, authorizableSet,
- userGroupNames1, new ActiveRoleSet(true));
- assertEquals(expectedResults, authPrivMap);
-
- // list privileges with null group and user's specific roles with uppercase name
- authPrivMap = client.listPrivilegsbyAuthorizable(user1, authorizableSet,
- null, new ActiveRoleSet(Sets.newHashSet(roleName1.toUpperCase())));
- assertEquals(expectedResults, authPrivMap);
-
- // verify that user1 can't query group2
- try {
- client.listPrivilegsbyAuthorizable(user1, authorizableSet, userGroupNames2, null);
- fail("listPrivilegsbyAuthorizable() should fail for user1 accessing " + group2);
- } catch (SentryAccessDeniedException e) {
- // expected
- }
-
- // verify that user1 can't query role2
- ActiveRoleSet roleSet2 = new ActiveRoleSet(Sets.newHashSet(roleName2));
- try {
- client.listPrivilegsbyAuthorizable(user1, authorizableSet, null, roleSet2);
- fail("listPrivilegsbyAuthorizable() should fail for user1 accessing " + roleName2);
- } catch (SentryAccessDeniedException e) {
- // expected
- }
- }});
- }
-
- /**
- * Attempt to access a configuration value that is forbidden in getConfigVal
- * @param configVal The banned value
- * @param defaultVal A default to pass to getConfigValue
- * @throws Exception
- */
- private void checkBannedConfigVal(final String configVal, final String defaultVal)
- throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- try {
- client.getConfigValue(configVal, defaultVal);
- fail("Attempt to access " + configVal + " succeeded");
- } catch (SentryAccessDeniedException e) {
- assertTrue(e.toString().contains("was denied"));
- assertTrue(e.toString().contains(configVal));
- }
- }});
- }
-
- @Test
- public void testGetConfigVal() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- String val;
-
- // Basic success case
- val = client.getConfigValue("sentry.service.admin.group", "xxx");
- assertEquals(val, "admin_group");
-
- // Undefined value gets the default back
- val = client.getConfigValue("sentry.this.is.not.defined", "hello");
- assertEquals(val, "hello");
-
- // Undefined value and null default gets null back
- val = client.getConfigValue("sentry.this.is.not.defined", null);
- assertEquals(val, null);
-
- // Known config value with null default works as expected
- val = client.getConfigValue("sentry.service.admin.group", null);
- assertEquals(val, "admin_group");
-
- // Value that is forbidden (anything not starting with "sentry") dies
- checkBannedConfigVal("notsentry", "xxx");
-
- // Ditto with a null default
- checkBannedConfigVal("notsentry", null);
-
- // Values with .jdbc. are forbidden
- checkBannedConfigVal("sentry.xxx.jdbc.xxx", null);
-
- // Values with password are forbidden
- checkBannedConfigVal("sentry.xxx.password", null);
-
- // Attempt to get the location of the keytab also fails
- checkBannedConfigVal("sentry.service.server.keytab", null);
-
- }});
- }
-
- /* SENTRY-841 */
- @Test
- public void testGranRevokePrivilegeOnServerForRole() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- String roleName1 = "admin_r1";
-
- client.dropRoleIfExists(requestorUserName, roleName1);
- client.createRole(requestorUserName, roleName1);
-
- client.grantServerPrivilege(requestorUserName, roleName1, "server", false);
-
- Set<TSentryPrivilege> listPrivs = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
- assertTrue("Privilege should be all:",listPrivs.iterator().next().getAction().equals("*"));
-
- client.revokeServerPrivilege(requestorUserName, roleName1, "server", false);
- listPrivs = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
- assertTrue("Privilege not correctly revoked !!", listPrivs.size() == 0);
-
- }});
- }
-
- @Test
- public void testGranRevokePrivilegeWithoutAction() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- String roleName1 = "admin_r1";
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName1);
- client.createRole(requestorUserName, roleName1);
- client.grantServerPrivilege(requestorUserName, roleName1, "server1", false);
-
- Set<TSentryPrivilege> listPrivs = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
- assertTrue("Privilege should be all:", listPrivs.iterator().next().getAction().equals("*"));
-
- client.revokeServerPrivilege(requestorUserName, roleName1, "server1", "ALL", false);
- listPrivs = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
- assertTrue("Privilege not correctly revoked !!", listPrivs.size() == 0);
-
- }});
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceMetrics.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceMetrics.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceMetrics.java
deleted file mode 100644
index a33b03a..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceMetrics.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless createRequired by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.hadoop.security.authentication.client.AuthenticatedURL;
-import org.apache.hadoop.security.authentication.client.KerberosAuthenticator;
-import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.apache.sentry.service.thrift.SentryWebMetricParser;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.After;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.security.PrivilegedExceptionAction;
-
-public class TestSentryServiceMetrics extends SentryServiceIntegrationBase {
-
- @BeforeClass
- public static void setup() throws Exception {
- kerberos = true;
- webServerEnabled = true;
- webSecurity = true;
- setupConf();
- startSentryService();
- }
-
- //Overriding this method as the tests do not require a client handle
- @Override
- @Before
- public void before() throws Exception {
-
- }
- /* SENTRY-1319 */
- @Test
- public void testSentryServiceGauges() throws Throwable {
- //More Cases to be added once Sentry HA is implemented
-
- //Check for gauges with the server handle.
- Assert.assertEquals(Boolean.TRUE,server.getIsActiveGauge().getValue());
- }
-
- @Test
- public void testMetricsWeb() throws Exception {
- clientUgi.doAs(new PrivilegedExceptionAction<Void>() {
- @Override
- public Void run() throws Exception {
- final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/metrics");
- HttpURLConnection conn = new AuthenticatedURL(new KerberosAuthenticator()).
- openConnection(url, new AuthenticatedURL.Token());
- //make sure we are able to access the metrics page
- Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
- String response = IOUtils.toString(conn.getInputStream());
- SentryWebMetricParser mp = new SentryWebMetricParser(response);
- Assert.assertEquals(Boolean.FALSE,mp.isHA());
- Assert.assertEquals(Boolean.TRUE,mp.isActive());
- return null;
- }} );
- }
-
- //Overriding this method as the client handle does not exist.
- @Override
- @After
- public void after() {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceWithInvalidMsgSize.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceWithInvalidMsgSize.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceWithInvalidMsgSize.java
deleted file mode 100644
index 1896586..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceWithInvalidMsgSize.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import com.google.common.collect.Sets;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.sentry.core.common.exception.SentryUserException;
-import org.apache.sentry.service.thrift.SentryServiceClientFactory;
-import org.apache.sentry.service.thrift.SentryServiceFactory;
-import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.apache.sentry.service.thrift.ServiceConstants;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.Set;
-
-/**
- * Test sentry service with a larger message size than the server's or client's thrift max message size.
- */
-public class TestSentryServiceWithInvalidMsgSize extends SentryServiceIntegrationBase {
- private final Set<String> REQUESTER_USER_GROUP_NAMES = Sets.newHashSet(ADMIN_GROUP);
- private final String ROLE_NAME = "admin_r";
-
- /**
- * Test the case when the message size is larger than the client's thrift max message size.
- */
- @Test
- public void testClientWithSmallMaxMsgSize() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- SentryServiceClientFactory oldFactory = SentryServiceClientFactory.factoryReset(null);
- Configuration confWithSmallMaxMsgSize = new Configuration(conf);
- confWithSmallMaxMsgSize.setLong(ServiceConstants.ClientConfig.SENTRY_POLICY_CLIENT_THRIFT_MAX_MESSAGE_SIZE, 20);
- // create a client with a small thrift max message size
- SentryPolicyServiceClient clientWithSmallMaxMsgSize = SentryServiceClientFactory.create(confWithSmallMaxMsgSize);
-
- setLocalGroupMapping(ADMIN_USER, REQUESTER_USER_GROUP_NAMES);
- writePolicyFile();
-
- boolean exceptionThrown = false;
- try {
- // client throws exception when message size is larger than the client's thrift max message size.
- clientWithSmallMaxMsgSize.listAllRoles(ADMIN_USER);
- } catch (SentryUserException e) {
- exceptionThrown = true;
- Assert.assertTrue(e.getMessage().contains("Thrift exception occurred"));
- Assert.assertTrue(e.getCause().getMessage().contains("Length exceeded max allowed"));
- } finally {
- Assert.assertEquals(true, exceptionThrown);
- clientWithSmallMaxMsgSize.close();
- SentryServiceClientFactory.factoryReset(oldFactory);
- }
-
- // client can still talk with sentry server when message size is smaller.
- client.dropRoleIfExists(ADMIN_USER, ROLE_NAME);
- client.listAllRoles(ADMIN_USER);
- client.createRole(ADMIN_USER, ROLE_NAME);
- client.listAllRoles(ADMIN_USER);
- }
- });
- }
-
- /**
- * Test the case when the message size is larger than the server's thrift max message size.
- */
- @Test
- public void testServerWithSmallMaxMsgSize() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- Configuration confWithSmallMaxMsgSize = new Configuration(conf);
- confWithSmallMaxMsgSize.setLong(ServiceConstants.ServerConfig.SENTRY_POLICY_SERVER_THRIFT_MAX_MESSAGE_SIZE,
- 50);
- stopSentryService();
-
- // create a server with a small max thrift message size
- server = SentryServiceFactory.create(confWithSmallMaxMsgSize);
- startSentryService();
-
- setLocalGroupMapping(ADMIN_USER, REQUESTER_USER_GROUP_NAMES);
- writePolicyFile();
-
- // client can talk with server when message size is smaller.
- client.listAllRoles(ADMIN_USER);
- client.createRole(ADMIN_USER, ROLE_NAME);
-
- boolean exceptionThrown = false;
- try {
- // client throws exception when message size is larger than the server's thrift max message size.
- client.grantServerPrivilege(ADMIN_USER, ROLE_NAME, "server", false);
- } catch (SentryUserException e) {
- exceptionThrown = true;
- Assert.assertTrue(e.getCause().getMessage().contains("org.apache.thrift.transport.TTransportException"));
- } finally {
- Assert.assertEquals(true, exceptionThrown);
- }
-
- // client can still talk with sentry server when message size is smaller.
- Set<TSentryRole> roles = client.listAllRoles(ADMIN_USER);
- Assert.assertTrue(roles.size() == 1);
- Assert.assertEquals(ROLE_NAME, roles.iterator().next().getRoleName());
- }
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceWithKerberos.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceWithKerberos.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceWithKerberos.java
deleted file mode 100644
index ff73382..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceWithKerberos.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Test various kerberos related stuff on the SentryService side
- */
-public class TestSentryServiceWithKerberos extends SentryServiceIntegrationBase {
-
- @BeforeClass
- public static void setup() throws Exception {
- SERVER_KERBEROS_NAME = "sentry/_HOST@" + REALM;
- SentryServiceIntegrationBase.setup();
- }
-
- @Override
- @Before
- public void before() throws Exception {
- }
-
- @Override
- @After
- public void after() {
- }
-
- /**
- * Test that we are correctly substituting "_HOST" if/when needed.
- *
- * @throws Exception
- */
- @Test
- public void testHostSubstitution() throws Exception {
- // We just need to ensure that we are able to correct connect to the server
- connectToSentryService();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryWebServerWithKerberos.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryWebServerWithKerberos.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryWebServerWithKerberos.java
deleted file mode 100644
index 8062cb0..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryWebServerWithKerberos.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.security.PrivilegedExceptionAction;
-import java.util.HashSet;
-
-import javax.security.auth.Subject;
-import javax.security.auth.kerberos.KerberosPrincipal;
-import javax.security.auth.login.LoginContext;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.hadoop.security.authentication.client.AuthenticatedURL;
-import org.apache.hadoop.security.authentication.client.AuthenticationException;
-import org.apache.hadoop.security.authentication.client.KerberosAuthenticator;
-import org.apache.sentry.service.thrift.KerberosConfiguration;
-import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Sets;
-
-public class TestSentryWebServerWithKerberos extends SentryServiceIntegrationBase {
-
- private static Logger LOG = LoggerFactory.getLogger(TestSentryWebServerWithKerberos.class);
-
- @BeforeClass
- public static void setup() throws Exception {
- webServerEnabled = true;
- webSecurity = true;
- SentryServiceIntegrationBase.setup();
- }
-
- @Override
- @Before
- public void before() throws Exception {
- }
-
- @Override
- @After
- public void after() {
- }
-
- @Test
- public void testPing() throws Exception {
- clientUgi.doAs(new PrivilegedExceptionAction<Void>() {
- @Override
- public Void run() throws Exception {
- final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/ping");
- HttpURLConnection conn = new AuthenticatedURL(new KerberosAuthenticator()).
- openConnection(url, new AuthenticatedURL.Token());
- Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
- String response = IOUtils.toString(conn.getInputStream());
- Assert.assertEquals("pong\n", response);
- return null;
- }} );
- }
-
- @Test
- public void testPingWithoutSubject() throws Exception {
- final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/ping");
- try {
- new AuthenticatedURL(new KerberosAuthenticator()).openConnection(url, new AuthenticatedURL.Token());
- fail("Here should fail.");
- } catch (Exception e) {
- boolean isExpectError = e.getMessage().contains("No valid credentials provided");
- Assert.assertTrue("Here should fail by 'No valid credentials provided'," +
- " but the exception is:" + e, isExpectError);
- }
- }
-
- @Test
- public void testPingUsingHttpURLConnection() throws Exception {
- final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/ping");
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- Assert.assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, conn.getResponseCode());
- String errorMessage = IOUtils.toString(conn.getErrorStream());
- Assert.assertTrue(errorMessage.contains("Authentication required"));
- }
-
- @Test
- public void testPingWithUnauthorizedUser() throws Exception {
- // create an unauthorized User with Kerberos
- String userPrinciple = "user/" + SERVER_HOST;
- String userKerberosName = userPrinciple + "@" + REALM;
- Subject userSubject = new Subject(false, Sets.newHashSet(
- new KerberosPrincipal(userKerberosName)), new HashSet<Object>(),new HashSet<Object>());
- File userKeytab = new File(kdcWorkDir, "user.keytab");
- kdc.createPrincipal(userKeytab, userPrinciple);
- LoginContext userLoginContext = new LoginContext("", userSubject, null,
- KerberosConfiguration.createClientConfig(userKerberosName, userKeytab));
- userLoginContext.login();
- Subject.doAs(userLoginContext.getSubject(), new PrivilegedExceptionAction<Void>() {
- @Override
- public Void run() throws Exception {
- final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/ping");
- try {
- new AuthenticatedURL(new KerberosAuthenticator()).openConnection(url, new AuthenticatedURL.Token());
- fail("Here should fail.");
- } catch (AuthenticationException e) {
- String expectedError = "status code: 403";
- if (!e.getMessage().contains(expectedError)) {
- LOG.error("UnexpectedError: " + e.getMessage(), e);
- fail("UnexpectedError: " + e.getMessage());
- }
- }
- return null;
- }
- });
- }
-
- @Test
- public void testPingWithCaseSensitiveUser() throws Exception {
- // USER1 is present in the list of users who are allowed to connect to sentry web ui.
- String userPrinciple = "user1/" + SERVER_HOST;
- String userKerberosName = userPrinciple + "@" + REALM;
- Subject userSubject = new Subject(false, Sets.newHashSet(
- new KerberosPrincipal(userKerberosName)), new HashSet<Object>(),new HashSet<Object>());
- File userKeytab = new File(kdcWorkDir, "user1.keytab");
- kdc.createPrincipal(userKeytab, userPrinciple);
- LoginContext userLoginContext = new LoginContext("", userSubject, null,
- KerberosConfiguration.createClientConfig(userKerberosName, userKeytab));
- userLoginContext.login();
- Subject.doAs(userLoginContext.getSubject(), new PrivilegedExceptionAction<Void>() {
- @Override
- public Void run() throws Exception {
- final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/ping");
- try {
- new AuthenticatedURL(new KerberosAuthenticator()).openConnection(url, new AuthenticatedURL.Token());
- fail("Login with user1 should fail");
- } catch (AuthenticationException e) {
- String expectedError = "status code: 403";
- if (!e.getMessage().contains(expectedError)) {
- LOG.error("UnexpectedError: " + e.getMessage(), e);
- fail("UnexpectedError: " + e.getMessage());
- }
- }
- return null;
- }
- });
- }
-
- @Test
- public void testTraceIsDisabled() throws Exception {
- final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort);
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- conn.setRequestMethod("TRACE");
- Assert.assertEquals(HttpURLConnection.HTTP_FORBIDDEN, conn.getResponseCode());
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryWebServerWithSSL.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryWebServerWithSSL.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryWebServerWithSSL.java
deleted file mode 100644
index f921793..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryWebServerWithSSL.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import com.google.common.io.Resources;
-import java.net.HttpURLConnection;
-import org.apache.commons.io.IOUtils;
-import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.junit.*;
-
-import javax.net.ssl.HttpsURLConnection;
-import java.net.URL;
-import java.util.Properties;
-
-/**
- * Test sentry web server when ssl is enabled.
- */
-public class TestSentryWebServerWithSSL extends SentryServiceIntegrationBase {
- @BeforeClass
- public static void setup() throws Exception {
- webServerEnabled = true;
- webSecurity = false;
- useSSL = true;
- SentryServiceIntegrationBase.setup();
- }
-
- @Test
- public void testPing() throws Exception {
- final URL url = new URL("https://"+ SERVER_HOST + ":" + webServerPort + "/ping");
- Properties systemProps = System.getProperties();
- systemProps.put( "javax.net.ssl.trustStore", Resources.getResource("cacerts.jks").getPath());
- System.setProperties(systemProps);
- HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
- Assert.assertEquals(HttpsURLConnection.HTTP_OK, conn.getResponseCode());
- String response = IOUtils.toString(conn.getInputStream());
- Assert.assertEquals("pong\n", response);
- }
-
- @Test
- public void testTraceIsDisabled() throws Exception {
- final URL url = new URL("https://"+ SERVER_HOST + ":" + webServerPort);
- Properties systemProps = System.getProperties();
- systemProps.put( "javax.net.ssl.trustStore", Resources.getResource("cacerts.jks").getPath());
- System.setProperties(systemProps);
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- conn.setRequestMethod("TRACE");
- Assert.assertEquals(HttpURLConnection.HTTP_FORBIDDEN, conn.getResponseCode());
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryWebServerWithoutSecurity.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryWebServerWithoutSecurity.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryWebServerWithoutSecurity.java
deleted file mode 100644
index 6dd1804..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryWebServerWithoutSecurity.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class TestSentryWebServerWithoutSecurity extends SentryServiceIntegrationBase {
-
- @BeforeClass
- public static void setup() throws Exception {
- webServerEnabled = true;
- webSecurity = false;
- SentryServiceIntegrationBase.setup();
- }
-
- @Override
- @Before
- public void before() throws Exception {
- }
-
- @Override
- @After
- public void after() {
- }
-
- @Test
- public void testPing() throws Exception {
- final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/ping");
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
- String response = IOUtils.toString(conn.getInputStream());
- Assert.assertEquals("pong\n", response);
- }
-
- @Test
- public void testConf() throws Exception {
- // test bad format
- final URL url = new URL("http://" + SERVER_HOST + ":" + webServerPort + "/conf?"
- + ConfServlet.FORMAT_PARAM + "=badformat");
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- Assert.assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, conn.getResponseCode());
-
- // test json format
- final URL url1 = new URL("http://" + SERVER_HOST + ":" + webServerPort + "/conf?"
- + ConfServlet.FORMAT_PARAM +"=" + ConfServlet.FORMAT_JSON);
- conn = (HttpURLConnection) url1.openConnection();
- Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
-
- // test xml format
- final URL url2 = new URL("http://" + SERVER_HOST + ":" + webServerPort + "/conf?"
- + ConfServlet.FORMAT_PARAM +"=" + ConfServlet.FORMAT_XML);
- conn = (HttpURLConnection) url2.openConnection();
- Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
- String xmlResponse = IOUtils.toString(conn.getInputStream());
-
- // test default is xml format
- final URL url3 = new URL("http://" + SERVER_HOST + ":" + webServerPort + "/conf");
- conn = (HttpURLConnection) url3.openConnection();
- Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
- String defaultResponse = IOUtils.toString(conn.getInputStream());
- Assert.assertEquals(xmlResponse, defaultResponse);
- }
-
- @Test
- public void testTraceIsDisabled() throws Exception {
- final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort);
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- conn.setRequestMethod("TRACE");
- Assert.assertEquals(HttpURLConnection.HTTP_FORBIDDEN, conn.getResponseCode());
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java
index 65f1e30..7e5e91d 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java
@@ -30,12 +30,13 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.minikdc.MiniKdc;
import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.sentry.provider.db.service.thrift.SentryMiniKdcTestcase;
-import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient;
-import org.apache.sentry.provider.db.service.thrift.TSentryRole;
+import org.apache.sentry.api.common.ApiConstants;
+import org.apache.sentry.api.common.Status;
+import org.apache.sentry.api.service.thrift.SentryMiniKdcTestcase;
+import org.apache.sentry.api.service.thrift.SentryPolicyServiceClient;
+import org.apache.sentry.api.service.thrift.TSentryRole;
import org.apache.sentry.provider.file.PolicyFile;
-import org.apache.sentry.service.thrift.ServiceConstants.ClientConfig;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
@@ -161,7 +162,7 @@ public abstract class SentryServiceIntegrationBase extends SentryMiniKdcTestcase
conf.set(ServerConfig.SENTRY_WEB_ENABLE, "false");
}
if (pooled) {
- conf.set(ClientConfig.SENTRY_POOL_ENABLED, "true");
+ conf.set(ApiConstants.ClientConfig.SENTRY_POOL_ENABLED, "true");
}
if (useSSL) {
String keystorePath = Resources.getResource("keystore.jks").getPath();
@@ -180,8 +181,8 @@ public abstract class SentryServiceIntegrationBase extends SentryMiniKdcTestcase
"jdbc:derby:;databaseName=" + dbDir.getPath() + ";create=true");
conf.set(ServerConfig.SENTRY_STORE_JDBC_PASS, "dummy");
server = SentryServiceFactory.create(conf);
- conf.set(ClientConfig.SERVER_RPC_ADDRESS, server.getAddress().getHostName());
- conf.set(ClientConfig.SERVER_RPC_PORT, String.valueOf(server.getAddress().getPort()));
+ conf.set(ApiConstants.ClientConfig.SERVER_RPC_ADDRESS, server.getAddress().getHostName());
+ conf.set(ApiConstants.ClientConfig.SERVER_RPC_PORT, String.valueOf(server.getAddress().getPort()));
conf.set(ServerConfig.SENTRY_STORE_GROUP_MAPPING,
ServerConfig.SENTRY_STORE_LOCAL_GROUP_MAPPING);
}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/pom.xml
----------------------------------------------------------------------
diff --git a/sentry-service/pom.xml b/sentry-service/pom.xml
new file mode 100644
index 0000000..0388476
--- /dev/null
+++ b/sentry-service/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>sentry</artifactId>
+ <groupId>org.apache.sentry</groupId>
+ <version>2.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>sentry-service</artifactId>
+ <name>Sentry Service</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>sentry-service-api</module>
+ </modules>
+
+</project>
[31/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesResponse.java
deleted file mode 100644
index a2e3a66..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesResponse.java
+++ /dev/null
@@ -1,558 +0,0 @@
-/**
- * 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.provider.db.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 TListSentryRolesResponse implements org.apache.thrift.TBase<TListSentryRolesResponse, TListSentryRolesResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryRolesResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryRolesResponse");
-
- 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 ROLES_FIELD_DESC = new org.apache.thrift.protocol.TField("roles", org.apache.thrift.protocol.TType.SET, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryRolesResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryRolesResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
- private Set<TSentryRole> roles; // optional
-
- /** 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"),
- ROLES((short)2, "roles");
-
- 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: // ROLES
- return ROLES;
- 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 _Fields optionals[] = {_Fields.ROLES};
- 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.ROLES, new org.apache.thrift.meta_data.FieldMetaData("roles", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryRole.class))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryRolesResponse.class, metaDataMap);
- }
-
- public TListSentryRolesResponse() {
- }
-
- public TListSentryRolesResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryRolesResponse(TListSentryRolesResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- if (other.isSetRoles()) {
- Set<TSentryRole> __this__roles = new HashSet<TSentryRole>(other.roles.size());
- for (TSentryRole other_element : other.roles) {
- __this__roles.add(new TSentryRole(other_element));
- }
- this.roles = __this__roles;
- }
- }
-
- public TListSentryRolesResponse deepCopy() {
- return new TListSentryRolesResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- this.roles = null;
- }
-
- 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 int getRolesSize() {
- return (this.roles == null) ? 0 : this.roles.size();
- }
-
- public java.util.Iterator<TSentryRole> getRolesIterator() {
- return (this.roles == null) ? null : this.roles.iterator();
- }
-
- public void addToRoles(TSentryRole elem) {
- if (this.roles == null) {
- this.roles = new HashSet<TSentryRole>();
- }
- this.roles.add(elem);
- }
-
- public Set<TSentryRole> getRoles() {
- return this.roles;
- }
-
- public void setRoles(Set<TSentryRole> roles) {
- this.roles = roles;
- }
-
- public void unsetRoles() {
- this.roles = null;
- }
-
- /** Returns true if field roles is set (has been assigned a value) and false otherwise */
- public boolean isSetRoles() {
- return this.roles != null;
- }
-
- public void setRolesIsSet(boolean value) {
- if (!value) {
- this.roles = null;
- }
- }
-
- 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 ROLES:
- if (value == null) {
- unsetRoles();
- } else {
- setRoles((Set<TSentryRole>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- case ROLES:
- return getRoles();
-
- }
- 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 ROLES:
- return isSetRoles();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryRolesResponse)
- return this.equals((TListSentryRolesResponse)that);
- return false;
- }
-
- public boolean equals(TListSentryRolesResponse 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_roles = true && this.isSetRoles();
- boolean that_present_roles = true && that.isSetRoles();
- if (this_present_roles || that_present_roles) {
- if (!(this_present_roles && that_present_roles))
- return false;
- if (!this.roles.equals(that.roles))
- 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_roles = true && (isSetRoles());
- list.add(present_roles);
- if (present_roles)
- list.add(roles);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TListSentryRolesResponse 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(isSetRoles()).compareTo(other.isSetRoles());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoles()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roles, other.roles);
- 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("TListSentryRolesResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- if (isSetRoles()) {
- if (!first) sb.append(", ");
- sb.append("roles:");
- if (this.roles == null) {
- sb.append("null");
- } else {
- sb.append(this.roles);
- }
- 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());
- }
-
- // 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 {
- 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 TListSentryRolesResponseStandardSchemeFactory implements SchemeFactory {
- public TListSentryRolesResponseStandardScheme getScheme() {
- return new TListSentryRolesResponseStandardScheme();
- }
- }
-
- private static class TListSentryRolesResponseStandardScheme extends StandardScheme<TListSentryRolesResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryRolesResponse 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: // ROLES
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set64 = iprot.readSetBegin();
- struct.roles = new HashSet<TSentryRole>(2*_set64.size);
- TSentryRole _elem65;
- for (int _i66 = 0; _i66 < _set64.size; ++_i66)
- {
- _elem65 = new TSentryRole();
- _elem65.read(iprot);
- struct.roles.add(_elem65);
- }
- iprot.readSetEnd();
- }
- struct.setRolesIsSet(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, TListSentryRolesResponse 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();
- }
- if (struct.roles != null) {
- if (struct.isSetRoles()) {
- oprot.writeFieldBegin(ROLES_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.roles.size()));
- for (TSentryRole _iter67 : struct.roles)
- {
- _iter67.write(oprot);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryRolesResponseTupleSchemeFactory implements SchemeFactory {
- public TListSentryRolesResponseTupleScheme getScheme() {
- return new TListSentryRolesResponseTupleScheme();
- }
- }
-
- private static class TListSentryRolesResponseTupleScheme extends TupleScheme<TListSentryRolesResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- BitSet optionals = new BitSet();
- if (struct.isSetRoles()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetRoles()) {
- {
- oprot.writeI32(struct.roles.size());
- for (TSentryRole _iter68 : struct.roles)
- {
- _iter68.write(oprot);
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesResponse 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);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- {
- org.apache.thrift.protocol.TSet _set69 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.roles = new HashSet<TSentryRole>(2*_set69.size);
- TSentryRole _elem70;
- for (int _i71 = 0; _i71 < _set69.size; ++_i71)
- {
- _elem70 = new TSentryRole();
- _elem70.read(iprot);
- struct.roles.add(_elem70);
- }
- }
- struct.setRolesIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesRequest.java
deleted file mode 100644
index 18602d2..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesRequest.java
+++ /dev/null
@@ -1,702 +0,0 @@
-/**
- * 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.provider.db.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 TRenamePrivilegesRequest implements org.apache.thrift.TBase<TRenamePrivilegesRequest, TRenamePrivilegesRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TRenamePrivilegesRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRenamePrivilegesRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField OLD_AUTHORIZABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("oldAuthorizable", org.apache.thrift.protocol.TType.STRUCT, (short)3);
- private static final org.apache.thrift.protocol.TField NEW_AUTHORIZABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("newAuthorizable", org.apache.thrift.protocol.TType.STRUCT, (short)4);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TRenamePrivilegesRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TRenamePrivilegesRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private TSentryAuthorizable oldAuthorizable; // required
- private TSentryAuthorizable newAuthorizable; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- OLD_AUTHORIZABLE((short)3, "oldAuthorizable"),
- NEW_AUTHORIZABLE((short)4, "newAuthorizable");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // OLD_AUTHORIZABLE
- return OLD_AUTHORIZABLE;
- case 4: // NEW_AUTHORIZABLE
- return NEW_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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.OLD_AUTHORIZABLE, new org.apache.thrift.meta_data.FieldMetaData("oldAuthorizable", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class)));
- tmpMap.put(_Fields.NEW_AUTHORIZABLE, new org.apache.thrift.meta_data.FieldMetaData("newAuthorizable", 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(TRenamePrivilegesRequest.class, metaDataMap);
- }
-
- public TRenamePrivilegesRequest() {
- this.protocol_version = 2;
-
- }
-
- public TRenamePrivilegesRequest(
- int protocol_version,
- String requestorUserName,
- TSentryAuthorizable oldAuthorizable,
- TSentryAuthorizable newAuthorizable)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.oldAuthorizable = oldAuthorizable;
- this.newAuthorizable = newAuthorizable;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TRenamePrivilegesRequest(TRenamePrivilegesRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetOldAuthorizable()) {
- this.oldAuthorizable = new TSentryAuthorizable(other.oldAuthorizable);
- }
- if (other.isSetNewAuthorizable()) {
- this.newAuthorizable = new TSentryAuthorizable(other.newAuthorizable);
- }
- }
-
- public TRenamePrivilegesRequest deepCopy() {
- return new TRenamePrivilegesRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.oldAuthorizable = null;
- this.newAuthorizable = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public TSentryAuthorizable getOldAuthorizable() {
- return this.oldAuthorizable;
- }
-
- public void setOldAuthorizable(TSentryAuthorizable oldAuthorizable) {
- this.oldAuthorizable = oldAuthorizable;
- }
-
- public void unsetOldAuthorizable() {
- this.oldAuthorizable = null;
- }
-
- /** Returns true if field oldAuthorizable is set (has been assigned a value) and false otherwise */
- public boolean isSetOldAuthorizable() {
- return this.oldAuthorizable != null;
- }
-
- public void setOldAuthorizableIsSet(boolean value) {
- if (!value) {
- this.oldAuthorizable = null;
- }
- }
-
- public TSentryAuthorizable getNewAuthorizable() {
- return this.newAuthorizable;
- }
-
- public void setNewAuthorizable(TSentryAuthorizable newAuthorizable) {
- this.newAuthorizable = newAuthorizable;
- }
-
- public void unsetNewAuthorizable() {
- this.newAuthorizable = null;
- }
-
- /** Returns true if field newAuthorizable is set (has been assigned a value) and false otherwise */
- public boolean isSetNewAuthorizable() {
- return this.newAuthorizable != null;
- }
-
- public void setNewAuthorizableIsSet(boolean value) {
- if (!value) {
- this.newAuthorizable = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case OLD_AUTHORIZABLE:
- if (value == null) {
- unsetOldAuthorizable();
- } else {
- setOldAuthorizable((TSentryAuthorizable)value);
- }
- break;
-
- case NEW_AUTHORIZABLE:
- if (value == null) {
- unsetNewAuthorizable();
- } else {
- setNewAuthorizable((TSentryAuthorizable)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case OLD_AUTHORIZABLE:
- return getOldAuthorizable();
-
- case NEW_AUTHORIZABLE:
- return getNewAuthorizable();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case OLD_AUTHORIZABLE:
- return isSetOldAuthorizable();
- case NEW_AUTHORIZABLE:
- return isSetNewAuthorizable();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TRenamePrivilegesRequest)
- return this.equals((TRenamePrivilegesRequest)that);
- return false;
- }
-
- public boolean equals(TRenamePrivilegesRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_oldAuthorizable = true && this.isSetOldAuthorizable();
- boolean that_present_oldAuthorizable = true && that.isSetOldAuthorizable();
- if (this_present_oldAuthorizable || that_present_oldAuthorizable) {
- if (!(this_present_oldAuthorizable && that_present_oldAuthorizable))
- return false;
- if (!this.oldAuthorizable.equals(that.oldAuthorizable))
- return false;
- }
-
- boolean this_present_newAuthorizable = true && this.isSetNewAuthorizable();
- boolean that_present_newAuthorizable = true && that.isSetNewAuthorizable();
- if (this_present_newAuthorizable || that_present_newAuthorizable) {
- if (!(this_present_newAuthorizable && that_present_newAuthorizable))
- return false;
- if (!this.newAuthorizable.equals(that.newAuthorizable))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_oldAuthorizable = true && (isSetOldAuthorizable());
- list.add(present_oldAuthorizable);
- if (present_oldAuthorizable)
- list.add(oldAuthorizable);
-
- boolean present_newAuthorizable = true && (isSetNewAuthorizable());
- list.add(present_newAuthorizable);
- if (present_newAuthorizable)
- list.add(newAuthorizable);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TRenamePrivilegesRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetOldAuthorizable()).compareTo(other.isSetOldAuthorizable());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetOldAuthorizable()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.oldAuthorizable, other.oldAuthorizable);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetNewAuthorizable()).compareTo(other.isSetNewAuthorizable());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetNewAuthorizable()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.newAuthorizable, other.newAuthorizable);
- 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("TRenamePrivilegesRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("oldAuthorizable:");
- if (this.oldAuthorizable == null) {
- sb.append("null");
- } else {
- sb.append(this.oldAuthorizable);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("newAuthorizable:");
- if (this.newAuthorizable == null) {
- sb.append("null");
- } else {
- sb.append(this.newAuthorizable);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetOldAuthorizable()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'oldAuthorizable' is unset! Struct:" + toString());
- }
-
- if (!isSetNewAuthorizable()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'newAuthorizable' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (oldAuthorizable != null) {
- oldAuthorizable.validate();
- }
- if (newAuthorizable != null) {
- newAuthorizable.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 TRenamePrivilegesRequestStandardSchemeFactory implements SchemeFactory {
- public TRenamePrivilegesRequestStandardScheme getScheme() {
- return new TRenamePrivilegesRequestStandardScheme();
- }
- }
-
- private static class TRenamePrivilegesRequestStandardScheme extends StandardScheme<TRenamePrivilegesRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TRenamePrivilegesRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // OLD_AUTHORIZABLE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.oldAuthorizable = new TSentryAuthorizable();
- struct.oldAuthorizable.read(iprot);
- struct.setOldAuthorizableIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // NEW_AUTHORIZABLE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.newAuthorizable = new TSentryAuthorizable();
- struct.newAuthorizable.read(iprot);
- struct.setNewAuthorizableIsSet(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, TRenamePrivilegesRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.oldAuthorizable != null) {
- oprot.writeFieldBegin(OLD_AUTHORIZABLE_FIELD_DESC);
- struct.oldAuthorizable.write(oprot);
- oprot.writeFieldEnd();
- }
- if (struct.newAuthorizable != null) {
- oprot.writeFieldBegin(NEW_AUTHORIZABLE_FIELD_DESC);
- struct.newAuthorizable.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TRenamePrivilegesRequestTupleSchemeFactory implements SchemeFactory {
- public TRenamePrivilegesRequestTupleScheme getScheme() {
- return new TRenamePrivilegesRequestTupleScheme();
- }
- }
-
- private static class TRenamePrivilegesRequestTupleScheme extends TupleScheme<TRenamePrivilegesRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- struct.oldAuthorizable.write(oprot);
- struct.newAuthorizable.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.oldAuthorizable = new TSentryAuthorizable();
- struct.oldAuthorizable.read(iprot);
- struct.setOldAuthorizableIsSet(true);
- struct.newAuthorizable = new TSentryAuthorizable();
- struct.newAuthorizable.read(iprot);
- struct.setNewAuthorizableIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesResponse.java
deleted file mode 100644
index c01b24c..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesResponse.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/**
- * 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.provider.db.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 TRenamePrivilegesResponse implements org.apache.thrift.TBase<TRenamePrivilegesResponse, TRenamePrivilegesResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TRenamePrivilegesResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRenamePrivilegesResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TRenamePrivilegesResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TRenamePrivilegesResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.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)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TRenamePrivilegesResponse.class, metaDataMap);
- }
-
- public TRenamePrivilegesResponse() {
- }
-
- public TRenamePrivilegesResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TRenamePrivilegesResponse(TRenamePrivilegesResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- }
-
- public TRenamePrivilegesResponse deepCopy() {
- return new TRenamePrivilegesResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TRenamePrivilegesResponse)
- return this.equals((TRenamePrivilegesResponse)that);
- return false;
- }
-
- public boolean equals(TRenamePrivilegesResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TRenamePrivilegesResponse 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;
- }
- }
- 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("TRenamePrivilegesResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // 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 {
- 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 TRenamePrivilegesResponseStandardSchemeFactory implements SchemeFactory {
- public TRenamePrivilegesResponseStandardScheme getScheme() {
- return new TRenamePrivilegesResponseStandardScheme();
- }
- }
-
- private static class TRenamePrivilegesResponseStandardScheme extends StandardScheme<TRenamePrivilegesResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TRenamePrivilegesResponse 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;
- 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, TRenamePrivilegesResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TRenamePrivilegesResponseTupleSchemeFactory implements SchemeFactory {
- public TRenamePrivilegesResponseTupleScheme getScheme() {
- return new TRenamePrivilegesResponseTupleScheme();
- }
- }
-
- private static class TRenamePrivilegesResponseTupleScheme extends TupleScheme<TRenamePrivilegesResponse> {
-
- @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 read(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesResponse 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);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryActiveRoleSet.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryActiveRoleSet.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryActiveRoleSet.java
deleted file mode 100644
index d28c09d..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryActiveRoleSet.java
+++ /dev/null
@@ -1,537 +0,0 @@
-/**
- * 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.provider.db.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 TSentryActiveRoleSet implements org.apache.thrift.TBase<TSentryActiveRoleSet, TSentryActiveRoleSet._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryActiveRoleSet> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryActiveRoleSet");
-
- private static final org.apache.thrift.protocol.TField ALL_FIELD_DESC = new org.apache.thrift.protocol.TField("all", org.apache.thrift.protocol.TType.BOOL, (short)1);
- private static final org.apache.thrift.protocol.TField ROLES_FIELD_DESC = new org.apache.thrift.protocol.TField("roles", org.apache.thrift.protocol.TType.SET, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryActiveRoleSetStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryActiveRoleSetTupleSchemeFactory());
- }
-
- private boolean all; // required
- private Set<String> roles; // 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 {
- ALL((short)1, "all"),
- ROLES((short)2, "roles");
-
- 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: // ALL
- return ALL;
- case 2: // ROLES
- return ROLES;
- 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 __ALL_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.ALL, new org.apache.thrift.meta_data.FieldMetaData("all", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
- tmpMap.put(_Fields.ROLES, new org.apache.thrift.meta_data.FieldMetaData("roles", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryActiveRoleSet.class, metaDataMap);
- }
-
- public TSentryActiveRoleSet() {
- }
-
- public TSentryActiveRoleSet(
- boolean all,
- Set<String> roles)
- {
- this();
- this.all = all;
- setAllIsSet(true);
- this.roles = roles;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryActiveRoleSet(TSentryActiveRoleSet other) {
- __isset_bitfield = other.__isset_bitfield;
- this.all = other.all;
- if (other.isSetRoles()) {
- Set<String> __this__roles = new HashSet<String>(other.roles);
- this.roles = __this__roles;
- }
- }
-
- public TSentryActiveRoleSet deepCopy() {
- return new TSentryActiveRoleSet(this);
- }
-
- @Override
- public void clear() {
- setAllIsSet(false);
- this.all = false;
- this.roles = null;
- }
-
- public boolean isAll() {
- return this.all;
- }
-
- public void setAll(boolean all) {
- this.all = all;
- setAllIsSet(true);
- }
-
- public void unsetAll() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ALL_ISSET_ID);
- }
-
- /** Returns true if field all is set (has been assigned a value) and false otherwise */
- public boolean isSetAll() {
- return EncodingUtils.testBit(__isset_bitfield, __ALL_ISSET_ID);
- }
-
- public void setAllIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ALL_ISSET_ID, value);
- }
-
- public int getRolesSize() {
- return (this.roles == null) ? 0 : this.roles.size();
- }
-
- public java.util.Iterator<String> getRolesIterator() {
- return (this.roles == null) ? null : this.roles.iterator();
- }
-
- public void addToRoles(String elem) {
- if (this.roles == null) {
- this.roles = new HashSet<String>();
- }
- this.roles.add(elem);
- }
-
- public Set<String> getRoles() {
- return this.roles;
- }
-
- public void setRoles(Set<String> roles) {
- this.roles = roles;
- }
-
- public void unsetRoles() {
- this.roles = null;
- }
-
- /** Returns true if field roles is set (has been assigned a value) and false otherwise */
- public boolean isSetRoles() {
- return this.roles != null;
- }
-
- public void setRolesIsSet(boolean value) {
- if (!value) {
- this.roles = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case ALL:
- if (value == null) {
- unsetAll();
- } else {
- setAll((Boolean)value);
- }
- break;
-
- case ROLES:
- if (value == null) {
- unsetRoles();
- } else {
- setRoles((Set<String>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case ALL:
- return isAll();
-
- case ROLES:
- return getRoles();
-
- }
- 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 ALL:
- return isSetAll();
- case ROLES:
- return isSetRoles();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryActiveRoleSet)
- return this.equals((TSentryActiveRoleSet)that);
- return false;
- }
-
- public boolean equals(TSentryActiveRoleSet that) {
- if (that == null)
- return false;
-
- boolean this_present_all = true;
- boolean that_present_all = true;
- if (this_present_all || that_present_all) {
- if (!(this_present_all && that_present_all))
- return false;
- if (this.all != that.all)
- return false;
- }
-
- boolean this_present_roles = true && this.isSetRoles();
- boolean that_present_roles = true && that.isSetRoles();
- if (this_present_roles || that_present_roles) {
- if (!(this_present_roles && that_present_roles))
- return false;
- if (!this.roles.equals(that.roles))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List<Object> list = new ArrayList<Object>();
-
- boolean present_all = true;
- list.add(present_all);
- if (present_all)
- list.add(all);
-
- boolean present_roles = true && (isSetRoles());
- list.add(present_roles);
- if (present_roles)
- list.add(roles);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryActiveRoleSet other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetAll()).compareTo(other.isSetAll());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAll()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.all, other.all);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoles()).compareTo(other.isSetRoles());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoles()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roles, other.roles);
- 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("TSentryActiveRoleSet(");
- boolean first = true;
-
- sb.append("all:");
- sb.append(this.all);
- first = false;
- if (!first) sb.append(", ");
- sb.append("roles:");
- if (this.roles == null) {
- sb.append("null");
- } else {
- sb.append(this.roles);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetAll()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'all' is unset! Struct:" + toString());
- }
-
- if (!isSetRoles()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roles' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TSentryActiveRoleSetStandardSchemeFactory implements SchemeFactory {
- public TSentryActiveRoleSetStandardScheme getScheme() {
- return new TSentryActiveRoleSetStandardScheme();
- }
- }
-
- private static class TSentryActiveRoleSetStandardScheme extends StandardScheme<TSentryActiveRoleSet> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryActiveRoleSet 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: // ALL
- if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
- struct.all = iprot.readBool();
- struct.setAllIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // ROLES
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set80 = iprot.readSetBegin();
- struct.roles = new HashSet<String>(2*_set80.size);
- String _elem81;
- for (int _i82 = 0; _i82 < _set80.size; ++_i82)
- {
- _elem81 = iprot.readString();
- struct.roles.add(_elem81);
- }
- iprot.readSetEnd();
- }
- struct.setRolesIsSet(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, TSentryActiveRoleSet struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(ALL_FIELD_DESC);
- oprot.writeBool(struct.all);
- oprot.writeFieldEnd();
- if (struct.roles != null) {
- oprot.writeFieldBegin(ROLES_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.roles.size()));
- for (String _iter83 : struct.roles)
- {
- oprot.writeString(_iter83);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryActiveRoleSetTupleSchemeFactory implements SchemeFactory {
- public TSentryActiveRoleSetTupleScheme getScheme() {
- return new TSentryActiveRoleSetTupleScheme();
- }
- }
-
- private static class TSentryActiveRoleSetTupleScheme extends TupleScheme<TSentryActiveRoleSet> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryActiveRoleSet struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeBool(struct.all);
- {
- oprot.writeI32(struct.roles.size());
- for (String _iter84 : struct.roles)
- {
- oprot.writeString(_iter84);
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryActiveRoleSet struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.all = iprot.readBool();
- struct.setAllIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set85 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.roles = new HashSet<String>(2*_set85.size);
- String _elem86;
- for (int _i87 = 0; _i87 < _set85.size; ++_i87)
- {
- _elem86 = iprot.readString();
- struct.roles.add(_elem86);
- }
- }
- struct.setRolesIsSet(true);
- }
- }
-
-}
-
[26/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/TSentryResponseStatus.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/TSentryResponseStatus.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/TSentryResponseStatus.java
deleted file mode 100644
index ebd3fe3..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/TSentryResponseStatus.java
+++ /dev/null
@@ -1,598 +0,0 @@
-/**
- * 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.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 TSentryResponseStatus implements org.apache.thrift.TBase<TSentryResponseStatus, TSentryResponseStatus._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryResponseStatus> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryResponseStatus");
-
- private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.I32, (short)1);
- private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField STACK_FIELD_DESC = new org.apache.thrift.protocol.TField("stack", org.apache.thrift.protocol.TType.STRING, (short)3);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryResponseStatusStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryResponseStatusTupleSchemeFactory());
- }
-
- private int value; // required
- private String message; // required
- private String stack; // optional
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- VALUE((short)1, "value"),
- MESSAGE((short)2, "message"),
- STACK((short)3, "stack");
-
- 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: // VALUE
- return VALUE;
- case 2: // MESSAGE
- return MESSAGE;
- case 3: // STACK
- return STACK;
- 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 __VALUE_ISSET_ID = 0;
- private byte __isset_bitfield = 0;
- private static final _Fields optionals[] = {_Fields.STACK};
- 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.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
- tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.STACK, new org.apache.thrift.meta_data.FieldMetaData("stack", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryResponseStatus.class, metaDataMap);
- }
-
- public TSentryResponseStatus() {
- }
-
- public TSentryResponseStatus(
- int value,
- String message)
- {
- this();
- this.value = value;
- setValueIsSet(true);
- this.message = message;
- }
-
- /**
- * 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;
- }
- }
-
- public TSentryResponseStatus deepCopy() {
- return new TSentryResponseStatus(this);
- }
-
- @Override
- public void clear() {
- setValueIsSet(false);
- this.value = 0;
- this.message = null;
- this.stack = null;
- }
-
- public int getValue() {
- return this.value;
- }
-
- public void setValue(int value) {
- this.value = value;
- setValueIsSet(true);
- }
-
- public void unsetValue() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __VALUE_ISSET_ID);
- }
-
- /** Returns true if field value is set (has been assigned a value) and false otherwise */
- public boolean isSetValue() {
- return EncodingUtils.testBit(__isset_bitfield, __VALUE_ISSET_ID);
- }
-
- public void setValueIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __VALUE_ISSET_ID, value);
- }
-
- public String getMessage() {
- return this.message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public void unsetMessage() {
- this.message = null;
- }
-
- /** Returns true if field message is set (has been assigned a value) and false otherwise */
- public boolean isSetMessage() {
- return this.message != null;
- }
-
- public void setMessageIsSet(boolean value) {
- if (!value) {
- this.message = null;
- }
- }
-
- public String getStack() {
- return this.stack;
- }
-
- public void setStack(String stack) {
- this.stack = stack;
- }
-
- public void unsetStack() {
- this.stack = null;
- }
-
- /** Returns true if field stack is set (has been assigned a value) and false otherwise */
- public boolean isSetStack() {
- return this.stack != null;
- }
-
- public void setStackIsSet(boolean value) {
- if (!value) {
- this.stack = null;
- }
- }
-
- 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 Object getFieldValue(_Fields field) {
- switch (field) {
- case VALUE:
- return getValue();
-
- case MESSAGE:
- return getMessage();
-
- case STACK:
- return getStack();
-
- }
- 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 VALUE:
- return isSetValue();
- case MESSAGE:
- return isSetMessage();
- case STACK:
- return isSetStack();
- }
- 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;
- }
-
- public boolean equals(TSentryResponseStatus that) {
- if (that == null)
- return false;
-
- boolean this_present_value = true;
- boolean that_present_value = true;
- if (this_present_value || that_present_value) {
- if (!(this_present_value && that_present_value))
- return false;
- if (this.value != that.value)
- return false;
- }
-
- boolean this_present_message = true && this.isSetMessage();
- boolean that_present_message = true && that.isSetMessage();
- if (this_present_message || that_present_message) {
- if (!(this_present_message && that_present_message))
- return false;
- if (!this.message.equals(that.message))
- return false;
- }
-
- boolean this_present_stack = true && this.isSetStack();
- boolean that_present_stack = true && that.isSetStack();
- if (this_present_stack || that_present_stack) {
- if (!(this_present_stack && that_present_stack))
- return false;
- if (!this.stack.equals(that.stack))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List<Object> list = new ArrayList<Object>();
-
- boolean present_value = true;
- list.add(present_value);
- if (present_value)
- list.add(value);
-
- boolean present_message = true && (isSetMessage());
- list.add(present_message);
- if (present_message)
- list.add(message);
-
- boolean present_stack = true && (isSetStack());
- list.add(present_stack);
- if (present_stack)
- list.add(stack);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryResponseStatus other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetValue()).compareTo(other.isSetValue());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetValue()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, other.value);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetMessage()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetStack()).compareTo(other.isSetStack());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetStack()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stack, other.stack);
- 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("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();
- }
-
- 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
- }
-
- 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 TSentryResponseStatusStandardSchemeFactory implements SchemeFactory {
- public TSentryResponseStatusStandardScheme getScheme() {
- return new TSentryResponseStatusStandardScheme();
- }
- }
-
- private static class TSentryResponseStatusStandardScheme extends StandardScheme<TSentryResponseStatus> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryResponseStatus 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: // VALUE
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.value = iprot.readI32();
- struct.setValueIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // MESSAGE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.message = iprot.readString();
- struct.setMessageIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // STACK
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.stack = iprot.readString();
- struct.setStackIsSet(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, 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();
- }
-
- }
-
- private static class TSentryResponseStatusTupleSchemeFactory implements SchemeFactory {
- public TSentryResponseStatusTupleScheme getScheme() {
- return new TSentryResponseStatusTupleScheme();
- }
- }
-
- private static class TSentryResponseStatusTupleScheme extends TupleScheme<TSentryResponseStatus> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryResponseStatus struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.value);
- oprot.writeString(struct.message);
- BitSet optionals = new BitSet();
- if (struct.isSetStack()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetStack()) {
- oprot.writeString(struct.stack);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryResponseStatus struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.value = iprot.readI32();
- struct.setValueIsSet(true);
- struct.message = iprot.readString();
- struct.setMessageIsSet(true);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.stack = iprot.readString();
- struct.setStackIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/sentry_common_serviceConstants.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/sentry_common_serviceConstants.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/sentry_common_serviceConstants.java
deleted file mode 100644
index eb63bc3..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/sentry_common_serviceConstants.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * 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.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"})
-public class sentry_common_serviceConstants {
-
- public static final int TSENTRY_SERVICE_V1 = 1;
-
- public static final int TSENTRY_SERVICE_V2 = 2;
-
- public static final int TSENTRY_STATUS_OK = 0;
-
- public static final int TSENTRY_STATUS_ALREADY_EXISTS = 1;
-
- public static final int TSENTRY_STATUS_NO_SUCH_OBJECT = 2;
-
- public static final int TSENTRY_STATUS_RUNTIME_ERROR = 3;
-
- public static final int TSENTRY_STATUS_INVALID_INPUT = 4;
-
- public static final int TSENTRY_STATUS_ACCESS_DENIED = 5;
-
- public static final int TSENTRY_STATUS_THRIFT_VERSION_MISMATCH = 6;
-
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/generic/thrift/SentryGenericPolicyProcessor.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/generic/thrift/SentryGenericPolicyProcessor.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/generic/thrift/SentryGenericPolicyProcessor.java
new file mode 100644
index 0000000..1cc4b1b
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/generic/thrift/SentryGenericPolicyProcessor.java
@@ -0,0 +1,829 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.generic.thrift;
+
+import static org.apache.sentry.core.common.utils.SentryConstants.AUTHORIZABLE_JOINER;
+import static org.apache.sentry.core.common.utils.SentryConstants.KV_JOINER;
+
+import java.lang.reflect.Constructor;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.sentry.api.common.ThriftConstants;
+import org.apache.sentry.core.common.exception.SentryUserException;
+import org.apache.sentry.core.common.Authorizable;
+import org.apache.sentry.core.common.utils.SentryConstants;
+import org.apache.sentry.core.common.exception.SentrySiteConfigurationException;
+import org.apache.sentry.core.model.db.AccessConstants;
+import org.apache.sentry.core.common.utils.KeyValue;
+import org.apache.sentry.provider.common.AuthorizationComponent;
+import org.apache.sentry.core.common.exception.SentryAccessDeniedException;
+import org.apache.sentry.core.common.exception.SentryAlreadyExistsException;
+import org.apache.sentry.core.common.exception.SentryInvalidInputException;
+import org.apache.sentry.core.common.exception.SentryNoSuchObjectException;
+import org.apache.sentry.core.common.exception.SentryThriftAPIMismatchException;
+import org.apache.sentry.provider.db.generic.service.persistent.DelegateSentryStore;
+import org.apache.sentry.provider.db.generic.service.persistent.PrivilegeObject;
+import org.apache.sentry.provider.db.generic.service.persistent.PrivilegeObject.Builder;
+import org.apache.sentry.provider.db.generic.service.persistent.SentryStoreLayer;
+import org.apache.sentry.provider.db.log.entity.JsonLogEntityFactory;
+import org.apache.sentry.provider.db.log.util.Constants;
+import org.apache.sentry.provider.db.service.model.MSentryGMPrivilege;
+import org.apache.sentry.provider.db.service.model.MSentryRole;
+import org.apache.sentry.core.common.utils.PolicyStoreConstants;
+import org.apache.sentry.api.service.thrift.SentryPolicyStoreProcessor;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
+import org.apache.sentry.api.common.Status;
+import org.apache.sentry.service.thrift.TSentryResponseStatus;
+import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Splitter;
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+
+public class SentryGenericPolicyProcessor implements SentryGenericPolicyService.Iface {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SentryGenericPolicyProcessor.class);
+ private static final Logger AUDIT_LOGGER = LoggerFactory
+ .getLogger(Constants.AUDIT_LOGGER_NAME_GENERIC);
+ private final Configuration conf;
+ private final ImmutableSet<String> adminGroups;
+ private final SentryStoreLayer store;
+ private final NotificationHandlerInvoker handerInvoker;
+
+ private static final String ACCESS_DENIAL_MESSAGE = "Access denied to ";
+
+ SentryGenericPolicyProcessor(Configuration conf) throws Exception {
+ this.store = new DelegateSentryStore(conf);
+ this.handerInvoker = new NotificationHandlerInvoker(createHandlers(conf));
+ this.conf = conf;
+ adminGroups = ImmutableSet.copyOf((Sets.newHashSet(conf.getStrings(
+ ServerConfig.ADMIN_GROUPS, new String[]{}))));
+ }
+
+ @VisibleForTesting
+ SentryGenericPolicyProcessor(Configuration conf, SentryStoreLayer store) throws Exception {
+ this.store = store;
+ this.handerInvoker = new NotificationHandlerInvoker(createHandlers(conf));
+ this.conf = conf;
+ adminGroups = ImmutableSet.copyOf(toTrimmed(Sets.newHashSet(conf.getStrings(
+ ServerConfig.ADMIN_GROUPS, new String[]{}))));
+ }
+
+ private void authorize(String requestorUser, Set<String> requestorGroups)
+ throws SentryAccessDeniedException {
+ if (!inAdminGroups(requestorGroups)) {
+ String msg = "User: " + requestorUser + " is part of " + requestorGroups +
+ " which does not, intersect admin groups " + adminGroups;
+ LOGGER.warn(msg);
+ throw new SentryAccessDeniedException(ACCESS_DENIAL_MESSAGE + requestorUser);
+ }
+ }
+
+ private Set<String> toTrimmedLower(Set<String> s) {
+ if (s == null) {
+ return Collections.emptySet();
+ }
+ Set<String> result = new HashSet<>(s.size());
+ for (String v : s) {
+ result.add(v.trim().toLowerCase());
+ }
+ return result;
+ }
+
+ private Set<String> toTrimmed(Set<String> s) {
+ if (s == null) {
+ return Collections.emptySet();
+ }
+ Set<String> result = new HashSet<>(s.size());
+ for (String v : s) {
+ result.add(v.trim());
+ }
+ return result;
+ }
+
+ private String toTrimmedLower(String s) {
+ if (Strings.isNullOrEmpty(s)){
+ return "";
+ }
+ return s.trim().toLowerCase();
+ }
+
+ private static Set<String> getRequestorGroups(Configuration conf, String userName) throws SentryUserException {
+ return SentryPolicyStoreProcessor.getGroupsFromUserName(conf, userName);
+ }
+
+ private boolean inAdminGroups(Set<String> requestorGroups) {
+ return !Sets.intersection(adminGroups, requestorGroups).isEmpty();
+ }
+
+ static List<NotificationHandler> createHandlers(Configuration conf) throws SentrySiteConfigurationException {
+
+ List<NotificationHandler> handlers = Lists.newArrayList();
+ Iterable<String> notificationHandlers = Splitter.onPattern("[\\s,]").trimResults()
+ .omitEmptyStrings().split(conf.get(PolicyStoreConstants.SENTRY_GENERIC_POLICY_NOTIFICATION, ""));
+ try {
+ for (String notificationHandler : notificationHandlers) {
+ handlers.add(createInstance(notificationHandler, conf, NotificationHandler.class));
+ }
+ } catch (Exception e) {
+ throw new SentrySiteConfigurationException("Create notificationHandlers error: " + e.getMessage(), e);
+ }
+ return handlers;
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <T> T createInstance(String className, Configuration conf, Class<T> iface) throws Exception {
+ T result;
+ try {
+ Class<?> clazz = Class.forName(className);
+ if (!iface.isAssignableFrom(clazz)) {
+ throw new IllegalArgumentException("Class " + clazz + " is not a " +
+ iface.getName());
+ }
+ Constructor<T> meth = (Constructor<T>)clazz.getDeclaredConstructor(Configuration.class);
+ meth.setAccessible(true);
+ result = meth.newInstance(new Object[]{conf});
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ return result;
+ }
+
+ private <T> Response<T> requestHandle(RequestHandler<T> handler) {
+ Response<T> response = new Response<T>();
+ try {
+ response = handler.handle();
+ } catch (SentryAccessDeniedException e) {
+ String msg = "Sentry access denied: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.status = Status.AccessDenied(e.getMessage(), e);
+ } catch (SentryAlreadyExistsException e) {
+ String msg = "Sentry object already exists: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.status = Status.AlreadyExists(e.getMessage(), e);
+ } catch (SentryNoSuchObjectException e) {
+ String msg = "Sentry object doesn't exist: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.status = Status.NoSuchObject(e.getMessage(), e);
+ } catch (SentryInvalidInputException e) {
+ String msg = "Invalid input privilege object: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.status = Status.InvalidInput(msg, e);
+ } catch (SentryThriftAPIMismatchException e) {
+ String msg = "Sentry thrift API mismatch error: " + e.getMessage();
+ LOGGER.error(msg, e);
+ response.status = Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e);
+ } catch (Exception e) {
+ String msg = "Unknown error:" + e.getMessage();
+ LOGGER.error(msg, e);
+ response.status = Status.RuntimeError(msg, e);
+ }
+ return response;
+ }
+
+ private PrivilegeObject toPrivilegeObject(TSentryPrivilege tSentryPrivilege) {
+ Boolean grantOption;
+ if (tSentryPrivilege.getGrantOption().equals(TSentryGrantOption.TRUE)) {
+ grantOption = true;
+ } else if (tSentryPrivilege.getGrantOption().equals(TSentryGrantOption.FALSE)) {
+ grantOption = false;
+ } else {
+ grantOption = null;
+ }
+ return new Builder().setComponent(tSentryPrivilege.getComponent())
+ .setService(tSentryPrivilege.getServiceName())
+ .setAuthorizables(toAuthorizables(tSentryPrivilege.getAuthorizables()))
+ .setAction(tSentryPrivilege.getAction())
+ .withGrantOption(grantOption)
+ .build();
+ }
+
+ private TSentryPrivilege fromPrivilegeObject(PrivilegeObject privilege) {
+
+ TSentryPrivilege tPrivilege = new TSentryPrivilege(privilege.getComponent(), privilege.getService(),
+ fromAuthorizable(privilege.getAuthorizables()),
+ privilege.getAction());
+ if (privilege.getGrantOption() == null) {
+ tPrivilege.setGrantOption(TSentryGrantOption.UNSET);
+ } else if (privilege.getGrantOption()) {
+ tPrivilege.setGrantOption(TSentryGrantOption.TRUE);
+ } else {
+ tPrivilege.setGrantOption(TSentryGrantOption.FALSE);
+ }
+ return tPrivilege;
+ }
+
+ private List<TAuthorizable> fromAuthorizable(List<? extends Authorizable> authorizables) {
+ List<TAuthorizable> tAuthorizables = Lists.newArrayList();
+ for (Authorizable authorizable : authorizables) {
+ tAuthorizables.add(new TAuthorizable(authorizable.getTypeName(), authorizable.getName()));
+ }
+ return tAuthorizables;
+ }
+
+ private String fromAuthorizableToStr(List<? extends Authorizable> authorizables) {
+ if (authorizables != null && !authorizables.isEmpty()) {
+ List<String> privileges = Lists.newArrayList();
+
+ for (Authorizable authorizable : authorizables) {
+
+ privileges.add(SentryConstants.KV_JOINER.join(authorizable.getTypeName(),
+ authorizable.getName()));
+ }
+
+ return SentryConstants.AUTHORIZABLE_JOINER.join(privileges);
+ } else {
+ return "";
+ }
+ }
+
+ private List<? extends Authorizable> toAuthorizables(List<TAuthorizable> tAuthorizables) {
+ List<Authorizable> authorizables = Lists.newArrayList();
+ if (tAuthorizables == null) {
+ return authorizables;
+ }
+ for (final TAuthorizable tAuthorizable : tAuthorizables) {
+ authorizables.add(new Authorizable() {
+ @Override
+ public String getTypeName() {
+ return tAuthorizable.getType();
+ }
+ @Override
+ public String getName() {
+ return tAuthorizable.getName();
+ }
+ });
+ }
+ return authorizables;
+ }
+
+ private List<? extends Authorizable> toAuthorizables(String privilegeStr) {
+ List<Authorizable> authorizables = Lists.newArrayList();
+ if (privilegeStr == null) {
+ return authorizables;
+ }
+
+ for (String authorizable : SentryConstants.AUTHORIZABLE_SPLITTER.split(privilegeStr)) {
+ KeyValue tempKV = new KeyValue(authorizable);
+ final String key = tempKV.getKey();
+ final String value = tempKV.getValue();
+
+ authorizables.add(new Authorizable() {
+ @Override
+ public String getTypeName() {
+ return key;
+ }
+
+ @Override
+ public String getName() {
+ return value;
+ }
+ });
+ }
+
+ return authorizables;
+ }
+
+ // Construct the role to set of privileges mapping based on the
+ // MSentryGMPrivilege information.
+ private TSentryPrivilegeMap toTSentryPrivilegeMap(Set<MSentryGMPrivilege> mPrivileges) {
+
+ // Mapping of <Role, Set<Privilege>>.
+ Map<String, Set<TSentryPrivilege>> tPrivilegeMap = Maps.newTreeMap();
+
+ for (MSentryGMPrivilege mPrivilege : mPrivileges) {
+ for (MSentryRole role : mPrivilege.getRoles()) {
+
+ TSentryPrivilege tPrivilege = toTSentryPrivilege(mPrivilege);
+
+ if (tPrivilegeMap.containsKey(role.getRoleName())) {
+ tPrivilegeMap.get(role.getRoleName()).add(tPrivilege);
+ } else {
+ Set<TSentryPrivilege> tPrivilegeSet = Sets.newTreeSet();
+ tPrivilegeSet.add(tPrivilege);
+ tPrivilegeMap.put(role.getRoleName(), tPrivilegeSet);
+ }
+ }
+ }
+
+ return new TSentryPrivilegeMap(tPrivilegeMap);
+ }
+
+ // Construct TSentryPrivilege based on MSentryGMPrivilege information.
+ private TSentryPrivilege toTSentryPrivilege(MSentryGMPrivilege mPrivilege) {
+
+ TSentryPrivilege tPrivilege = new TSentryPrivilege(mPrivilege.getComponentName(),
+ mPrivilege.getServiceName(), fromAuthorizable(mPrivilege.getAuthorizables()), mPrivilege.getAction());
+
+ if (mPrivilege.getGrantOption() == null) {
+ tPrivilege.setGrantOption(TSentryGrantOption.UNSET);
+ } else if (mPrivilege.getGrantOption()) {
+ tPrivilege.setGrantOption(TSentryGrantOption.TRUE);
+ } else {
+ tPrivilege.setGrantOption(TSentryGrantOption.FALSE);
+ }
+
+ return tPrivilege;
+ }
+
+ private Set<String> buildPermissions(Set<PrivilegeObject> privileges) {
+ Set<String> permissions = Sets.newHashSet();
+ for (PrivilegeObject privilege : privileges) {
+ List<String> hierarchy = Lists.newArrayList();
+ if (hasComponentServerPrivilege(privilege.getComponent())) {
+ hierarchy.add(KV_JOINER.join("server", privilege.getService()));
+ }
+ for (Authorizable authorizable : privilege.getAuthorizables()) {
+ hierarchy.add(KV_JOINER.join(authorizable.getTypeName(),authorizable.getName()));
+ }
+ hierarchy.add(KV_JOINER.join("action", privilege.getAction()));
+ permissions.add(AUTHORIZABLE_JOINER.join(hierarchy));
+ }
+ return permissions;
+ }
+
+ private boolean hasComponentServerPrivilege(String component) {
+ //judge the component whether has the server privilege, for example: sqoop has the privilege on the server
+ return AuthorizationComponent.SQOOP.equalsIgnoreCase(component);
+ }
+
+ @Override
+ public TCreateSentryRoleResponse create_sentry_role(
+ final TCreateSentryRoleRequest request) throws TException {
+ Response<Void> respose = requestHandle(new RequestHandler<Void>() {
+ @Override
+ public Response<Void> handle() throws Exception {
+ validateClientVersion(request.getProtocol_version());
+ authorize(request.getRequestorUserName(),
+ getRequestorGroups(conf, request.getRequestorUserName()));
+ store.createRole(request.getComponent(), request.getRoleName(),
+ request.getRequestorUserName());
+ return new Response<Void>(Status.OK());
+ }
+ });
+
+ TCreateSentryRoleResponse tResponse = new TCreateSentryRoleResponse(respose.status);
+ if (Status.OK.getCode() == respose.status.getValue()) {
+ handerInvoker.create_sentry_role(request, tResponse);
+ }
+
+ try {
+ AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
+ .createJsonLogEntity(request, tResponse, conf).toJsonFormatLog());
+ } catch (Exception e) {
+ // if any exception, log the exception.
+ String msg = "Error in creating audit log for create role: " + e.getMessage();
+ LOGGER.error(msg, e);
+ }
+ return tResponse;
+ }
+
+ @Override
+ public TDropSentryRoleResponse drop_sentry_role(final TDropSentryRoleRequest request)
+ throws TException {
+ Response<Void> respose = requestHandle(new RequestHandler<Void>() {
+ @Override
+ public Response<Void> handle() throws Exception {
+ validateClientVersion(request.getProtocol_version());
+ authorize(request.getRequestorUserName(),
+ getRequestorGroups(conf, request.getRequestorUserName()));
+ store.dropRole(request.getComponent(), request.getRoleName(),
+ request.getRequestorUserName());
+ return new Response<Void>(Status.OK());
+ }
+ });
+
+ TDropSentryRoleResponse tResponse = new TDropSentryRoleResponse(respose.status);
+ if (Status.OK.getCode() == respose.status.getValue()) {
+ handerInvoker.drop_sentry_role(request, tResponse);
+ }
+
+ try {
+ AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
+ .createJsonLogEntity(request, tResponse, conf).toJsonFormatLog());
+ } catch (Exception e) {
+ // if any exception, log the exception.
+ String msg = "Error in creating audit log for drop role: " + e.getMessage();
+ LOGGER.error(msg, e);
+ }
+ return tResponse;
+ }
+
+ @Override
+ public TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(
+ final TAlterSentryRoleGrantPrivilegeRequest request) throws TException {
+ Response<Void> respose = requestHandle(new RequestHandler<Void>() {
+ @Override
+ public Response<Void> handle() throws Exception {
+ validateClientVersion(request.getProtocol_version());
+ store.alterRoleGrantPrivilege(request.getComponent(),
+ request.getRoleName(),
+ toPrivilegeObject(request.getPrivilege()),
+ request.getRequestorUserName());
+ return new Response<Void>(Status.OK());
+ }
+ });
+
+ TAlterSentryRoleGrantPrivilegeResponse tResponse = new TAlterSentryRoleGrantPrivilegeResponse(respose.status);
+ if (Status.OK.getCode() == respose.status.getValue()) {
+ handerInvoker.alter_sentry_role_grant_privilege(request, tResponse);
+ }
+
+ try {
+ AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
+ .createJsonLogEntity(request, tResponse, conf).toJsonFormatLog());
+ } catch (Exception e) {
+ // if any exception, log the exception.
+ String msg = "Error in creating audit log for grant privilege to role: " + e.getMessage();
+ LOGGER.error(msg, e);
+ }
+ return tResponse;
+ }
+
+ @Override
+ public TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(
+ final TAlterSentryRoleRevokePrivilegeRequest request) throws TException {
+ Response<Void> respose = requestHandle(new RequestHandler<Void>() {
+ @Override
+ public Response<Void> handle() throws Exception {
+ validateClientVersion(request.getProtocol_version());
+ store.alterRoleRevokePrivilege(request.getComponent(),
+ request.getRoleName(),
+ toPrivilegeObject(request.getPrivilege()),
+ request.getRequestorUserName());
+ return new Response<Void>(Status.OK());
+ }
+ });
+
+ TAlterSentryRoleRevokePrivilegeResponse tResponse =
+ new TAlterSentryRoleRevokePrivilegeResponse(respose.status);
+ if (Status.OK.getCode() == respose.status.getValue()) {
+ handerInvoker.alter_sentry_role_revoke_privilege(request, tResponse);
+ }
+
+ try {
+ AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
+ .createJsonLogEntity(request, tResponse, conf).toJsonFormatLog());
+ } catch (Exception e) {
+ // if any exception, log the exception.
+ String msg = "Error in creating audit log for revoke privilege from role: " + e.getMessage();
+ LOGGER.error(msg, e);
+ }
+ return tResponse;
+ }
+
+ @Override
+ public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(
+ final TAlterSentryRoleAddGroupsRequest request) throws TException {
+ Response<Void> respose = requestHandle(new RequestHandler<Void>() {
+ @Override
+ public Response<Void> handle() throws Exception {
+ validateClientVersion(request.getProtocol_version());
+ authorize(request.getRequestorUserName(),
+ getRequestorGroups(conf, request.getRequestorUserName()));
+ store.alterRoleAddGroups(request.getComponent(),
+ request.getRoleName(),
+ request.getGroups(),
+ request.getRequestorUserName());
+ return new Response<Void>(Status.OK());
+ }
+ });
+
+ TAlterSentryRoleAddGroupsResponse tResponse =
+ new TAlterSentryRoleAddGroupsResponse(respose.status);
+ if (Status.OK.getCode() == respose.status.getValue()) {
+ handerInvoker.alter_sentry_role_add_groups(request, tResponse);
+ }
+
+ try {
+ AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
+ .createJsonLogEntity(request, tResponse, conf).toJsonFormatLog());
+ } catch (Exception e) {
+ // if any exception, log the exception.
+ String msg = "Error in creating audit log for add role to group: " + e.getMessage();
+ LOGGER.error(msg, e);
+ }
+ return tResponse;
+ }
+
+ @Override
+ public TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(
+ final TAlterSentryRoleDeleteGroupsRequest request) throws TException {
+ Response<Void> respose = requestHandle(new RequestHandler<Void>() {
+ @Override
+ public Response<Void> handle() throws Exception {
+ validateClientVersion(request.getProtocol_version());
+ authorize(request.getRequestorUserName(),
+ getRequestorGroups(conf, request.getRequestorUserName()));
+ store.alterRoleDeleteGroups(request.getComponent(),
+ request.getRoleName(),
+ request.getGroups(),
+ request.getRequestorUserName());
+ return new Response<Void>(Status.OK());
+ }
+ });
+
+ TAlterSentryRoleDeleteGroupsResponse tResponse =
+ new TAlterSentryRoleDeleteGroupsResponse(respose.status);
+ if (Status.OK.getCode() == respose.status.getValue()) {
+ handerInvoker.alter_sentry_role_delete_groups(request, tResponse);
+ }
+
+ try {
+ AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
+ .createJsonLogEntity(request, tResponse, conf).toJsonFormatLog());
+ } catch (Exception e) {
+ // if any exception, log the exception.
+ String msg = "Error in creating audit log for delete role from group: " +
+ e.getMessage();
+ LOGGER.error(msg, e);
+ }
+ return tResponse;
+ }
+
+ @Override
+ public TListSentryRolesResponse list_sentry_roles_by_group(
+ final TListSentryRolesRequest request) throws TException {
+ Response<Set<TSentryRole>> respose = requestHandle(new RequestHandler<Set<TSentryRole>>() {
+ @Override
+ public Response<Set<TSentryRole>> handle() throws Exception {
+ validateClientVersion(request.getProtocol_version());
+ Set<String> groups = getRequestorGroups(conf, request.getRequestorUserName());
+ if (!AccessConstants.ALL.equalsIgnoreCase(request.getGroupName())) {
+ boolean admin = inAdminGroups(groups);
+ //Only admin users can list all roles in the system ( groupname = null)
+ //Non admin users are only allowed to list only groups which they belong to
+ if(!admin && (request.getGroupName() == null || !groups.contains(request.getGroupName()))) {
+ throw new SentryAccessDeniedException(ACCESS_DENIAL_MESSAGE + request.getRequestorUserName());
+ }
+ groups.clear();
+ groups.add(request.getGroupName());
+ }
+
+ Set<String> roleNames = store.getRolesByGroups(request.getComponent(), groups);
+ Set<TSentryRole> tSentryRoles = Sets.newHashSet();
+ for (String roleName : roleNames) {
+ Set<String> groupsForRoleName = store.getGroupsByRoles(request.getComponent(), Sets.newHashSet(roleName));
+ tSentryRoles.add(new TSentryRole(roleName, groupsForRoleName));
+ }
+ return new Response<Set<TSentryRole>>(Status.OK(), tSentryRoles);
+ }
+ });
+ TListSentryRolesResponse tResponse = new TListSentryRolesResponse();
+ tResponse.setStatus(respose.status);
+ tResponse.setRoles(respose.content);
+ return tResponse;
+ }
+
+ @Override
+ public TListSentryPrivilegesResponse list_sentry_privileges_by_role(
+ final TListSentryPrivilegesRequest request) throws TException {
+ Response<Set<TSentryPrivilege>> respose = requestHandle(new RequestHandler<Set<TSentryPrivilege>>() {
+ @Override
+ public Response<Set<TSentryPrivilege>> handle() throws Exception {
+ validateClientVersion(request.getProtocol_version());
+ Set<String> groups = getRequestorGroups(conf, request.getRequestorUserName());
+ if (!inAdminGroups(groups)) {
+ Set<String> roleNamesForGroups = toTrimmedLower(store.getRolesByGroups(request.getComponent(), groups));
+ if (!roleNamesForGroups.contains(toTrimmedLower(request.getRoleName()))) {
+ throw new SentryAccessDeniedException(ACCESS_DENIAL_MESSAGE + request.getRequestorUserName());
+ }
+ }
+ Set<PrivilegeObject> privileges = store.getPrivilegesByProvider(request.getComponent(),
+ request.getServiceName(),
+ Sets.newHashSet(request.getRoleName()),
+ null, toAuthorizables(request.getAuthorizables()));
+ Set<TSentryPrivilege> tSentryPrivileges = Sets.newHashSet();
+ for (PrivilegeObject privilege : privileges) {
+ tSentryPrivileges.add(fromPrivilegeObject(privilege));
+ }
+ return new Response<Set<TSentryPrivilege>>(Status.OK(), tSentryPrivileges);
+ }
+ });
+ TListSentryPrivilegesResponse tResponse = new TListSentryPrivilegesResponse();
+ tResponse.setStatus(respose.status);
+ tResponse.setPrivileges(respose.content);
+ return tResponse;
+ }
+
+ @Override
+ public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(
+ final TListSentryPrivilegesForProviderRequest request) throws TException {
+ Response<Set<String>> respose = requestHandle(new RequestHandler<Set<String>>() {
+ @Override
+ public Response<Set<String>> handle() throws Exception {
+ validateClientVersion(request.getProtocol_version());
+ Set<String> activeRoleNames = toTrimmedLower(request.getRoleSet().getRoles());
+ Set<String> roleNamesForGroups = store.getRolesByGroups(request.getComponent(), request.getGroups());
+ Set<String> rolesToQuery = request.getRoleSet().isAll() ? roleNamesForGroups : Sets.intersection(activeRoleNames, roleNamesForGroups);
+ Set<PrivilegeObject> privileges = store.getPrivilegesByProvider(request.getComponent(),
+ request.getServiceName(),
+ rolesToQuery, null,
+ toAuthorizables(request.getAuthorizables()));
+ return new Response<Set<String>>(Status.OK(), buildPermissions(privileges));
+ }
+ });
+ TListSentryPrivilegesForProviderResponse tResponse = new TListSentryPrivilegesForProviderResponse();
+ tResponse.setStatus(respose.status);
+ tResponse.setPrivileges(respose.content);
+ return tResponse;
+ }
+
+ @Override
+ public TListSentryPrivilegesByAuthResponse list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request) throws TException {
+
+ TListSentryPrivilegesByAuthResponse response = new TListSentryPrivilegesByAuthResponse();
+ Map<String, TSentryPrivilegeMap> authRoleMap = Maps.newHashMap();
+
+ // Group names are case sensitive.
+ Set<String> requestedGroups = request.getGroups();
+ String subject = request.getRequestorUserName();
+ TSentryActiveRoleSet activeRoleSet = request.getRoleSet();
+ Set<String> validActiveRoles = Sets.newHashSet();
+
+ try {
+ validateClientVersion(request.getProtocol_version());
+ Set<String> memberGroups = getRequestorGroups(conf, subject);
+
+ // Disallow non-admin users to lookup groups that
+ // they are not part of.
+ if(!inAdminGroups(memberGroups)) {
+
+ if (requestedGroups != null && !requestedGroups.isEmpty()) {
+ for (String requestedGroup : requestedGroups) {
+
+ // If user doesn't belong to one of the requested groups,
+ // then raise security exception.
+ if (!memberGroups.contains(requestedGroup)) {
+ throw new SentryAccessDeniedException(ACCESS_DENIAL_MESSAGE + subject);
+ }
+ }
+ } else {
+ // Non-admin's search is limited to its own groups.
+ requestedGroups = memberGroups;
+ }
+
+ Set<String> grantedRoles = toTrimmedLower(store.getRolesByGroups(request.getComponent(), requestedGroups));
+
+ // If activeRoleSet is not null, disallow non-admin to lookup roles that they are not part of.
+ if (activeRoleSet != null && !activeRoleSet.isAll()) {
+
+ Set<String> activeRoleNames = toTrimmedLower(activeRoleSet.getRoles());
+ for (String activeRole : activeRoleNames) {
+ if (!grantedRoles.contains(activeRole)) {
+ throw new SentryAccessDeniedException(ACCESS_DENIAL_MESSAGE
+ + subject);
+ }
+ }
+
+ // For non-admin, valid active roles are intersection of active roles and granted roles.
+ validActiveRoles.addAll(activeRoleSet.isAll() ? grantedRoles : Sets.intersection(activeRoleNames, grantedRoles));
+ } else {
+ // For non-admin, if activeRoleSet is null, valid active roles would be the granted roles.
+ validActiveRoles.addAll(grantedRoles);
+ }
+ } else {
+ // For admin, if requestedGroups are empty, requested roles will be all roles.
+ Set<String> requestedRoles = toTrimmedLower(store.getAllRoleNames());
+ if (requestedGroups != null && !requestedGroups.isEmpty()) {
+ requestedRoles = toTrimmedLower(store.getRolesByGroups(request.getComponent(), requestedGroups));
+ }
+
+ // If activeRoleSet (which is optional) is not null, valid active role will be intersection
+ // of active roles and requested roles. Otherwise, valid active roles are the requested roles.
+ if (activeRoleSet != null && !activeRoleSet.isAll()) {
+ validActiveRoles.addAll(Sets.intersection(toTrimmedLower(activeRoleSet.getRoles()), requestedRoles));
+ } else {
+ validActiveRoles.addAll(requestedRoles);
+ }
+ }
+
+ // If user is not part of any group.. return empty response
+ if (request.getAuthorizablesSet() != null) {
+ for (String authorizablesStr : request.getAuthorizablesSet()) {
+
+ List<? extends Authorizable> authorizables = toAuthorizables(authorizablesStr);
+ Set<MSentryGMPrivilege> sentryPrivileges = store.getPrivilegesByAuthorizable(request.getComponent(), request.getServiceName(), validActiveRoles, authorizables);
+ authRoleMap.put(fromAuthorizableToStr(authorizables), toTSentryPrivilegeMap(sentryPrivileges));
+ }
+ }
+
+ response.setPrivilegesMapByAuth(authRoleMap);
+ response.setStatus(Status.OK());
+ } catch (SentryAccessDeniedException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.AccessDenied(e.getMessage(), e));
+ } catch (SentryThriftAPIMismatchException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
+ } catch (Exception e) {
+ String msg = "Unknown error for request: " + request + ", message: "
+ + e.getMessage();
+ LOGGER.error(msg, e);
+ response.setStatus(Status.RuntimeError(msg, e));
+ }
+
+ return response;
+ }
+
+ @Override
+ public TDropPrivilegesResponse drop_sentry_privilege(
+ final TDropPrivilegesRequest request) throws TException {
+ Response<Void> respose = requestHandle(new RequestHandler<Void>() {
+ @Override
+ public Response<Void> handle() throws Exception {
+ validateClientVersion(request.getProtocol_version());
+ authorize(request.getRequestorUserName(),
+ getRequestorGroups(conf, request.getRequestorUserName()));
+ store.dropPrivilege(request.getComponent(),
+ toPrivilegeObject(request.getPrivilege()),
+ request.getRequestorUserName());
+ return new Response<Void>(Status.OK());
+ }
+ });
+
+ TDropPrivilegesResponse tResponse = new TDropPrivilegesResponse(respose.status);
+ if (Status.OK.getCode() == respose.status.getValue()) {
+ handerInvoker.drop_sentry_privilege(request, tResponse);
+ }
+ return tResponse;
+ }
+
+ @Override
+ public TRenamePrivilegesResponse rename_sentry_privilege(
+ final TRenamePrivilegesRequest request) throws TException {
+ Response<Void> respose = requestHandle(new RequestHandler<Void>() {
+ @Override
+ public Response<Void> handle() throws Exception {
+ validateClientVersion(request.getProtocol_version());
+ authorize(request.getRequestorUserName(),
+ getRequestorGroups(conf, request.getRequestorUserName()));
+ store.renamePrivilege(request.getComponent(), request.getServiceName(),
+ toAuthorizables(request.getOldAuthorizables()),
+ toAuthorizables(request.getNewAuthorizables()),
+ request.getRequestorUserName());
+ return new Response<Void>(Status.OK());
+ }
+ });
+
+ TRenamePrivilegesResponse tResponse = new TRenamePrivilegesResponse(respose.status);
+ if (Status.OK.getCode() == respose.status.getValue()) {
+ handerInvoker.rename_sentry_privilege(request, tResponse);
+ }
+ return tResponse;
+ }
+
+ private static class Response<T> {
+ private TSentryResponseStatus status;
+ private T content;
+
+ Response() {
+ }
+
+ Response(TSentryResponseStatus status) {
+ this(status, null);
+ }
+
+ Response(TSentryResponseStatus status, T content) {
+ this.status = status;
+ this.content = content;
+ }
+ }
+ private interface RequestHandler <T>{
+ Response<T> handle() throws Exception ;
+ }
+
+ private static void validateClientVersion(int protocolVersion) throws SentryThriftAPIMismatchException {
+ if (ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT != protocolVersion) {
+ String msg = "Sentry thrift API protocol version mismatch: Client thrift version " +
+ "is: " + protocolVersion + " , server thrift version " +
+ "is " + ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT;
+ throw new SentryThriftAPIMismatchException(msg);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/generic/thrift/SentryGenericPolicyProcessorFactory.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/generic/thrift/SentryGenericPolicyProcessorFactory.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/generic/thrift/SentryGenericPolicyProcessorFactory.java
new file mode 100644
index 0000000..311b020
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/generic/thrift/SentryGenericPolicyProcessorFactory.java
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.generic.thrift;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.sentry.api.common.ApiConstants.SentryPolicyServiceConstants;
+import org.apache.sentry.provider.db.service.persistent.SentryStore;
+import org.apache.sentry.service.thrift.ProcessorFactory;
+import org.apache.thrift.TMultiplexedProcessor;
+import org.apache.thrift.TProcessor;
+
+public class SentryGenericPolicyProcessorFactory extends ProcessorFactory {
+
+ public SentryGenericPolicyProcessorFactory(Configuration conf) {
+ super(conf);
+ }
+
+ @Override
+ public boolean register(TMultiplexedProcessor multiplexedProcessor,
+ SentryStore _) throws Exception {
+ SentryGenericPolicyProcessor processHandler = new SentryGenericPolicyProcessor(conf);
+ TProcessor processor = new SentryGenericPolicyProcessorWrapper<SentryGenericPolicyService.Iface>(
+ processHandler);
+ multiplexedProcessor.registerProcessor(
+ SentryPolicyServiceConstants.SENTRY_GENERIC_SERVICE_NAME, processor);
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/ConfServlet.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/ConfServlet.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/ConfServlet.java
new file mode 100644
index 0000000..8625487
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/ConfServlet.java
@@ -0,0 +1,71 @@
+package org.apache.sentry.api.service.thrift;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.hadoop.conf.Configuration;
+
+import static org.apache.commons.lang.StringEscapeUtils.escapeHtml;
+
+/**
+ * Servlet to print out all sentry configuration.
+ */
+public class ConfServlet extends HttpServlet {
+ public static final String CONF_CONTEXT_ATTRIBUTE = "sentry.conf";
+ public static final String FORMAT_JSON = "json";
+ public static final String FORMAT_XML = "xml";
+ public static final String FORMAT_PARAM = "format";
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ String format = request.getParameter(FORMAT_PARAM);
+ if (format == null) {
+ format = FORMAT_XML;
+ }
+
+ if (FORMAT_XML.equals(format)) {
+ response.setContentType("text/xml; charset=utf-8");
+ } else if (FORMAT_JSON.equals(format)) {
+ response.setContentType("application/json; charset=utf-8");
+ }
+
+ Configuration conf = (Configuration)getServletContext().getAttribute(
+ CONF_CONTEXT_ATTRIBUTE);
+ assert conf != null;
+
+ Writer out = response.getWriter();
+ if (FORMAT_JSON.equals(format)) {
+ Configuration.dumpConfiguration(conf, out);
+ } else if (FORMAT_XML.equals(format)) {
+ conf.writeXml(out);
+ } else {
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Bad format: " + escapeHtml(format));
+ }
+ out.close();
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/LogLevelServlet.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/LogLevelServlet.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/LogLevelServlet.java
new file mode 100644
index 0000000..af81d6f
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/LogLevelServlet.java
@@ -0,0 +1,122 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.service.thrift;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import static org.apache.commons.lang.StringEscapeUtils.escapeHtml;
+
+public class LogLevelServlet extends HttpServlet {
+ private static final String LF = "\n";
+ private static final String BR = "<br />";
+ private static final String B_BR = "<b>%s</b><br />";
+ private static final String FORMS_HEAD =
+ "<h1>" + "Log Level" + "</h1>"
+ + LF + BR + "<hr /><h3>Results</h3>"
+ + LF + " Submitted Log Name: " + B_BR;
+ private static final String FORMS_CONTENT_GET =
+ LF + " Effective level: " + B_BR;
+ private static final String FORMS_CONTENT_SET =
+ LF + " Submitted Level: " + B_BR
+ + LF + " Setting Level to %s" + BR
+ + LF + " Effective level: " + B_BR;
+ private static final String FORMS_END =
+ LF + BR + "<hr /><h3>Get / Set</h3>"
+ + LF + "<form>Log: <input type='text' size='50' name='log' /> "
+ + "<input type='submit' value='Get Log Level' />" + "</form>"
+ + LF + "<form>Log: <input type='text' size='50' name='log' /> "
+ + "Level: <input type='text' name='level' /> "
+ + "<input type='submit' value='Set Log Level' />" + "</form>";
+ private static final String FORMS_GET = FORMS_HEAD + FORMS_CONTENT_GET;
+ private static final String FORMS_SET = FORMS_HEAD + FORMS_CONTENT_SET;
+
+ /**
+ * Return parameter on servlet request for the given name
+ *
+ * @param request: Servlet request
+ * @param name: Name of parameter in servlet request
+ * @return Parameter in servlet request for the given name, return null if can't find parameter.
+ */
+ private String getParameter(ServletRequest request, String name) {
+ String s = request.getParameter(name);
+ if (s == null) {
+ return null;
+ }
+ s = s.trim();
+ return s.length() == 0 ? null : s;
+ }
+
+ /**
+ * Check the validity of the log level.
+ * @param level: The log level to be checked
+ * @return
+ * true: The log level is valid
+ * false: The log level is invalid
+ */
+ private boolean isLogLevelValid(String level) {
+ return level.equals(Level.toLevel(level).toString());
+ }
+
+ /**
+ * Parse the class name and log level in the http servlet request.
+ * If the request contains only class name, return the log level in the response message.
+ * If the request contains both class name and level, set the log level to the requested level
+ * and return the setting result in the response message.
+ */
+ @Override
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ String logName = getParameter(request, "log");
+ String level = getParameter(request, "level");
+ response.setContentType("text/html;charset=utf-8");
+ response.setStatus(HttpServletResponse.SC_OK);
+ PrintWriter out = response.getWriter();
+
+ if (logName != null) {
+ Logger logInstance = LogManager.getLogger(logName);
+ if (level == null) {
+ out.write(String.format(FORMS_GET,
+ escapeHtml(logName),
+ logInstance.getEffectiveLevel().toString()));
+ } else if (isLogLevelValid(level)) {
+ logInstance.setLevel(Level.toLevel(level));
+ out.write(String.format(FORMS_SET,
+ escapeHtml(logName),
+ escapeHtml(level),
+ escapeHtml(level),
+ logInstance.getEffectiveLevel().toString()));
+ } else {
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Invalid log level: " + escapeHtml(level));
+ return;
+ }
+ }
+ out.write(FORMS_END);
+ out.close();
+ response.flushBuffer();
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/PubSubServlet.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/PubSubServlet.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/PubSubServlet.java
new file mode 100644
index 0000000..8da35f1
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/PubSubServlet.java
@@ -0,0 +1,128 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.service.thrift;
+
+import org.apache.sentry.core.common.utils.PubSub;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import static org.apache.commons.lang.StringEscapeUtils.escapeHtml;
+
+/**
+ * This servlet facilitates sending {topic, message } tuples to Servlet components
+ * subscribed to specific topics.
+ * <p>
+ * It uses publish-subscribe mechanism implemented by PubSub class.
+ * The form generated by this servlet consists of the following elements:
+ * <p>
+ * a) Topic: pull-down menu of existing topics, i.e. the topics registered with
+ * PubSub by calling PubSub.subscribe() API. This prevents entering invalid topic.
+ * <p>
+ * b) Message: text field for entering a message
+ * <p>
+ * c) Submit: button to submit (topic, message) tuple
+ * <p>
+ * d) Status: text area printing status of the request or help information.
+ */
+public class PubSubServlet extends HttpServlet {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(PubSubServlet.class);
+
+ private static final String FORM_GET =
+ "<!DOCTYPE html>" +
+ "<html>" +
+ "<body>" +
+ "<form>" +
+ "<br><br><b>Topic:</b><br><br>" +
+ "<select name='topic'/>%s</select>" +
+ "<br><br><b>Message:</b><br><br>" +
+ "<input type='text' size='50' name='message'/>" +
+ "<br><br>" +
+ "<input type='submit' value='Submit'/>" +
+ "</form>" +
+ "<br><br><b>Status:</b><br><br>" +
+ "<textarea rows='4' cols='50'>%s</textarea>" +
+ "</body>" +
+ "</html>";
+
+ /**
+ * Return parameter on servlet request for the given name
+ *
+ * @param request: Servlet request
+ * @param name: Name of parameter in servlet request
+ * @return Parameter in servlet request for the given name, return null if can't find parameter.
+ */
+ private static String getParameter(ServletRequest request, String name) {
+ String s = request.getParameter(name);
+ if (s == null) {
+ return null;
+ }
+ s = s.trim();
+ return s.isEmpty() ? null : s;
+ }
+
+ /**
+ * Parse the topic and message values and submit them via PubSub.submit() API.
+ * Reject request for unknown topic, i.e. topic no one is subscribed to.
+ */
+ @Override
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ String topic = getParameter(request, "topic");
+ String message = getParameter(request, "message");
+ response.setContentType("text/html;charset=utf-8");
+ response.setStatus(HttpServletResponse.SC_OK);
+ PrintWriter out = response.getWriter();
+
+ String msg = "Topic is required, Message is optional.\nValid topics: " + PubSub.getInstance().getTopics();
+ if (topic != null) {
+ LOGGER.info("Submitting topic " + topic + ", message " + message);
+ try {
+ PubSub.getInstance().publish(PubSub.Topic.fromString(topic), message);
+ msg = "Submitted topic " + topic + ", message " + message;
+ } catch (Exception e) {
+ msg = "Failed to submit topic " + topic + ", message " + message + " - " + e.getMessage();
+ LOGGER.error(msg);
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST, msg);
+ return;
+ }
+ }
+
+ StringBuilder topics = new StringBuilder();
+ for (PubSub.Topic t : PubSub.getInstance().getTopics()) {
+ topics.append("<option>").append(t.getName()).append("</option>");
+ }
+
+ String output = String.format(FORM_GET, topics.toString(), escapeHtml(msg));
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("HTML Page: " + output);
+ }
+ out.write(output);
+ out.close();
+ response.flushBuffer();
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryAdminServlet.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryAdminServlet.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryAdminServlet.java
new file mode 100644
index 0000000..5dc6cd6
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryAdminServlet.java
@@ -0,0 +1,132 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.service.thrift;
+
+import com.google.gson.Gson;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.sentry.provider.db.service.persistent.SentryStore;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Admin Servlet is only used when SENTRY_WEB_ADMIN_SERVLET_ENABLED is true.
+ */
+public class SentryAdminServlet extends HttpServlet {
+ private static final String SHOW_ALL = "/showAll";
+ // Here we use the same way as in com.codahale.metrics.servlets.AdminServlet, and just
+ // use the TEMPLATE as a static html with some links referenced to other debug pages.
+ private static final String TEMPLATE = "<!DOCTYPE HTML>\n"+
+ "<html lang=\"en\">\n"+
+ "<head>\n"+
+ " <meta charset=\"utf-8\">\n"+
+ " <title>Sentry Service Admin</title>\n"+
+ " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n"+
+ " <meta name=\"description\" content=\"\">\n"+
+ " <link href=\"css/bootstrap.min.css\" rel=\"stylesheet\">\n"+
+ " <link href=\"css/bootstrap-theme.min.css\" rel=\"stylesheet\">\n"+
+ " <link href=\"css/sentry.css\" rel=\"stylesheet\">\n"+
+ "</head>\n"+
+ "<body>\n"+
+ "<nav class=\"navbar navbar-default navbar-fixed-top\">\n"+
+ " <div class=\"container\">\n"+
+ " <div class=\"navbar-header\">\n"+
+ " <a class=\"navbar-brand\" href=\"#\"><img src=\"sentry.png\" alt=\"Sentry Logo\"/></a>\n"+
+ " </div>\n"+
+ " <div class=\"collapse navbar-collapse\">\n"+
+ " <ul class=\"nav navbar-nav\">\n"+
+ " <li class=\"active\"><a href=\"#\">Admin</a></li>\n"+
+ " <li><a href=\"/metrics?pretty=true\">Metrics</a></li>\n"+
+ " <li><a href=\"/threads\">Threads</a></li>\n"+
+ " <li><a href=\"/conf\">Configuration</a></li>\n"+
+ " <li><a href=\"/admin/showAll\">ShowAllRoles</a></li>\n"+
+ " </ul>\n"+
+ " </div>\n"+
+ " </div>\n"+
+ "</nav>\n"+
+ "<div class=\"container\">\n"+
+ " <ul>\n"+
+ " <li><a href=\"/metrics?pretty=true\">Metrics</a></li>\n"+
+ " <li><a href=\"/threads\">Threads</a></li>\n"+
+ " <li><a href=\"/conf\">Configuration</a></li>\n"+
+ " <li><a href=\"/admin/showAll\">ShowAllRoles</a></li>\n"+
+ " </ul>\n"+
+ "</div>\n"+
+ "</body>\n"+
+ "</html>";
+
+ @Override
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ String uri = request.getPathInfo();
+ if(uri != null && !uri.equals("/")) {
+ if (uri.equals(SHOW_ALL)) {
+ showAll(response);
+ } else {
+ response.sendError(404);
+ }
+ } else {
+ response.setStatus(200);
+ response.setHeader("Cache-Control", "must-revalidate,no-cache,no-store");
+ response.setHeader("Pragma", "no-cache");
+ response.setDateHeader("Expires", 0);
+ response.setContentType("text/html");
+ PrintWriter writer = response.getWriter();
+ try {
+ writer.println(TEMPLATE);
+ } finally {
+ writer.close();
+ }
+ }
+ }
+
+ /**
+ * Print out all the roles and privileges information as json format.
+ */
+ private void showAll(HttpServletResponse response)
+ throws ServletException, IOException {
+ Configuration conf = (Configuration)getServletContext().getAttribute(
+ ConfServlet.CONF_CONTEXT_ATTRIBUTE);
+ assert conf != null;
+
+ Writer out = response.getWriter();
+ try {
+ SentryStore sentrystore = new SentryStore(conf);
+ Map<String, Set<TSentryPrivilege>> roleMap = new HashMap<>();
+ Set<String> roleSet = sentrystore.getAllRoleNames();
+ for (String roleName: roleSet) {
+ roleMap.put(roleName, sentrystore.getAllTSentryPrivilegesByRoleName(roleName));
+ }
+ String json = new Gson().toJson(roleMap);
+ response.setContentType("application/json");
+ response.setCharacterEncoding("UTF-8");
+ out.write(json);
+ } catch (Exception e) {
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage());
+ }
+ out.close();
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryAuthFilter.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryAuthFilter.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryAuthFilter.java
new file mode 100644
index 0000000..23121ec
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryAuthFilter.java
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.service.thrift;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
+import org.apache.hadoop.util.StringUtils;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Sets;
+
+/**
+ * SentryAuthFilter is a subclass of AuthenticationFilter,
+ * add authorization: Only allowed users could connect the web server.
+ */
+public class SentryAuthFilter extends AuthenticationFilter {
+
+ private static final Logger LOG = LoggerFactory.getLogger(SentryAuthFilter.class);
+
+ public static final String ALLOW_WEB_CONNECT_USERS = ServerConfig.SENTRY_WEB_SECURITY_ALLOW_CONNECT_USERS;
+
+ private Set<String> allowUsers;
+
+ @Override
+ protected void doFilter(FilterChain filterChain, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ String userName = request.getRemoteUser();
+ LOG.debug("Authenticating user: " + userName + " from request.");
+ if (!allowUsers.contains(userName)) {
+ response.sendError(HttpServletResponse.SC_FORBIDDEN,
+ "Unauthorized user status code: " + HttpServletResponse.SC_FORBIDDEN);
+ throw new ServletException(userName + " is unauthorized. status code: " + HttpServletResponse.SC_FORBIDDEN);
+ }
+ super.doFilter(filterChain, request, response);
+ }
+
+ /**
+ * Override <code>getConfiguration<code> to get <code>ALLOW_WEB_CONNECT_USERS<code>.
+ */
+ @Override
+ protected Properties getConfiguration(String configPrefix, FilterConfig filterConfig) throws ServletException {
+ Properties props = new Properties();
+ Enumeration<?> names = filterConfig.getInitParameterNames();
+ while (names.hasMoreElements()) {
+ String name = (String) names.nextElement();
+ if (name.startsWith(configPrefix)) {
+ String value = filterConfig.getInitParameter(name);
+ if (ALLOW_WEB_CONNECT_USERS.equals(name)) {
+ allowUsers = parseConnectUsersFromConf(value);
+ } else {
+ props.put(name.substring(configPrefix.length()), value);
+ }
+ }
+ }
+ return props;
+ }
+
+ private static Set<String> parseConnectUsersFromConf(String value) {
+ //Removed the logic to convert the allowed users to lower case, as user names need to be case sensitive
+ return Sets.newHashSet(StringUtils.getStrings(value));
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryHealthCheckServletContextListener.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryHealthCheckServletContextListener.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryHealthCheckServletContextListener.java
new file mode 100644
index 0000000..eb11c19
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/api/service/thrift/SentryHealthCheckServletContextListener.java
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.service.thrift;
+
+import com.codahale.metrics.health.HealthCheckRegistry;
+import com.codahale.metrics.servlets.HealthCheckServlet;
+
+/**
+ * Use this class's registry to register health checks: Can be some tests which make sure Sentry service is healthy
+ */
+public class SentryHealthCheckServletContextListener extends HealthCheckServlet.ContextListener {
+
+ //This is just a place holder for health check registry, with out this AdminServlet throws out an error
+ public static final HealthCheckRegistry HEALTH_CHECK_REGISTRY = new HealthCheckRegistry();
+
+ @Override
+ protected HealthCheckRegistry getHealthCheckRegistry() {
+ return HEALTH_CHECK_REGISTRY;
+ }
+}
\ No newline at end of file
[51/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
SENTRY-2206: Refactor out sentry api from sentry-provider-db to own module (Steve Moist, reviewed by Sergio Pena)
Change-Id: I2057d7f6eeb1e04b7b45716997077c7c2032adde
Project: http://git-wip-us.apache.org/repos/asf/sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/af8ea0ac
Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/af8ea0ac
Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/af8ea0ac
Branch: refs/heads/master
Commit: af8ea0ac16852cd370efb5d76f881c81e327fa6c
Parents: b231468
Author: Sergio Pena <se...@cloudera.com>
Authored: Wed May 9 17:11:14 2018 -0700
Committer: Sergio Pena <se...@cloudera.com>
Committed: Wed May 9 17:11:14 2018 -0700
----------------------------------------------------------------------
pom.xml | 5 +-
.../authz/HBaseIndexerAuthzBinding.java | 4 +-
.../binding/hive/authz/HiveAuthzBinding.java | 2 +-
.../binding/hive/authz/SentryConfigTool.java | 2 +-
.../DefaultSentryAccessController.java | 6 +-
.../SentryMetastorePostEventListenerBaseV2.java | 2 +-
.../hive/v2/util/SentryAuthorizerUtil.java | 6 +-
.../hive/ql/exec/SentryGrantRevokeTask.java | 741 +
.../authz/DefaultSentryAccessController.java | 6 +-
.../binding/hive/authz/SentryConfigTool.java | 2 +-
...rySyncHMSNotificationsPostEventListener.java | 2 +-
.../binding/util/SentryAuthorizerUtil.java | 12 +-
...rySyncHMSNotificationsPostEventListener.java | 2 +-
.../sentry/kafka/binding/KafkaAuthBinding.java | 25 +-
.../binding/solr/authz/SolrAuthzBinding.java | 12 +-
.../sentry/sqoop/binding/SqoopAuthBinding.java | 20 +-
.../apache/sentry/api/common/ApiConstants.java | 90 +
.../sentry/service/common/ServiceConstants.java | 251 +
sentry-dist/src/license/THIRD-PARTY.properties | 3 +-
.../sentry/hdfs/SentryHdfsMetricsUtil.java | 2 +-
.../org/apache/sentry/hdfs/SentryPlugin.java | 22 +-
sentry-provider/sentry-provider-db/pom.xml | 100 +-
.../thrift/SentryGenericPolicyService.java | 10416 -----------
.../TAlterSentryRoleAddGroupsRequest.java | 842 -
.../TAlterSentryRoleAddGroupsResponse.java | 391 -
.../TAlterSentryRoleDeleteGroupsRequest.java | 842 -
.../TAlterSentryRoleDeleteGroupsResponse.java | 391 -
.../TAlterSentryRoleGrantPrivilegeRequest.java | 798 -
.../TAlterSentryRoleGrantPrivilegeResponse.java | 391 -
.../TAlterSentryRoleRevokePrivilegeRequest.java | 798 -
...TAlterSentryRoleRevokePrivilegeResponse.java | 391 -
.../generic/service/thrift/TAuthorizable.java | 490 -
.../thrift/TCreateSentryRoleRequest.java | 692 -
.../thrift/TCreateSentryRoleResponse.java | 391 -
.../service/thrift/TDropPrivilegesRequest.java | 697 -
.../service/thrift/TDropPrivilegesResponse.java | 391 -
.../service/thrift/TDropSentryRoleRequest.java | 692 -
.../service/thrift/TDropSentryRoleResponse.java | 391 -
.../TListSentryPrivilegesByAuthRequest.java | 1112 --
.../TListSentryPrivilegesByAuthResponse.java | 569 -
...TListSentryPrivilegesForProviderRequest.java | 1011 -
...ListSentryPrivilegesForProviderResponse.java | 541 -
.../thrift/TListSentryPrivilegesRequest.java | 957 -
.../thrift/TListSentryPrivilegesResponse.java | 555 -
.../service/thrift/TListSentryRolesRequest.java | 701 -
.../thrift/TListSentryRolesResponse.java | 555 -
.../thrift/TRenamePrivilegesRequest.java | 1002 -
.../thrift/TRenamePrivilegesResponse.java | 391 -
.../service/thrift/TSentryActiveRoleSet.java | 537 -
.../service/thrift/TSentryGrantOption.java | 48 -
.../service/thrift/TSentryPrivilege.java | 1080 --
.../service/thrift/TSentryPrivilegeMap.java | 490 -
.../db/generic/service/thrift/TSentryRole.java | 539 -
.../db/service/thrift/SentryPolicyService.java | 16422 -----------------
.../TAlterSentryRoleAddGroupsRequest.java | 746 -
.../TAlterSentryRoleAddGroupsResponse.java | 394 -
.../thrift/TAlterSentryRoleAddUsersRequest.java | 741 -
.../TAlterSentryRoleAddUsersResponse.java | 394 -
.../TAlterSentryRoleDeleteGroupsRequest.java | 746 -
.../TAlterSentryRoleDeleteGroupsResponse.java | 394 -
.../TAlterSentryRoleDeleteUsersRequest.java | 741 -
.../TAlterSentryRoleDeleteUsersResponse.java | 394 -
.../TAlterSentryRoleGrantPrivilegeRequest.java | 866 -
.../TAlterSentryRoleGrantPrivilegeResponse.java | 669 -
.../TAlterSentryRoleRevokePrivilegeRequest.java | 866 -
...TAlterSentryRoleRevokePrivilegeResponse.java | 394 -
.../thrift/TCreateSentryRoleRequest.java | 591 -
.../thrift/TCreateSentryRoleResponse.java | 394 -
.../service/thrift/TDropPrivilegesRequest.java | 596 -
.../service/thrift/TDropPrivilegesResponse.java | 394 -
.../service/thrift/TDropSentryRoleRequest.java | 591 -
.../service/thrift/TDropSentryRoleResponse.java | 394 -
.../TListSentryPrivilegesByAuthRequest.java | 915 -
.../TListSentryPrivilegesByAuthResponse.java | 571 -
...TListSentryPrivilegesForProviderRequest.java | 915 -
...ListSentryPrivilegesForProviderResponse.java | 544 -
.../thrift/TListSentryPrivilegesRequest.java | 706 -
.../thrift/TListSentryPrivilegesResponse.java | 558 -
.../thrift/TListSentryRolesForUserRequest.java | 591 -
.../service/thrift/TListSentryRolesRequest.java | 600 -
.../thrift/TListSentryRolesResponse.java | 558 -
.../thrift/TRenamePrivilegesRequest.java | 702 -
.../thrift/TRenamePrivilegesResponse.java | 394 -
.../db/service/thrift/TSentryActiveRoleSet.java | 537 -
.../db/service/thrift/TSentryAuthorizable.java | 817 -
.../thrift/TSentryConfigValueRequest.java | 600 -
.../thrift/TSentryConfigValueResponse.java | 504 -
.../thrift/TSentryExportMappingDataRequest.java | 600 -
.../TSentryExportMappingDataResponse.java | 500 -
.../db/service/thrift/TSentryGrantOption.java | 48 -
.../db/service/thrift/TSentryGroup.java | 389 -
.../thrift/TSentryImportMappingDataRequest.java | 693 -
.../TSentryImportMappingDataResponse.java | 394 -
.../db/service/thrift/TSentryMappingData.java | 898 -
.../db/service/thrift/TSentryPrivilege.java | 1258 --
.../db/service/thrift/TSentryPrivilegeMap.java | 490 -
.../provider/db/service/thrift/TSentryRole.java | 645 -
.../db/service/thrift/TSentrySyncIDRequest.java | 484 -
.../service/thrift/TSentrySyncIDResponse.java | 493 -
.../service/thrift/TSentryResponseStatus.java | 598 -
.../thrift/sentry_common_serviceConstants.java | 57 -
.../thrift/SentryGenericPolicyProcessor.java | 829 +
.../SentryGenericPolicyProcessorFactory.java | 44 +
.../sentry/api/service/thrift/ConfServlet.java | 71 +
.../api/service/thrift/LogLevelServlet.java | 122 +
.../api/service/thrift/PubSubServlet.java | 128 +
.../api/service/thrift/SentryAdminServlet.java | 132 +
.../api/service/thrift/SentryAuthFilter.java | 89 +
...SentryHealthCheckServletContextListener.java | 35 +
.../api/service/thrift/SentryMetrics.java | 413 +
.../SentryMetricsServletContextListener.java | 32 +
.../thrift/SentryPolicyStoreProcessor.java | 1236 ++
.../SentryPolicyStoreProcessorFactory.java | 43 +
.../api/service/thrift/SentryWebServer.java | 240 +
.../provider/db/SentryPolicyStorePlugin.java | 16 +-
.../provider/db/SimpleDBProviderBackend.java | 8 +-
.../generic/SentryGenericProviderBackend.java | 24 +-
.../provider/db/generic/UpdatableCache.java | 10 +-
.../service/persistent/DelegateSentryStore.java | 8 +-
.../persistent/PrivilegeOperatePersistence.java | 2 +-
.../service/thrift/NotificationHandler.java | 45 -
.../thrift/NotificationHandlerInvoker.java | 163 -
.../thrift/SentryGenericPolicyProcessor.java | 831 -
.../SentryGenericPolicyProcessorFactory.java | 43 -
.../SentryGenericPolicyProcessorWrapper.java | 39 -
.../thrift/SentryGenericServiceClient.java | 194 -
.../SentryGenericServiceClientDefaultImpl.java | 559 -
.../SentryGenericServiceClientFactory.java | 123 -
.../tools/GenericPrivilegeConverter.java | 6 +-
.../tools/TSentryPrivilegeConverter.java | 2 +-
.../db/log/entity/JsonLogEntityFactory.java | 66 +-
.../provider/db/log/util/CommandUtil.java | 20 +-
.../sentry/provider/db/log/util/Constants.java | 26 +-
.../db/service/persistent/HAContext.java | 2 +-
.../db/service/persistent/HMSFollower.java | 2 +-
.../service/persistent/LeaderStatusMonitor.java | 2 +-
.../persistent/NotificationProcessor.java | 6 +-
.../db/service/persistent/SentryStore.java | 22 +-
.../service/persistent/TransactionManager.java | 4 +-
.../provider/db/service/thrift/ConfServlet.java | 71 -
.../db/service/thrift/LogLevelServlet.java | 122 -
.../db/service/thrift/NotificationHandler.java | 73 -
.../thrift/NotificationHandlerInvoker.java | 164 -
.../db/service/thrift/PubSubServlet.java | 128 -
.../db/service/thrift/SentryAdminServlet.java | 132 -
.../db/service/thrift/SentryAuthFilter.java | 89 -
...SentryHealthCheckServletContextListener.java | 35 -
.../db/service/thrift/SentryMetrics.java | 413 -
.../SentryMetricsServletContextListener.java | 32 -
.../thrift/SentryPolicyServiceClient.java | 227 -
.../SentryPolicyServiceClientDefaultImpl.java | 1081 --
.../thrift/SentryPolicyStoreProcessor.java | 1238 --
.../SentryPolicyStoreProcessorFactory.java | 42 -
.../service/thrift/SentryProcessorWrapper.java | 38 -
.../db/service/thrift/SentryWebServer.java | 240 -
.../GrantPrivilegeRequestValidator.java | 91 -
.../RevokePrivilegeRequestValidator.java | 46 -
.../service/thrift/FullUpdateInitializer.java | 2 +-
.../sentry/service/thrift/GSSCallback.java | 2 +-
.../thrift/HiveSimpleConnectionFactory.java | 2 +-
.../sentry/service/thrift/SentryHMSClient.java | 2 +-
.../sentry/service/thrift/SentryService.java | 14 +-
.../thrift/SentryServiceClientFactory.java | 4 +-
.../service/thrift/SentryServiceUtil.java | 316 -
.../sentry/service/thrift/ServiceConstants.java | 316 -
.../apache/sentry/service/thrift/Status.java | 132 -
.../main/resources/sentry_common_service.thrift | 44 -
.../sentry_generic_policy_service.thrift | 278 -
.../main/resources/sentry_policy_service.thrift | 364 -
.../SentryGenericServiceIntegrationBase.java | 73 +
.../TestAuditLogForSentryGenericService.java | 296 +
.../TestSentryGenericPolicyProcessor.java | 364 +
.../thrift/TestSentryGenericServiceClient.java | 61 +
.../TestSentryGenericServiceIntegration.java | 503 +
.../service/thrift/SentryMiniKdcTestcase.java | 68 +
.../TestAuthorizingDDLAuditLogWithKerberos.java | 295 +
.../thrift/TestConnectionWithTicketTimeout.java | 57 +
.../thrift/TestNotificationHandlerInvoker.java | 102 +
.../thrift/TestSentryPolicyServiceClient.java | 64 +
.../thrift/TestSentryPolicyStoreProcessor.java | 81 +
.../TestSentryServerForPoolWithoutKerberos.java | 35 +
.../thrift/TestSentryServerLogLevel.java | 100 +
.../service/thrift/TestSentryServerPubSub.java | 181 +
.../thrift/TestSentryServerWithoutKerberos.java | 214 +
.../thrift/TestSentryServiceClientPool.java | 111 +
.../thrift/TestSentryServiceFailureCase.java | 75 +
.../TestSentryServiceForPoolWithKerberos.java | 35 +
.../thrift/TestSentryServiceImportExport.java | 751 +
.../thrift/TestSentryServiceIntegration.java | 1102 ++
.../thrift/TestSentryServiceMetrics.java | 86 +
.../TestSentryServiceWithInvalidMsgSize.java | 122 +
.../thrift/TestSentryServiceWithKerberos.java | 58 +
.../thrift/TestSentryWebServerWithKerberos.java | 175 +
.../thrift/TestSentryWebServerWithSSL.java | 64 +
.../TestSentryWebServerWithoutSecurity.java | 95 +
.../TestSentryGenericProviderBackend.java | 8 +-
.../persistent/SentryStoreIntegrationBase.java | 2 +-
.../TestPrivilegeOperatePersistence.java | 2 +-
.../service/persistent/TestSentryRole.java | 2 +-
.../SentryGenericServiceIntegrationBase.java | 73 -
.../TestAuditLogForSentryGenericService.java | 296 -
.../TestSentryGenericPolicyProcessor.java | 364 -
.../thrift/TestSentryGenericServiceClient.java | 61 -
.../TestSentryGenericServiceIntegration.java | 503 -
.../db/log/entity/TestJsonLogEntityFactory.java | 34 +-
.../log/entity/TestJsonLogEntityFactoryGM.java | 32 +-
.../provider/db/log/util/TestCommandUtil.java | 38 +-
.../db/service/persistent/TestHMSFollower.java | 4 +-
.../TestHMSFollowerSentryStoreIntegration.java | 4 +-
.../persistent/TestLeaderStatusMonitor.java | 2 +-
.../persistent/TestNotificationProcessor.java | 4 +-
.../db/service/persistent/TestSentryStore.java | 18 +-
.../persistent/TestSentryStoreImportExport.java | 12 +-
.../service/persistent/TestSentryVersion.java | 4 +-
.../service/thrift/SentryMiniKdcTestcase.java | 68 -
.../TestAuthorizingDDLAuditLogWithKerberos.java | 295 -
.../thrift/TestConnectionWithTicketTimeout.java | 57 -
.../thrift/TestNotificationHandlerInvoker.java | 102 -
.../thrift/TestSentryPolicyServiceClient.java | 64 -
.../thrift/TestSentryPolicyStoreProcessor.java | 81 -
.../TestSentryServerForPoolWithoutKerberos.java | 35 -
.../thrift/TestSentryServerLogLevel.java | 100 -
.../service/thrift/TestSentryServerPubSub.java | 181 -
.../thrift/TestSentryServerWithoutKerberos.java | 214 -
.../thrift/TestSentryServiceClientPool.java | 111 -
.../thrift/TestSentryServiceFailureCase.java | 75 -
.../TestSentryServiceForPoolWithKerberos.java | 35 -
.../thrift/TestSentryServiceImportExport.java | 751 -
.../thrift/TestSentryServiceIntegration.java | 1102 --
.../thrift/TestSentryServiceMetrics.java | 86 -
.../TestSentryServiceWithInvalidMsgSize.java | 121 -
.../thrift/TestSentryServiceWithKerberos.java | 58 -
.../thrift/TestSentryWebServerWithKerberos.java | 175 -
.../thrift/TestSentryWebServerWithSSL.java | 64 -
.../TestSentryWebServerWithoutSecurity.java | 95 -
.../thrift/SentryServiceIntegrationBase.java | 17 +-
sentry-service/pom.xml | 36 +
sentry-service/sentry-service-api/pom.xml | 200 +
.../thrift/SentryGenericPolicyService.java | 10416 +++++++++++
.../TAlterSentryRoleAddGroupsRequest.java | 842 +
.../TAlterSentryRoleAddGroupsResponse.java | 391 +
.../TAlterSentryRoleDeleteGroupsRequest.java | 842 +
.../TAlterSentryRoleDeleteGroupsResponse.java | 391 +
.../TAlterSentryRoleGrantPrivilegeRequest.java | 798 +
.../TAlterSentryRoleGrantPrivilegeResponse.java | 391 +
.../TAlterSentryRoleRevokePrivilegeRequest.java | 798 +
...TAlterSentryRoleRevokePrivilegeResponse.java | 391 +
.../api/generic/thrift/TAuthorizable.java | 490 +
.../thrift/TCreateSentryRoleRequest.java | 692 +
.../thrift/TCreateSentryRoleResponse.java | 391 +
.../generic/thrift/TDropPrivilegesRequest.java | 697 +
.../generic/thrift/TDropPrivilegesResponse.java | 391 +
.../generic/thrift/TDropSentryRoleRequest.java | 692 +
.../generic/thrift/TDropSentryRoleResponse.java | 391 +
.../TListSentryPrivilegesByAuthRequest.java | 1112 ++
.../TListSentryPrivilegesByAuthResponse.java | 569 +
...TListSentryPrivilegesForProviderRequest.java | 1011 +
...ListSentryPrivilegesForProviderResponse.java | 541 +
.../thrift/TListSentryPrivilegesRequest.java | 957 +
.../thrift/TListSentryPrivilegesResponse.java | 555 +
.../generic/thrift/TListSentryRolesRequest.java | 701 +
.../thrift/TListSentryRolesResponse.java | 555 +
.../thrift/TRenamePrivilegesRequest.java | 1002 +
.../thrift/TRenamePrivilegesResponse.java | 391 +
.../generic/thrift/TSentryActiveRoleSet.java | 537 +
.../api/generic/thrift/TSentryGrantOption.java | 48 +
.../api/generic/thrift/TSentryPrivilege.java | 1080 ++
.../api/generic/thrift/TSentryPrivilegeMap.java | 490 +
.../sentry/api/generic/thrift/TSentryRole.java | 539 +
.../api/service/thrift/SentryPolicyService.java | 16422 +++++++++++++++++
.../TAlterSentryRoleAddGroupsRequest.java | 746 +
.../TAlterSentryRoleAddGroupsResponse.java | 394 +
.../thrift/TAlterSentryRoleAddUsersRequest.java | 741 +
.../TAlterSentryRoleAddUsersResponse.java | 394 +
.../TAlterSentryRoleDeleteGroupsRequest.java | 746 +
.../TAlterSentryRoleDeleteGroupsResponse.java | 394 +
.../TAlterSentryRoleDeleteUsersRequest.java | 741 +
.../TAlterSentryRoleDeleteUsersResponse.java | 394 +
.../TAlterSentryRoleGrantPrivilegeRequest.java | 866 +
.../TAlterSentryRoleGrantPrivilegeResponse.java | 669 +
.../TAlterSentryRoleRevokePrivilegeRequest.java | 866 +
...TAlterSentryRoleRevokePrivilegeResponse.java | 394 +
.../thrift/TCreateSentryRoleRequest.java | 591 +
.../thrift/TCreateSentryRoleResponse.java | 394 +
.../service/thrift/TDropPrivilegesRequest.java | 596 +
.../service/thrift/TDropPrivilegesResponse.java | 394 +
.../service/thrift/TDropSentryRoleRequest.java | 591 +
.../service/thrift/TDropSentryRoleResponse.java | 394 +
.../TListSentryPrivilegesByAuthRequest.java | 915 +
.../TListSentryPrivilegesByAuthResponse.java | 571 +
...TListSentryPrivilegesForProviderRequest.java | 915 +
...ListSentryPrivilegesForProviderResponse.java | 544 +
.../thrift/TListSentryPrivilegesRequest.java | 706 +
.../thrift/TListSentryPrivilegesResponse.java | 558 +
.../thrift/TListSentryRolesForUserRequest.java | 591 +
.../service/thrift/TListSentryRolesRequest.java | 600 +
.../thrift/TListSentryRolesResponse.java | 558 +
.../thrift/TRenamePrivilegesRequest.java | 702 +
.../thrift/TRenamePrivilegesResponse.java | 394 +
.../service/thrift/TSentryActiveRoleSet.java | 537 +
.../api/service/thrift/TSentryAuthorizable.java | 817 +
.../thrift/TSentryConfigValueRequest.java | 600 +
.../thrift/TSentryConfigValueResponse.java | 504 +
.../thrift/TSentryExportMappingDataRequest.java | 600 +
.../TSentryExportMappingDataResponse.java | 500 +
.../api/service/thrift/TSentryGrantOption.java | 48 +
.../sentry/api/service/thrift/TSentryGroup.java | 389 +
.../thrift/TSentryImportMappingDataRequest.java | 693 +
.../TSentryImportMappingDataResponse.java | 394 +
.../api/service/thrift/TSentryMappingData.java | 898 +
.../api/service/thrift/TSentryPrivilege.java | 1258 ++
.../api/service/thrift/TSentryPrivilegeMap.java | 490 +
.../sentry/api/service/thrift/TSentryRole.java | 645 +
.../service/thrift/TSentrySyncIDRequest.java | 484 +
.../service/thrift/TSentrySyncIDResponse.java | 493 +
.../service/thrift/TSentryResponseStatus.java | 598 +
.../thrift/sentry_common_serviceConstants.java | 57 +
.../sentry/api/common/SentryServiceUtil.java | 322 +
.../org/apache/sentry/api/common/Status.java | 133 +
.../sentry/api/common/ThriftConstants.java | 30 +
.../api/generic/thrift/NotificationHandler.java | 45 +
.../thrift/NotificationHandlerInvoker.java | 163 +
.../SentryGenericPolicyProcessorWrapper.java | 39 +
.../thrift/SentryGenericServiceClient.java | 194 +
.../SentryGenericServiceClientDefaultImpl.java | 560 +
.../SentryGenericServiceClientFactory.java | 123 +
.../api/service/thrift/NotificationHandler.java | 73 +
.../thrift/NotificationHandlerInvoker.java | 164 +
.../thrift/SentryPolicyServiceClient.java | 227 +
.../SentryPolicyServiceClientDefaultImpl.java | 1082 ++
.../service/thrift/SentryProcessorWrapper.java | 38 +
.../GrantPrivilegeRequestValidator.java | 91 +
.../RevokePrivilegeRequestValidator.java | 46 +
.../api/tools/GenericPrivilegeConverter.java | 190 +
.../api/tools/TSentryPrivilegeConverter.java | 34 +
.../main/resources/sentry_common_service.thrift | 44 +
.../sentry_generic_policy_service.thrift | 278 +
.../main/resources/sentry_policy_service.thrift | 364 +
.../TestSentryWebServiceForAuthTypeNone.java | 2 +-
.../e2e/dbprovider/TestConcurrentClients.java | 2 +-
.../tests/e2e/hdfs/TestHDFSIntegration.java | 2 +-
.../AbstractTestWithStaticConfiguration.java | 2 +-
.../metastore/SentryPolicyProviderForDb.java | 4 +-
.../dbprovider/AbstractTestWithDbProvider.java | 4 +-
.../e2e/dbprovider/TestConcurrentClients.java | 6 +-
.../tests/e2e/hdfs/TestHDFSIntegrationBase.java | 4 +-
.../hdfs/TestHDFSIntegrationTogglingConf.java | 2 +-
.../AbstractTestWithStaticConfiguration.java | 6 +-
.../metastore/SentryPolicyProviderForDb.java | 4 +-
.../tests/e2e/minisentry/InternalSentrySrv.java | 2 +-
.../e2e/kafka/AbstractKafkaSentryTestBase.java | 12 +-
.../sentry/tests/e2e/kafka/TestAuthorize.java | 8 +-
.../e2e/solr/SolrSentryServiceTestBase.java | 8 +-
.../sentry/tests/e2e/solr/TestSentryServer.java | 12 +-
.../e2e/sqoop/AbstractSqoopSentryTestBase.java | 16 +-
.../tools/PermissionsMigrationToolCommon.java | 10 +-
.../cli/tools/SentryConfigToolIndexer.java | 10 +-
.../sentry/cli/tools/SentryConfigToolSolr.java | 6 +-
.../sentry/cli/tools/SentrySchemaTool.java | 2 +-
.../sentry/cli/tools/SentryShellGeneric.java | 8 +-
.../sentry/cli/tools/SentryShellHive.java | 2 +-
.../sentry/cli/tools/SentryShellIndexer.java | 4 +-
.../cli/tools/command/GenericShellCommand.java | 8 +-
.../cli/tools/command/hive/CommandUtil.java | 14 +-
.../tools/command/hive/HiveShellCommand.java | 10 +-
.../java/org/apache/sentry/shell/SentryCli.java | 14 +-
.../org/apache/sentry/shell/TopLevelShell.java | 8 +-
.../tools/TestPermissionsMigrationToolSolr.java | 11 +-
.../cli/tools/TestSentryConfigToolIndexer.java | 12 +-
.../cli/tools/TestSentryConfigToolSolr.java | 9 +-
.../sentry/cli/tools/TestSentrySchemaTool.java | 2 +-
.../sentry/cli/tools/TestSentryShellHive.java | 4 +-
.../cli/tools/TestSentryShellIndexer.java | 10 +-
.../sentry/cli/tools/TestSentryShellKafka.java | 6 +-
.../sentry/cli/tools/TestSentryShellSolr.java | 6 +-
.../sentry/cli/tools/TestSentryShellSqoop.java | 6 +-
376 files changed, 87440 insertions(+), 86260 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 262a9d8..3b80e03 100644
--- a/pom.xml
+++ b/pom.xml
@@ -756,6 +756,7 @@ limitations under the License.
<module>sentry-tests</module>
<module>sentry-hdfs</module>
<module>sentry-tools</module>
+ <module>sentry-service</module>
<module>sentry-dist</module>
</modules>
@@ -1045,9 +1046,9 @@ limitations under the License.
<excludes combine.children="append">
<exclude>%regex[org.apache.sentry.tests.e2e.*.class]</exclude>
<exclude>%regex[org.apache.sentry.binding.hive.TestURI.class]</exclude>
- <exclude>%regex[org.apache.sentry.provider.db.service.thrift.*.class]</exclude>
+ <exclude>%regex[org.apache.sentry.api.service.thrift.*.class]</exclude>
<exclude>%regex[org.apache.solr.handler.admin.*.class]</exclude>
- <exclude>%regex[org.apache.sentry.provider.db.generic.service.thrift.*.class]</exclude>
+ <exclude>%regex[org.apache.sentry.api.generic.thrift.*.class]</exclude>
<exclude>%regex[org.apache.sentry.cli.tools.*.class]</exclude>
</excludes>
</configuration>
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-binding/sentry-binding-hbase-indexer/src/main/java/org/apache/sentry/binding/hbaseindexer/authz/HBaseIndexerAuthzBinding.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hbase-indexer/src/main/java/org/apache/sentry/binding/hbaseindexer/authz/HBaseIndexerAuthzBinding.java b/sentry-binding/sentry-binding-hbase-indexer/src/main/java/org/apache/sentry/binding/hbaseindexer/authz/HBaseIndexerAuthzBinding.java
index 71d1225..3e57cd4 100644
--- a/sentry-binding/sentry-binding-hbase-indexer/src/main/java/org/apache/sentry/binding/hbaseindexer/authz/HBaseIndexerAuthzBinding.java
+++ b/sentry-binding/sentry-binding-hbase-indexer/src/main/java/org/apache/sentry/binding/hbaseindexer/authz/HBaseIndexerAuthzBinding.java
@@ -33,7 +33,7 @@ import org.apache.sentry.policy.common.PolicyEngine;
import org.apache.sentry.provider.common.AuthorizationProvider;
import org.apache.sentry.provider.common.ProviderBackend;
import org.apache.sentry.provider.common.ProviderBackendContext;
-import org.apache.sentry.service.thrift.ServiceConstants;
+import org.apache.sentry.api.common.ApiConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -107,7 +107,7 @@ public class HBaseIndexerAuthzBinding {
}
// For SentryGenericProviderBackend
- authzConf.set(ServiceConstants.ClientConfig.COMPONENT_TYPE, HBASE_INDEXER);
+ authzConf.set(ApiConstants.ClientConfig.COMPONENT_TYPE, HBASE_INDEXER);
providerBackend =
(ProviderBackend) providerBackendConstructor.newInstance(new Object[] {authzConf, resourceName});
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-binding/sentry-binding-hive-common/src/main/java/org/apache/sentry/binding/hive/authz/HiveAuthzBinding.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive-common/src/main/java/org/apache/sentry/binding/hive/authz/HiveAuthzBinding.java b/sentry-binding/sentry-binding-hive-common/src/main/java/org/apache/sentry/binding/hive/authz/HiveAuthzBinding.java
index 7565a34..f1cbbb6 100644
--- a/sentry-binding/sentry-binding-hive-common/src/main/java/org/apache/sentry/binding/hive/authz/HiveAuthzBinding.java
+++ b/sentry-binding/sentry-binding-hive-common/src/main/java/org/apache/sentry/binding/hive/authz/HiveAuthzBinding.java
@@ -48,7 +48,7 @@ import org.apache.sentry.provider.cache.SimpleCacheProviderBackend;
import org.apache.sentry.provider.common.AuthorizationProvider;
import org.apache.sentry.provider.common.ProviderBackend;
import org.apache.sentry.provider.common.ProviderBackendContext;
-import org.apache.sentry.provider.db.service.thrift.TSentryRole;
+import org.apache.sentry.api.service.thrift.TSentryRole;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/authz/SentryConfigTool.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/authz/SentryConfigTool.java b/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/authz/SentryConfigTool.java
index 1dc8f01..f6b4518 100644
--- a/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/authz/SentryConfigTool.java
+++ b/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/authz/SentryConfigTool.java
@@ -53,7 +53,7 @@ import org.apache.sentry.core.common.exception.SentryConfigurationException;
import org.apache.sentry.core.common.Subject;
import org.apache.sentry.core.model.db.Server;
import org.apache.sentry.provider.common.AuthorizationProvider;
-import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient;
+import org.apache.sentry.api.service.thrift.SentryPolicyServiceClient;
import org.apache.sentry.service.thrift.SentryServiceClientFactory;
/**
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/v2/authorizer/DefaultSentryAccessController.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/v2/authorizer/DefaultSentryAccessController.java b/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/v2/authorizer/DefaultSentryAccessController.java
index 13ee2cf..f21f920 100644
--- a/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/v2/authorizer/DefaultSentryAccessController.java
+++ b/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/v2/authorizer/DefaultSentryAccessController.java
@@ -49,9 +49,9 @@ import org.apache.sentry.core.common.exception.SentryUserException;
import org.apache.sentry.core.model.db.AccessConstants;
import org.apache.sentry.core.model.db.DBModelAuthorizable;
import org.apache.sentry.core.model.db.Server;
-import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient;
-import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege;
-import org.apache.sentry.provider.db.service.thrift.TSentryRole;
+import org.apache.sentry.api.service.thrift.SentryPolicyServiceClient;
+import org.apache.sentry.api.service.thrift.TSentryPrivilege;
+import org.apache.sentry.api.service.thrift.TSentryRole;
import org.apache.sentry.service.thrift.SentryServiceClientFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/v2/metastore/SentryMetastorePostEventListenerBaseV2.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/v2/metastore/SentryMetastorePostEventListenerBaseV2.java b/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/v2/metastore/SentryMetastorePostEventListenerBaseV2.java
index 567e9fa..642e873 100644
--- a/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/v2/metastore/SentryMetastorePostEventListenerBaseV2.java
+++ b/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/v2/metastore/SentryMetastorePostEventListenerBaseV2.java
@@ -44,7 +44,7 @@ import org.apache.sentry.core.model.db.Database;
import org.apache.sentry.core.model.db.Server;
import org.apache.sentry.core.model.db.Table;
import org.apache.sentry.provider.db.SentryMetastoreListenerPlugin;
-import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient;
+import org.apache.sentry.api.service.thrift.SentryPolicyServiceClient;
import org.apache.sentry.service.thrift.SentryServiceClientFactory;
import org.apache.sentry.service.thrift.ServiceConstants.ConfUtilties;
import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/v2/util/SentryAuthorizerUtil.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/v2/util/SentryAuthorizerUtil.java b/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/v2/util/SentryAuthorizerUtil.java
index 35bd68c..32479d8 100644
--- a/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/v2/util/SentryAuthorizerUtil.java
+++ b/sentry-binding/sentry-binding-hive-v2/src/main/java/org/apache/sentry/binding/hive/v2/util/SentryAuthorizerUtil.java
@@ -49,9 +49,9 @@ import org.apache.sentry.core.model.db.DBModelAuthorizable;
import org.apache.sentry.core.model.db.Database;
import org.apache.sentry.core.model.db.Server;
import org.apache.sentry.core.model.db.Table;
-import org.apache.sentry.provider.db.service.thrift.TSentryGrantOption;
-import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege;
-import org.apache.sentry.provider.db.service.thrift.TSentryRole;
+import org.apache.sentry.api.service.thrift.TSentryGrantOption;
+import org.apache.sentry.api.service.thrift.TSentryPrivilege;
+import org.apache.sentry.api.service.thrift.TSentryRole;
import org.apache.sentry.service.thrift.ServiceConstants.PrivilegeScope;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-binding/sentry-binding-hive/src/main/java/org/apache/hadoop/hive/ql/exec/SentryGrantRevokeTask.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/hadoop/hive/ql/exec/SentryGrantRevokeTask.java b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/hadoop/hive/ql/exec/SentryGrantRevokeTask.java
new file mode 100644
index 0000000..203632d
--- /dev/null
+++ b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/hadoop/hive/ql/exec/SentryGrantRevokeTask.java
@@ -0,0 +1,741 @@
+package org.apache.hadoop.hive.ql.exec;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Serializable;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.SentryHiveConstants;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.api.PrincipalType;
+import org.apache.hadoop.hive.ql.CompilationOpContext;
+import org.apache.hadoop.hive.ql.DriverContext;
+import org.apache.hadoop.hive.ql.QueryPlan;
+import org.apache.hadoop.hive.ql.QueryState;
+import org.apache.hadoop.hive.ql.hooks.ReadEntity;
+import org.apache.hadoop.hive.ql.hooks.WriteEntity;
+import org.apache.hadoop.hive.ql.metadata.AuthorizationException;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.ql.parse.SemanticException;
+import org.apache.hadoop.hive.ql.plan.DDLWork;
+import org.apache.hadoop.hive.ql.plan.GrantDesc;
+import org.apache.hadoop.hive.ql.plan.GrantRevokeRoleDDL;
+import org.apache.hadoop.hive.ql.plan.HiveOperation;
+import org.apache.hadoop.hive.ql.plan.PrincipalDesc;
+import org.apache.hadoop.hive.ql.plan.PrivilegeDesc;
+import org.apache.hadoop.hive.ql.plan.PrivilegeObjectDesc;
+import org.apache.hadoop.hive.ql.plan.RevokeDesc;
+import org.apache.hadoop.hive.ql.plan.RoleDDLDesc;
+import org.apache.hadoop.hive.ql.plan.ShowGrantDesc;
+import org.apache.hadoop.hive.ql.plan.api.StageType;
+import org.apache.hadoop.hive.ql.security.authorization.PrivilegeType;
+import org.apache.hadoop.hive.ql.session.SessionState;
+import org.apache.hadoop.hive.ql.session.SessionState.LogHelper;
+import org.apache.sentry.core.common.exception.SentryUserException;
+import org.apache.sentry.binding.hive.authz.HiveAuthzBindingHookBase;
+import org.apache.sentry.binding.hive.SentryOnFailureHookContext;
+import org.apache.sentry.binding.hive.SentryOnFailureHookContextImpl;
+import org.apache.sentry.binding.hive.authz.HiveAuthzBinding;
+import org.apache.sentry.binding.hive.conf.HiveAuthzConf;
+import org.apache.sentry.binding.hive.conf.HiveAuthzConf.AuthzConfVars;
+import org.apache.sentry.core.common.ActiveRoleSet;
+import org.apache.sentry.core.common.Authorizable;
+import org.apache.sentry.core.common.Subject;
+import org.apache.sentry.core.common.utils.PathUtils;
+import org.apache.sentry.core.model.db.AccessConstants;
+import org.apache.sentry.core.model.db.AccessURI;
+import org.apache.sentry.core.model.db.Column;
+import org.apache.sentry.core.model.db.Database;
+import org.apache.sentry.core.model.db.Server;
+import org.apache.sentry.core.model.db.Table;
+import org.apache.sentry.core.common.exception.SentryAccessDeniedException;
+import org.apache.sentry.api.common.ApiConstants;
+import org.apache.sentry.api.service.thrift.SentryPolicyServiceClient;
+import org.apache.sentry.api.service.thrift.TSentryGrantOption;
+import org.apache.sentry.api.service.thrift.TSentryPrivilege;
+import org.apache.sentry.api.service.thrift.TSentryRole;
+import org.apache.sentry.service.thrift.SentryServiceClientFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Sets;
+
+public class SentryGrantRevokeTask extends Task<DDLWork> implements Serializable {
+ private static final Logger LOG = LoggerFactory
+ .getLogger(SentryGrantRevokeTask.class);
+ private static final int RETURN_CODE_SUCCESS = 0;
+ private static final int RETURN_CODE_FAILURE = 1;
+ private static final Splitter DB_TBL_SPLITTER = Splitter.on(".").omitEmptyStrings().trimResults();
+ private static final int separator = Utilities.tabCode;
+ private static final int terminator = Utilities.newLineCode;
+ private static final long serialVersionUID = -7625118066790571999L;
+
+ private HiveConf conf;
+ private HiveAuthzBinding hiveAuthzBinding;
+ private HiveAuthzConf authzConf;
+ private String server;
+ private Subject subject;
+ private Set<String> subjectGroups;
+ private String ipAddress;
+ private HiveOperation stmtOperation;
+
+ @Override
+ public void initialize(QueryState queryState, QueryPlan queryPlan, DriverContext ctx,
+ CompilationOpContext opContext) {
+ // CompilationOpContext is an unused parameter on the initialize() method.
+ super.initialize(queryState, queryPlan, driverContext, null);
+ this.conf = queryState.getConf();
+ }
+
+ @Override
+ public int execute(DriverContext driverContext) {
+ try (SentryPolicyServiceClient sentryClient =
+ SentryServiceClientFactory.create(authzConf)) {
+ Preconditions.checkNotNull(hiveAuthzBinding, "HiveAuthzBinding cannot be null");
+ Preconditions.checkNotNull(authzConf, "HiveAuthConf cannot be null");
+ Preconditions.checkNotNull(subject, "Subject cannot be null");
+ server = Preconditions.checkNotNull(authzConf.get(AuthzConfVars.AUTHZ_SERVER_NAME.getVar()),
+ "Config " + AuthzConfVars.AUTHZ_SERVER_NAME.getVar() + " is required");
+ try {
+ if (work.getRoleDDLDesc() != null) {
+ return processRoleDDL(console, sentryClient, subject.getName(),
+ hiveAuthzBinding, work.getRoleDDLDesc());
+ }
+ if (work.getGrantDesc() != null) {
+ return processGrantDDL(console, sentryClient,
+ subject.getName(), server, work.getGrantDesc());
+ }
+ if (work.getRevokeDesc() != null) {
+ return processRevokeDDL(console, sentryClient,
+ subject.getName(), server, work.getRevokeDesc());
+ }
+ if (work.getShowGrantDesc() != null) {
+ return processShowGrantDDL(console, sentryClient, subject.getName(),
+ work.getShowGrantDesc());
+ }
+ if (work.getGrantRevokeRoleDDL() != null) {
+ return processGrantRevokeRoleDDL(console, sentryClient,
+ subject.getName(), work.getGrantRevokeRoleDDL());
+ }
+ throw new AssertionError(
+ "Unknown command passed to Sentry Grant/Revoke Task");
+ } catch (SentryAccessDeniedException e) {
+ String csHooks = authzConf.get(
+ HiveAuthzConf.AuthzConfVars.AUTHZ_ONFAILURE_HOOKS.getVar(), "")
+ .trim();
+ SentryOnFailureHookContext hookContext = new SentryOnFailureHookContextImpl(
+ queryPlan.getQueryString(), new HashSet<ReadEntity>(),
+ new HashSet<WriteEntity>(), stmtOperation,
+ null, null, null, null, subject.getName(), ipAddress,
+ new AuthorizationException(e), conf);
+ HiveAuthzBindingHookBase.runFailureHook(hookContext, csHooks);
+ throw e; // rethrow the exception for logging
+ }
+ } catch(SentryUserException e) {
+ setException(new Exception(e.getClass().getSimpleName() + ": " + e.getReason(), e));
+ String msg = "Error processing Sentry command: " + e.getReason() + ".";
+ if (e instanceof SentryAccessDeniedException) {
+ msg += "Please grant admin privilege to " + subject.getName() + ".";
+ }
+ LOG.error(msg, e);
+ console.printError(msg);
+ return RETURN_CODE_FAILURE;
+ } catch(Throwable e) {
+ setException(e);
+ String msg = "Error processing Sentry command: " + e.getMessage();
+ LOG.error(msg, e);
+ console.printError(msg);
+ return RETURN_CODE_FAILURE;
+ } finally {
+ if (hiveAuthzBinding != null) {
+ hiveAuthzBinding.close();
+ }
+ }
+ }
+
+ public void setAuthzConf(HiveAuthzConf authzConf) {
+ Preconditions.checkState(this.authzConf == null,
+ "setAuthzConf should only be called once: " + this.authzConf);
+ this.authzConf = authzConf;
+ }
+ public void setHiveAuthzBinding(HiveAuthzBinding hiveAuthzBinding) {
+ Preconditions.checkState(this.hiveAuthzBinding == null,
+ "setHiveAuthzBinding should only be called once: " + this.hiveAuthzBinding);
+ this.hiveAuthzBinding = hiveAuthzBinding;
+ }
+ public void setSubject(Subject subject) {
+ Preconditions.checkState(this.subject == null,
+ "setSubject should only be called once: " + this.subject);
+ this.subject = subject;
+ }
+ public void setSubjectGroups(Set<String> subjectGroups) {
+ Preconditions.checkState(this.subjectGroups == null,
+ "setSubjectGroups should only be called once: " + this.subjectGroups);
+ this.subjectGroups = subjectGroups;
+ }
+
+ public void setIpAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ }
+
+ public void setOperation(HiveOperation stmtOperation) {
+ this.stmtOperation = stmtOperation;
+ }
+
+ private int processRoleDDL(LogHelper console,
+ SentryPolicyServiceClient sentryClient, String subject,
+ HiveAuthzBinding hiveAuthzBinding, RoleDDLDesc desc)
+ throws SentryUserException {
+ RoleDDLDesc.RoleOperation operation = desc.getOperation();
+ DataOutputStream outStream = null;
+ String name = desc.getName();
+ try {
+ if (operation.equals(RoleDDLDesc.RoleOperation.SET_ROLE)) {
+ hiveAuthzBinding.setActiveRoleSet(name, sentryClient.listUserRoles(subject));
+ return RETURN_CODE_SUCCESS;
+ } else if (operation.equals(RoleDDLDesc.RoleOperation.CREATE_ROLE)) {
+ sentryClient.createRole(subject, name);
+ return RETURN_CODE_SUCCESS;
+ } else if (operation.equals(RoleDDLDesc.RoleOperation.DROP_ROLE)) {
+ sentryClient.dropRole(subject, name);
+ return RETURN_CODE_SUCCESS;
+ } else if (operation.equals(RoleDDLDesc.RoleOperation.SHOW_ROLE_GRANT)) {
+ Set<TSentryRole> roles;
+ PrincipalType principalType = desc.getPrincipalType();
+ if (principalType == PrincipalType.GROUP) {
+ roles = sentryClient.listRolesByGroupName(subject, name);
+ } else if (principalType == PrincipalType.USER) {
+ roles = sentryClient.listRolesByUserName(subject, name);
+ } else {
+ String msg = SentryHiveConstants.GRANT_REVOKE_NOT_SUPPORTED_FOR_PRINCIPAL + principalType;
+ throw new HiveException(msg);
+ }
+ writeToFile(writeRoleGrantsInfo(roles), desc.getResFile());
+ return RETURN_CODE_SUCCESS;
+ } else if(operation.equals(RoleDDLDesc.RoleOperation.SHOW_ROLES)) {
+ Set<TSentryRole> roles = sentryClient.listAllRoles(subject);
+ writeToFile(writeRolesInfo(roles), desc.getResFile());
+ return RETURN_CODE_SUCCESS;
+ } else if(operation.equals(RoleDDLDesc.RoleOperation.SHOW_CURRENT_ROLE)) {
+ ActiveRoleSet roleSet = hiveAuthzBinding.getActiveRoleSet();
+ if( roleSet.isAll()) {
+ Set<TSentryRole> roles = sentryClient.listUserRoles(subject);
+ writeToFile(writeRolesInfo(roles), desc.getResFile());
+ return RETURN_CODE_SUCCESS;
+ } else {
+ Set<String> roles = roleSet.getRoles();
+ writeToFile(writeActiveRolesInfo(roles), desc.getResFile());
+ return RETURN_CODE_SUCCESS;
+ }
+ } else {
+ throw new HiveException("Unknown role operation "
+ + operation.getOperationName());
+ }
+ } catch (HiveException e) {
+ String msg = "Error in role operation "
+ + operation.getOperationName() + " on role name "
+ + name + ", error message " + e.getMessage();
+ LOG.warn(msg, e);
+ console.printError(msg);
+ return RETURN_CODE_FAILURE;
+ } catch (IOException e) {
+ String msg = "IO Error in role operation " + e.getMessage();
+ LOG.info(msg, e);
+ console.printError(msg);
+ return RETURN_CODE_FAILURE;
+ } finally {
+ closeQuiet(outStream);
+ }
+ }
+
+ private int processGrantDDL(LogHelper console,
+ SentryPolicyServiceClient sentryClient, String subject,
+ String server, GrantDesc desc) throws SentryUserException {
+ return processGrantRevokeDDL(console, sentryClient, subject,
+ server, true, desc.getPrincipals(), desc.getPrivileges(),
+ desc.getPrivilegeSubjectDesc(), desc.isGrantOption());
+ }
+
+ // For grant option, we use null to stand for revoke the privilege ignore the grant option
+ private int processRevokeDDL(LogHelper console,
+ SentryPolicyServiceClient sentryClient, String subject,
+ String server, RevokeDesc desc) throws SentryUserException {
+ return processGrantRevokeDDL(console, sentryClient, subject,
+ server, false, desc.getPrincipals(), desc.getPrivileges(),
+ desc.getPrivilegeSubjectDesc(), null);
+ }
+
+ private int processShowGrantDDL(LogHelper console, SentryPolicyServiceClient sentryClient,
+ String subject, ShowGrantDesc desc) throws SentryUserException{
+ PrincipalDesc principalDesc = desc.getPrincipalDesc();
+ PrivilegeObjectDesc hiveObjectDesc = desc.getHiveObj();
+ String principalName = principalDesc.getName();
+ Set<TSentryPrivilege> privileges;
+
+ try {
+ if (principalDesc.getType() != PrincipalType.ROLE) {
+ String msg = SentryHiveConstants.GRANT_REVOKE_NOT_SUPPORTED_FOR_PRINCIPAL + principalDesc.getType();
+ throw new HiveException(msg);
+ }
+
+ if (hiveObjectDesc == null) {
+ privileges = sentryClient.listPrivilegesByRoleName(subject, principalName, null);
+ } else {
+ SentryHivePrivilegeObjectDesc privSubjectDesc = toSentryHivePrivilegeObjectDesc(hiveObjectDesc);
+ List<Authorizable> authorizableHeirarchy = toAuthorizable(privSubjectDesc);
+ if (privSubjectDesc.getColumns() != null && !privSubjectDesc.getColumns().isEmpty()) {
+ List<List<Authorizable>> ps = parseColumnToAuthorizable(authorizableHeirarchy, privSubjectDesc);
+ ImmutableSet.Builder<TSentryPrivilege> pbuilder = new ImmutableSet.Builder<TSentryPrivilege>();
+ for (List<Authorizable> p : ps) {
+ pbuilder.addAll(sentryClient.listPrivilegesByRoleName(subject, principalName, p));
+ }
+ privileges = pbuilder.build();
+ } else {
+ privileges = sentryClient.listPrivilegesByRoleName(subject, principalName, authorizableHeirarchy);
+ }
+ }
+ writeToFile(writeGrantInfo(privileges, principalName), desc.getResFile());
+ return RETURN_CODE_SUCCESS;
+ } catch (IOException e) {
+ String msg = "IO Error in show grant " + e.getMessage();
+ LOG.info(msg, e);
+ console.printError(msg);
+ return RETURN_CODE_FAILURE;
+ } catch (HiveException e) {
+ String msg = "Error in show grant operation, error message " + e.getMessage();
+ LOG.warn(msg, e);
+ console.printError(msg);
+ return RETURN_CODE_FAILURE;
+ }
+ }
+
+ private List<Authorizable> toAuthorizable(SentryHivePrivilegeObjectDesc privSubjectDesc) throws HiveException{
+ List<Authorizable> authorizableHeirarchy = new ArrayList<Authorizable>();
+ authorizableHeirarchy.add(new Server(server));
+ String dbName = null;
+ if (privSubjectDesc.getTable()) {
+ DatabaseTable dbTable = parseDBTable(privSubjectDesc.getObject());
+ dbName = dbTable.getDatabase();
+ String tableName = dbTable.getTable();
+ authorizableHeirarchy.add(new Table(tableName));
+ authorizableHeirarchy.add(new Database(dbName));
+ } else if (privSubjectDesc.getUri()) {
+ String uriPath = privSubjectDesc.getObject();
+ String warehouseDir = conf.getVar(HiveConf.ConfVars.METASTOREWAREHOUSE);
+ try {
+ authorizableHeirarchy.add(new AccessURI(PathUtils.parseDFSURI(warehouseDir, uriPath)));
+ } catch(URISyntaxException e) {
+ throw new HiveException(e.getMessage(), e);
+ }
+ } else {
+ dbName = privSubjectDesc.getObject();
+ authorizableHeirarchy.add(new Database(dbName));
+ }
+ return authorizableHeirarchy;
+ }
+
+ private List<List<Authorizable>> parseColumnToAuthorizable(List<Authorizable> authorizableHeirarchy,
+ SentryHivePrivilegeObjectDesc privSubjectDesc) {
+ ImmutableList.Builder<List<Authorizable>> listsBuilder = ImmutableList.builder();
+ List<String> cols = privSubjectDesc.getColumns();
+ if ( cols != null && !cols.isEmpty() ) {
+ for ( String col : cols ) {
+ ImmutableList.Builder<Authorizable> listBuilder = ImmutableList.builder();
+ listBuilder.addAll(authorizableHeirarchy);
+ listBuilder.add(new Column(col));
+ listsBuilder.add(listBuilder.build());
+ }
+ }
+ return listsBuilder.build();
+ }
+
+ private void writeToFile(String data, String file) throws IOException {
+ Path resFile = new Path(file);
+ FileSystem fs = resFile.getFileSystem(conf);
+ FSDataOutputStream out = fs.create(resFile);
+ try {
+ if (data != null && !data.isEmpty()) {
+ try (OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8")) {
+ writer.write(data);
+ writer.write((char) terminator);
+ writer.flush();
+ }
+ }
+ } finally {
+ closeQuiet(out);
+ }
+ }
+
+ private int processGrantRevokeRoleDDL(LogHelper console,
+ SentryPolicyServiceClient sentryClient, String subject,
+ GrantRevokeRoleDDL desc) throws SentryUserException {
+ try {
+ boolean grantRole = desc.getGrant();
+ List<PrincipalDesc> principals = desc.getPrincipalDesc();
+ List<String> roles = desc.getRoles();
+ // get principals
+ Set<String> groups = Sets.newHashSet();
+ Set<String> users = Sets.newHashSet();
+ for (PrincipalDesc principal : principals) {
+ if (principal.getType() == PrincipalType.GROUP) {
+ groups.add(principal.getName());
+ } else if (principal.getType() == PrincipalType.USER) {
+ users.add(principal.getName());
+ } else {
+ String msg = SentryHiveConstants.GRANT_REVOKE_NOT_SUPPORTED_FOR_PRINCIPAL +
+ principal.getType();
+ throw new HiveException(msg);
+ }
+ }
+
+ // grant/revoke role to/from principals
+ for (String roleName : roles) {
+ if (grantRole) {
+ if (groups.size() > 0) {
+ sentryClient.grantRoleToGroups(subject, roleName, groups);
+ }
+ if (users.size() > 0) {
+ sentryClient.grantRoleToUsers(subject, roleName, users);
+ }
+ } else {
+ if (groups.size() > 0) {
+ sentryClient.revokeRoleFromGroups(subject, roleName, groups);
+ }
+ if (users.size() > 0) {
+ sentryClient.revokeRoleFromUsers(subject, roleName, users);
+ }
+ }
+ }
+
+ } catch (HiveException e) {
+ String msg = "Error in grant/revoke operation, error message " + e.getMessage();
+ LOG.warn(msg, e);
+ console.printError(msg);
+ return RETURN_CODE_FAILURE;
+ }
+ return RETURN_CODE_SUCCESS;
+ }
+
+ static String writeGrantInfo(Set<TSentryPrivilege> privileges, String roleName) {
+ if (privileges == null || privileges.isEmpty()) {
+ return "";
+ }
+ StringBuilder builder = new StringBuilder();
+
+ for (TSentryPrivilege privilege : privileges) {
+
+ if (ApiConstants.PrivilegeScope.URI.name().equalsIgnoreCase(
+ privilege.getPrivilegeScope())) {
+ appendNonNull(builder, privilege.getURI(), true);
+ } else if(ApiConstants.PrivilegeScope.SERVER.name().equalsIgnoreCase(
+ privilege.getPrivilegeScope())) {
+ appendNonNull(builder, "*", true);//Db column would show * if it is a server level privilege
+ } else {
+ appendNonNull(builder, privilege.getDbName(), true);
+ }
+ appendNonNull(builder, privilege.getTableName());
+ appendNonNull(builder, null);//getPartValues()
+ appendNonNull(builder, privilege.getColumnName());//getColumnName()
+ appendNonNull(builder, roleName);//getPrincipalName()
+ appendNonNull(builder, "ROLE");//getPrincipalType()
+ appendNonNull(builder, privilege.getAction());
+ appendNonNull(builder,
+ TSentryGrantOption.TRUE.equals(privilege.getGrantOption()));
+ appendNonNull(builder, privilege.getCreateTime() * 1000L);
+ appendNonNull(builder, "--");
+ }
+ LOG.info("builder.toString(): " + builder.toString());
+ return builder.toString();
+ }
+
+ static String writeRoleGrantsInfo(Set<TSentryRole> roleGrants) {
+ if (roleGrants == null || roleGrants.isEmpty()) {
+ return "";
+ }
+ StringBuilder builder = new StringBuilder();
+ for (TSentryRole roleGrant : roleGrants) {
+ appendNonNull(builder, roleGrant.getRoleName(), true);
+ appendNonNull(builder, false);//isGrantOption()
+ appendNonNull(builder, null);//roleGrant.getGrantTime() * 1000L
+ appendNonNull(builder, "--");
+ }
+ return builder.toString();
+ }
+
+ static String writeRolesInfo(Set<TSentryRole> roles) {
+ if (roles == null || roles.isEmpty()) {
+ return "";
+ }
+ StringBuilder builder = new StringBuilder();
+ for (TSentryRole roleGrant : roles) {
+ appendNonNull(builder, roleGrant.getRoleName(), true);
+ }
+ return builder.toString();
+ }
+
+ static String writeActiveRolesInfo(Set<String> roles) {
+ if (roles == null || roles.isEmpty()) {
+ return "";
+ }
+ StringBuilder builder = new StringBuilder();
+ for (String role : roles) {
+ appendNonNull(builder, role, true);
+ }
+ return builder.toString();
+ }
+
+ static StringBuilder appendNonNull(StringBuilder builder, Object value) {
+ return appendNonNull(builder, value, false);
+ }
+
+ static StringBuilder appendNonNull(StringBuilder builder, Object value, boolean firstColumn) {
+ if (!firstColumn) {
+ builder.append((char)separator);
+ } else if (builder.length() > 0) {
+ builder.append((char)terminator);
+ }
+ if (value != null) {
+ builder.append(value);
+ }
+ return builder;
+ }
+
+ private static int processGrantRevokeDDL(LogHelper console,
+ SentryPolicyServiceClient sentryClient, String subject, String server,
+ boolean isGrant, List<PrincipalDesc> principals,
+ List<PrivilegeDesc> privileges, PrivilegeObjectDesc privSubjectObjDesc,
+ Boolean grantOption) throws SentryUserException {
+ if (privileges == null || privileges.size() == 0) {
+ console.printError("No privilege found.");
+ return RETURN_CODE_FAILURE;
+ }
+
+ String dbName = null;
+ String tableName = null;
+ List<String> columnNames = null;
+ String uriPath = null;
+ String serverName = null;
+ try {
+ SentryHivePrivilegeObjectDesc privSubjectDesc = toSentryHivePrivilegeObjectDesc(privSubjectObjDesc);
+
+ if (privSubjectDesc == null) {
+ throw new HiveException("Privilege subject cannot be null");
+ }
+ if (privSubjectDesc.getPartSpec() != null) {
+ throw new HiveException(SentryHiveConstants.PARTITION_PRIVS_NOT_SUPPORTED);
+ }
+ String obj = privSubjectDesc.getObject();
+ if (privSubjectDesc.getTable()) {
+ DatabaseTable dbTable = parseDBTable(obj);
+ dbName = dbTable.getDatabase();
+ tableName = dbTable.getTable();
+ } else if (privSubjectDesc.getUri()) {
+ uriPath = privSubjectDesc.getObject();
+ } else if (privSubjectDesc.getServer()) {
+ serverName = privSubjectDesc.getObject();
+ } else {
+ dbName = privSubjectDesc.getObject();
+ }
+ for (PrivilegeDesc privDesc : privileges) {
+ List<String> columns = privDesc.getColumns();
+ if (columns != null && !columns.isEmpty()) {
+ columnNames = columns;
+ }
+ if (!SentryHiveConstants.ALLOWED_PRIVS.contains(privDesc.getPrivilege().getPriv())) {
+ String msg = SentryHiveConstants.PRIVILEGE_NOT_SUPPORTED + privDesc.getPrivilege().getPriv();
+ throw new HiveException(msg);
+ }
+ if (columnNames != null && (privDesc.getPrivilege().getPriv().equals(PrivilegeType.INSERT)
+ || privDesc.getPrivilege().getPriv().equals(PrivilegeType.ALL))) {
+ String msg = SentryHiveConstants.PRIVILEGE_NOT_SUPPORTED
+ + privDesc.getPrivilege().getPriv() + " on Column";
+ throw new SemanticException(msg);
+ }
+ }
+ for (PrincipalDesc princ : principals) {
+ if (princ.getType() != PrincipalType.ROLE) {
+ String msg = SentryHiveConstants.GRANT_REVOKE_NOT_SUPPORTED_FOR_PRINCIPAL + princ.getType();
+ throw new HiveException(msg);
+ }
+ for (PrivilegeDesc privDesc : privileges) {
+ if (isGrant) {
+ if (serverName != null) {
+ sentryClient.grantServerPrivilege(subject, princ.getName(), serverName,
+ toSentryAction(privDesc.getPrivilege().getPriv()), grantOption);
+ } else if (uriPath != null) {
+ sentryClient.grantURIPrivilege(subject, princ.getName(), server, uriPath, grantOption);
+ } else if (tableName == null) {
+ sentryClient.grantDatabasePrivilege(subject, princ.getName(), server, dbName,
+ toDbSentryAction(privDesc.getPrivilege().getPriv()), grantOption);
+ } else if (columnNames == null) {
+ sentryClient.grantTablePrivilege(subject, princ.getName(), server, dbName,
+ tableName, toSentryAction(privDesc.getPrivilege().getPriv()), grantOption);
+ } else {
+ sentryClient.grantColumnsPrivileges(subject, princ.getName(), server, dbName,
+ tableName, columnNames, toSentryAction(privDesc.getPrivilege().getPriv()), grantOption);
+ }
+ } else {
+ if (serverName != null) {
+ sentryClient.revokeServerPrivilege(subject, princ.getName(), serverName,
+ toSentryAction(privDesc.getPrivilege().getPriv()), grantOption);
+ } else if (uriPath != null) {
+ sentryClient.revokeURIPrivilege(subject, princ.getName(), server, uriPath, grantOption);
+ } else if (tableName == null) {
+ sentryClient.revokeDatabasePrivilege(subject, princ.getName(), server, dbName,
+ toDbSentryAction(privDesc.getPrivilege().getPriv()), grantOption);
+ } else if (columnNames == null) {
+ sentryClient.revokeTablePrivilege(subject, princ.getName(), server, dbName,
+ tableName, toSentryAction(privDesc.getPrivilege().getPriv()), grantOption);
+ } else {
+ sentryClient.revokeColumnsPrivilege(subject, princ.getName(), server, dbName,
+ tableName, columnNames, toSentryAction(privDesc.getPrivilege().getPriv()), grantOption);
+ }
+ }
+ }
+ }
+ return RETURN_CODE_SUCCESS;
+ } catch (HiveException e) {
+ String msg = "Error in grant/revoke operation, error message " + e.getMessage();
+ LOG.warn(msg, e);
+ console.printError(msg);
+ return RETURN_CODE_FAILURE;
+ }
+ }
+
+ private static String toDbSentryAction(PrivilegeType privilegeType) throws SentryUserException{
+ switch(privilegeType) {
+ case ALL:
+ return AccessConstants.ALL;
+ case SELECT:
+ return AccessConstants.SELECT;
+ case INSERT:
+ return AccessConstants.INSERT;
+ case CREATE:
+ return AccessConstants.CREATE;
+ case DROP:
+ return AccessConstants.DROP;
+ case ALTER_METADATA:
+ return AccessConstants.ALTER;
+ case INDEX:
+ return AccessConstants.INDEX;
+ case LOCK:
+ return AccessConstants.LOCK;
+ default:
+ throw new SentryUserException("Unknown privilege type: " + privilegeType);
+ //Exception is thrown here only for development purposes.
+ }
+ }
+
+ private static SentryHivePrivilegeObjectDesc toSentryHivePrivilegeObjectDesc(PrivilegeObjectDesc privSubjectObjDesc)
+ throws HiveException{
+ if (!(privSubjectObjDesc instanceof SentryHivePrivilegeObjectDesc)) {
+ throw new HiveException(
+ "Privilege subject not parsed correctly by Sentry");
+ }
+ return (SentryHivePrivilegeObjectDesc) privSubjectObjDesc;
+ }
+
+ private static String toSentryAction(PrivilegeType privilegeType) {
+ if (PrivilegeType.ALL.equals(privilegeType)) {
+ return AccessConstants.ALL;
+ } else {
+ return privilegeType.toString();
+ }
+ }
+
+ private static DatabaseTable parseDBTable(String obj) throws HiveException {
+ String[] dbTab = Iterables.toArray(DB_TBL_SPLITTER.split(obj), String.class);
+ if (dbTab.length == 2) {
+ return new DatabaseTable(dbTab[0], dbTab[1]);
+ } else if (dbTab.length == 1){
+ return new DatabaseTable(SessionState.get().getCurrentDatabase(), obj);
+ } else {
+ String msg = "Malformed database.table '" + obj + "'";
+ throw new HiveException(msg);
+ }
+ }
+
+ private static class DatabaseTable {
+ private final String database;
+ private final String table;
+ public DatabaseTable(String database, String table) {
+ this.database = database;
+ this.table = table;
+ }
+ public String getDatabase() {
+ return database;
+ }
+ public String getTable() {
+ return table;
+ }
+ }
+
+ /**
+ * Close to be used in the try block of a try-catch-finally
+ * statement. Returns null so the close/set to null idiom can be
+ * completed in a single line.
+ */
+ private static DataOutputStream close(DataOutputStream out)
+ throws IOException {
+ if (out != null) {
+ out.close();
+ }
+ return null;
+ }
+ /**
+ * Close to be used in the finally block of a try-catch-finally
+ * statement.
+ */
+ private static void closeQuiet(DataOutputStream out) {
+ try {
+ close(out);
+ } catch (IOException e) {
+ LOG.warn("Error closing output stream", e);
+ }
+ }
+
+ @Override
+ public boolean requireLock() {
+ return false;
+ }
+
+ @Override
+ public StageType getType() {
+ return StageType.DDL;
+ }
+
+ @Override
+ public String getName() {
+ return "SENTRY";
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/authz/DefaultSentryAccessController.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/authz/DefaultSentryAccessController.java b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/authz/DefaultSentryAccessController.java
index 2abe37e..fc2427c 100644
--- a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/authz/DefaultSentryAccessController.java
+++ b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/authz/DefaultSentryAccessController.java
@@ -50,9 +50,9 @@ import org.apache.sentry.core.common.exception.SentryUserException;
import org.apache.sentry.core.model.db.AccessConstants;
import org.apache.sentry.core.model.db.DBModelAuthorizable;
import org.apache.sentry.core.model.db.Server;
-import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient;
-import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege;
-import org.apache.sentry.provider.db.service.thrift.TSentryRole;
+import org.apache.sentry.api.service.thrift.SentryPolicyServiceClient;
+import org.apache.sentry.api.service.thrift.TSentryPrivilege;
+import org.apache.sentry.api.service.thrift.TSentryRole;
import org.apache.sentry.service.thrift.SentryServiceClientFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/authz/SentryConfigTool.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/authz/SentryConfigTool.java b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/authz/SentryConfigTool.java
index c23547a..5f1e3e9 100644
--- a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/authz/SentryConfigTool.java
+++ b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/authz/SentryConfigTool.java
@@ -43,7 +43,7 @@ import org.apache.sentry.core.common.Subject;
import org.apache.sentry.core.common.exception.SentryConfigurationException;
import org.apache.sentry.core.model.db.Server;
import org.apache.sentry.provider.common.AuthorizationProvider;
-import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient;
+import org.apache.sentry.api.service.thrift.SentryPolicyServiceClient;
import org.apache.sentry.service.thrift.SentryServiceClientFactory;
import java.security.CodeSource;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/SentrySyncHMSNotificationsPostEventListener.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/SentrySyncHMSNotificationsPostEventListener.java b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/SentrySyncHMSNotificationsPostEventListener.java
index 24d7763..7b2d8be 100644
--- a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/SentrySyncHMSNotificationsPostEventListener.java
+++ b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/SentrySyncHMSNotificationsPostEventListener.java
@@ -33,7 +33,7 @@ import org.apache.hadoop.hive.metastore.events.DropPartitionEvent;
import org.apache.hadoop.hive.metastore.events.DropTableEvent;
import org.apache.hadoop.hive.metastore.events.ListenerEvent;
import org.apache.sentry.binding.hive.conf.HiveAuthzConf;
-import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient;
+import org.apache.sentry.api.service.thrift.SentryPolicyServiceClient;
import org.apache.sentry.service.thrift.SentryServiceClientFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/util/SentryAuthorizerUtil.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/util/SentryAuthorizerUtil.java b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/util/SentryAuthorizerUtil.java
index 1c41639..dd6936c 100644
--- a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/util/SentryAuthorizerUtil.java
+++ b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/util/SentryAuthorizerUtil.java
@@ -50,10 +50,10 @@ import org.apache.sentry.core.model.db.DBModelAuthorizable;
import org.apache.sentry.core.model.db.Database;
import org.apache.sentry.core.model.db.Server;
import org.apache.sentry.core.model.db.Table;
-import org.apache.sentry.provider.db.service.thrift.TSentryGrantOption;
-import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege;
-import org.apache.sentry.provider.db.service.thrift.TSentryRole;
-import org.apache.sentry.service.thrift.ServiceConstants.PrivilegeScope;
+import org.apache.sentry.api.common.ApiConstants;
+import org.apache.sentry.api.service.thrift.TSentryGrantOption;
+import org.apache.sentry.api.service.thrift.TSentryPrivilege;
+import org.apache.sentry.api.service.thrift.TSentryRole;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -239,7 +239,7 @@ public class SentryAuthorizerUtil {
*/
public static HivePrivilegeObject convert2HivePrivilegeObject(TSentryPrivilege tSentryPrivilege) {
HivePrivilegeObject privilege = null;
- switch (PrivilegeScope.valueOf(tSentryPrivilege.getPrivilegeScope())) {
+ switch (ApiConstants.PrivilegeScope.valueOf(tSentryPrivilege.getPrivilegeScope())) {
case SERVER:
privilege = new HivePrivilegeObject(HivePrivilegeObjectType.GLOBAL, "*", null);
break;
@@ -271,7 +271,7 @@ public class SentryAuthorizerUtil {
}
default:
LOG.warn("Unknown PrivilegeScope: "
- + PrivilegeScope.valueOf(tSentryPrivilege.getPrivilegeScope()));
+ + ApiConstants.PrivilegeScope.valueOf(tSentryPrivilege.getPrivilegeScope()));
break;
}
return privilege;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-binding/sentry-binding-hive/src/test/java/org/apache/sentry/binding/metastore/TestSentrySyncHMSNotificationsPostEventListener.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/src/test/java/org/apache/sentry/binding/metastore/TestSentrySyncHMSNotificationsPostEventListener.java b/sentry-binding/sentry-binding-hive/src/test/java/org/apache/sentry/binding/metastore/TestSentrySyncHMSNotificationsPostEventListener.java
index cca326b..fc1c3d5 100644
--- a/sentry-binding/sentry-binding-hive/src/test/java/org/apache/sentry/binding/metastore/TestSentrySyncHMSNotificationsPostEventListener.java
+++ b/sentry-binding/sentry-binding-hive/src/test/java/org/apache/sentry/binding/metastore/TestSentrySyncHMSNotificationsPostEventListener.java
@@ -27,7 +27,7 @@ import org.apache.hadoop.hive.metastore.events.DropTableEvent;
import org.apache.hadoop.hive.metastore.events.ListenerEvent;
import org.apache.sentry.binding.hive.conf.HiveAuthzConf;
import org.apache.sentry.core.common.exception.SentryUserException;
-import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient;
+import org.apache.sentry.api.service.thrift.SentryPolicyServiceClient;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-binding/sentry-binding-kafka/src/main/java/org/apache/sentry/kafka/binding/KafkaAuthBinding.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-kafka/src/main/java/org/apache/sentry/kafka/binding/KafkaAuthBinding.java b/sentry-binding/sentry-binding-kafka/src/main/java/org/apache/sentry/kafka/binding/KafkaAuthBinding.java
index e4abdc7..07b21b9 100644
--- a/sentry-binding/sentry-binding-kafka/src/main/java/org/apache/sentry/kafka/binding/KafkaAuthBinding.java
+++ b/sentry-binding/sentry-binding-kafka/src/main/java/org/apache/sentry/kafka/binding/KafkaAuthBinding.java
@@ -56,13 +56,14 @@ import org.apache.sentry.provider.common.AuthorizationProvider;
import org.apache.sentry.provider.common.ProviderBackend;
import org.apache.sentry.provider.common.ProviderBackendContext;
import org.apache.sentry.provider.db.generic.SentryGenericProviderBackend;
-import org.apache.sentry.provider.db.generic.service.thrift.SentryGenericServiceClient;
-import org.apache.sentry.provider.db.generic.service.thrift.SentryGenericServiceClientFactory;
-import org.apache.sentry.provider.db.generic.service.thrift.TAuthorizable;
-import org.apache.sentry.provider.db.generic.service.thrift.TSentryPrivilege;
-import org.apache.sentry.provider.db.generic.service.thrift.TSentryRole;
-import org.apache.sentry.provider.db.generic.tools.GenericPrivilegeConverter;
-import org.apache.sentry.service.thrift.ServiceConstants;
+import org.apache.sentry.api.generic.thrift.SentryGenericServiceClient;
+import org.apache.sentry.api.generic.thrift.SentryGenericServiceClientFactory;
+import org.apache.sentry.api.generic.thrift.TAuthorizable;
+import org.apache.sentry.api.generic.thrift.TSentryPrivilege;
+import org.apache.sentry.api.generic.thrift.TSentryRole;
+import org.apache.sentry.api.common.ApiConstants;
+import org.apache.sentry.api.tools.GenericPrivilegeConverter;
+import org.apache.sentry.service.common.ServiceConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import scala.Option;
@@ -159,23 +160,23 @@ public class KafkaAuthBinding {
if (enableCachingConfig != null) {
String enableCaching = enableCachingConfig.toString();
if (Boolean.parseBoolean(enableCaching)) {
- authConf.set(ServiceConstants.ClientConfig.ENABLE_CACHING, enableCaching);
+ authConf.set(ApiConstants.ClientConfig.ENABLE_CACHING, enableCaching);
final Object cacheTtlMsConfig = kafkaConfigs
.get(AuthzConfVars.AUTHZ_CACHING_TTL_MS_NAME.getVar());
if (cacheTtlMsConfig != null) {
- authConf.set(ServiceConstants.ClientConfig.CACHE_TTL_MS, cacheTtlMsConfig.toString());
+ authConf.set(ApiConstants.ClientConfig.CACHE_TTL_MS, cacheTtlMsConfig.toString());
}
final Object cacheUpdateFailuresCountConfig = kafkaConfigs
.get(AuthzConfVars.AUTHZ_CACHING_UPDATE_FAILURES_COUNT_NAME.getVar());
if (cacheUpdateFailuresCountConfig != null) {
- authConf.set(ServiceConstants.ClientConfig.CACHE_UPDATE_FAILURES_BEFORE_PRIV_REVOKE,
+ authConf.set(ApiConstants.ClientConfig.CACHE_UPDATE_FAILURES_BEFORE_PRIV_REVOKE,
cacheUpdateFailuresCountConfig.toString());
}
- if (authConf.get(ServiceConstants.ClientConfig.PRIVILEGE_CONVERTER) == null) {
- authConf.set(ServiceConstants.ClientConfig.PRIVILEGE_CONVERTER,
+ if (authConf.get(ApiConstants.ClientConfig.PRIVILEGE_CONVERTER) == null) {
+ authConf.set(ApiConstants.ClientConfig.PRIVILEGE_CONVERTER,
GenericPrivilegeConverter.class.getName());
}
}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/authz/SolrAuthzBinding.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/authz/SolrAuthzBinding.java b/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/authz/SolrAuthzBinding.java
index 5c2a301..32a1fc1 100644
--- a/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/authz/SolrAuthzBinding.java
+++ b/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/authz/SolrAuthzBinding.java
@@ -48,10 +48,10 @@ import org.apache.sentry.provider.common.ProviderBackend;
import org.apache.sentry.provider.common.ProviderBackendContext;
import org.apache.sentry.provider.common.GroupMappingService;
import org.apache.sentry.provider.db.generic.SentryGenericProviderBackend;
-import org.apache.sentry.provider.db.generic.service.thrift.SentryGenericServiceClient;
-import org.apache.sentry.provider.db.generic.service.thrift.SentryGenericServiceClientFactory;
-import org.apache.sentry.provider.db.generic.tools.GenericPrivilegeConverter;
-import org.apache.sentry.service.thrift.ServiceConstants;
+import org.apache.sentry.api.generic.thrift.SentryGenericServiceClient;
+import org.apache.sentry.api.generic.thrift.SentryGenericServiceClientFactory;
+import org.apache.sentry.api.common.ApiConstants;
+import org.apache.sentry.api.tools.GenericPrivilegeConverter;
import org.apache.solr.security.AuthorizationResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -110,8 +110,8 @@ public class SolrAuthzBinding implements Closeable {
+ policyEngineName + ", provider backend " + providerBackendName);
// for convenience, set the PrivilegeConverter.
- if (authzConf.get(ServiceConstants.ClientConfig.PRIVILEGE_CONVERTER) == null) {
- authzConf.set(ServiceConstants.ClientConfig.PRIVILEGE_CONVERTER,
+ if (authzConf.get(ApiConstants.ClientConfig.PRIVILEGE_CONVERTER) == null) {
+ authzConf.set(ApiConstants.ClientConfig.PRIVILEGE_CONVERTER,
GenericPrivilegeConverter.class.getName());
}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-binding/sentry-binding-sqoop/src/main/java/org/apache/sentry/sqoop/binding/SqoopAuthBinding.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-sqoop/src/main/java/org/apache/sentry/sqoop/binding/SqoopAuthBinding.java b/sentry-binding/sentry-binding-sqoop/src/main/java/org/apache/sentry/sqoop/binding/SqoopAuthBinding.java
index b7cbd32..539ccc1 100644
--- a/sentry-binding/sentry-binding-sqoop/src/main/java/org/apache/sentry/sqoop/binding/SqoopAuthBinding.java
+++ b/sentry-binding/sentry-binding-sqoop/src/main/java/org/apache/sentry/sqoop/binding/SqoopAuthBinding.java
@@ -37,14 +37,14 @@ import org.apache.sentry.provider.common.AuthorizationProvider;
import org.apache.sentry.provider.common.ProviderBackend;
import org.apache.sentry.provider.common.ProviderBackendContext;
import org.apache.sentry.provider.db.generic.SentryGenericProviderBackend;
-import org.apache.sentry.provider.db.generic.service.thrift.SentryGenericServiceClient;
-import org.apache.sentry.provider.db.generic.service.thrift.SentryGenericServiceClientFactory;
-import org.apache.sentry.provider.db.generic.service.thrift.TAuthorizable;
-import org.apache.sentry.provider.db.generic.service.thrift.TSentryGrantOption;
-import org.apache.sentry.provider.db.generic.service.thrift.TSentryPrivilege;
-import org.apache.sentry.provider.db.generic.service.thrift.TSentryRole;
-import org.apache.sentry.provider.db.generic.tools.GenericPrivilegeConverter;
-import org.apache.sentry.service.thrift.ServiceConstants;
+import org.apache.sentry.api.generic.thrift.SentryGenericServiceClient;
+import org.apache.sentry.api.generic.thrift.SentryGenericServiceClientFactory;
+import org.apache.sentry.api.generic.thrift.TAuthorizable;
+import org.apache.sentry.api.generic.thrift.TSentryGrantOption;
+import org.apache.sentry.api.generic.thrift.TSentryPrivilege;
+import org.apache.sentry.api.generic.thrift.TSentryRole;
+import org.apache.sentry.api.common.ApiConstants;
+import org.apache.sentry.api.tools.GenericPrivilegeConverter;
import org.apache.sentry.sqoop.conf.SqoopAuthConf.AuthzConfVars;
import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.model.MPrivilege;
@@ -112,8 +112,8 @@ public class SqoopAuthBinding {
}
// for convenience, set the PrivilegeConverter.
- if (authConf.get(ServiceConstants.ClientConfig.PRIVILEGE_CONVERTER) == null) {
- authConf.set(ServiceConstants.ClientConfig.PRIVILEGE_CONVERTER, GenericPrivilegeConverter.class.getName());
+ if (authConf.get(ApiConstants.ClientConfig.PRIVILEGE_CONVERTER) == null) {
+ authConf.set(ApiConstants.ClientConfig.PRIVILEGE_CONVERTER, GenericPrivilegeConverter.class.getName());
}
//Instantiate the configured providerBackend
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-core/sentry-core-common/src/main/java/org/apache/sentry/api/common/ApiConstants.java
----------------------------------------------------------------------
diff --git a/sentry-core/sentry-core-common/src/main/java/org/apache/sentry/api/common/ApiConstants.java b/sentry-core/sentry-core-common/src/main/java/org/apache/sentry/api/common/ApiConstants.java
new file mode 100644
index 0000000..6fcf8ab
--- /dev/null
+++ b/sentry-core/sentry-core-common/src/main/java/org/apache/sentry/api/common/ApiConstants.java
@@ -0,0 +1,90 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.common;
+
+
+import org.apache.sentry.service.common.ServiceConstants;
+
+public class ApiConstants {
+
+ public static class SentryPolicyServiceConstants {
+ //from SentryPolicyStoreProcessor and SentryGenericPolicyProcessor
+ public static final String SENTRY_GENERIC_SERVICE_NAME = "SentryGenericPolicyService";
+ public static final String SENTRY_POLICY_SERVICE_NAME = "SentryPolicyService";
+ }
+
+ public static class ClientConfig {
+ public static final String SERVER_RPC_PORT = "sentry.service.client.server.rpc-port";
+ public static final int SERVER_RPC_PORT_DEFAULT = ServiceConstants.ServerConfig.RPC_PORT_DEFAULT;
+ public static final String SERVER_RPC_ADDRESS = "sentry.service.client.server.rpc-addresses";
+ public static final String SERVER_RPC_CONN_TIMEOUT = "sentry.service.client.server.rpc-connection-timeout";
+
+ // HA configuration
+ public static final String SENTRY_HA_ZOOKEEPER_QUORUM = ServiceConstants.ServerConfig.SENTRY_HA_ZOOKEEPER_QUORUM;
+ public static final String SENTRY_HA_ZOOKEEPER_NAMESPACE = ServiceConstants.ServerConfig.SENTRY_HA_ZOOKEEPER_NAMESPACE;
+ public static final String SERVER_HA_ZOOKEEPER_NAMESPACE_DEFAULT = ServiceConstants.ServerConfig.SENTRY_HA_ZOOKEEPER_NAMESPACE_DEFAULT;
+
+ // connection pool configuration
+ public static final String SENTRY_POOL_ENABLED = "sentry.service.client.connection.pool.enabled";
+ public static final boolean SENTRY_POOL_ENABLED_DEFAULT = false;
+
+ // commons-pool configuration for pool size
+ public static final String SENTRY_POOL_MAX_TOTAL = "sentry.service.client.connection.pool.max-total";
+ public static final int SENTRY_POOL_MAX_TOTAL_DEFAULT = 8;
+ public static final String SENTRY_POOL_MAX_IDLE = "sentry.service.client.connection.pool.max-idle";
+ public static final int SENTRY_POOL_MAX_IDLE_DEFAULT = 8;
+ public static final String SENTRY_POOL_MIN_IDLE = "sentry.service.client.connection.pool.min-idle";
+ public static final int SENTRY_POOL_MIN_IDLE_DEFAULT = 0;
+
+ // retry num for getting the connection from connection pool
+ public static final String SENTRY_POOL_RETRY_TOTAL = "sentry.service.client.connection.pool.retry-total";
+ public static final int SENTRY_POOL_RETRY_TOTAL_DEFAULT = 3;
+
+ // max message size for thrift messages
+ public static final String SENTRY_POLICY_CLIENT_THRIFT_MAX_MESSAGE_SIZE = "sentry.policy.client.thrift.max.message.size";
+ public static final long SENTRY_POLICY_CLIENT_THRIFT_MAX_MESSAGE_SIZE_DEFAULT = 100 * 1024 * 1024;
+
+ // client retry settings
+ public static final String RETRY_COUNT_CONF = "sentry.provider.backend.db.retry.count";
+ public static final int RETRY_COUNT_DEFAULT = 3;
+ public static final String RETRY_INTERVAL_SEC_CONF = "sentry.provider.backend.db.retry.interval.seconds";
+ public static final int RETRY_INTERVAL_SEC_DEFAULT = 30;
+
+ // provider backend cache settings
+ public static final String ENABLE_CACHING = "sentry.provider.backend.generic.cache.enabled";
+ public static final boolean ENABLE_CACHING_DEFAULT = false;
+ public static final String CACHE_TTL_MS = "sentry.provider.backend.generic.cache.ttl.ms";
+ public static final long CACHING_TTL_MS_DEFAULT = 30000;
+ public static final String CACHE_UPDATE_FAILURES_BEFORE_PRIV_REVOKE = "sentry.provider.backend.generic.cache.update.failures.count";
+ public static final int CACHE_UPDATE_FAILURES_BEFORE_PRIV_REVOKE_DEFAULT = 3;
+ public static final String PRIVILEGE_CONVERTER = "sentry.provider.backend.generic.privilege.converter";
+
+ public static final String COMPONENT_TYPE = "sentry.provider.backend.generic.component-type";
+ public static final String SERVICE_NAME = "sentry.provider.backend.generic.service-name";
+ }
+
+ /* Privilege operation scope */
+ public enum PrivilegeScope {
+ SERVER,
+ URI,
+ DATABASE,
+ TABLE,
+ COLUMN
+ }
+}
\ No newline at end of file
[21/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClientDefaultImpl.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClientDefaultImpl.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClientDefaultImpl.java
deleted file mode 100644
index bede5b1..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClientDefaultImpl.java
+++ /dev/null
@@ -1,1081 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.sentry.core.common.ActiveRoleSet;
-import org.apache.sentry.core.common.Authorizable;
-import org.apache.sentry.core.common.exception.SentryUserException;
-import org.apache.sentry.core.common.transport.SentryConnection;
-import org.apache.sentry.core.common.transport.SentryTransportPool;
-import org.apache.sentry.core.common.transport.TTransportWrapper;
-import org.apache.sentry.core.common.utils.PolicyFileConstants;
-import org.apache.sentry.core.model.db.AccessConstants;
-import org.apache.sentry.core.model.db.DBModelAuthorizable;
-import org.apache.sentry.provider.db.service.thrift.SentryPolicyService.Client;
-import org.apache.sentry.service.thrift.SentryServiceUtil;
-import org.apache.sentry.service.thrift.ServiceConstants.ClientConfig;
-import org.apache.sentry.service.thrift.ServiceConstants.PrivilegeScope;
-import org.apache.sentry.service.thrift.ServiceConstants.ThriftConstants;
-import org.apache.sentry.service.thrift.Status;
-import org.apache.thrift.TException;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.protocol.TMultiplexedProtocol;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Client implementation for Policy (HMS) clients.
- * <p>
- * The class is not thread-safe - it is up to the callers to ensure thread safety
- */
-public class SentryPolicyServiceClientDefaultImpl implements SentryPolicyServiceClient, SentryConnection {
-
- private Client client;
- private final SentryTransportPool transportPool;
- private TTransportWrapper transport;
- private final long maxMessageSize;
-
- private static final String THRIFT_EXCEPTION_MESSAGE = "Thrift exception occurred ";
-
- /**
- * Initialize the sentry configurations.
- */
- public SentryPolicyServiceClientDefaultImpl(Configuration conf,
- SentryTransportPool transportPool)
- throws IOException {
- maxMessageSize = conf.getLong(ClientConfig.SENTRY_POLICY_CLIENT_THRIFT_MAX_MESSAGE_SIZE,
- ClientConfig.SENTRY_POLICY_CLIENT_THRIFT_MAX_MESSAGE_SIZE_DEFAULT);
- this.transportPool = transportPool;
- }
-
- /**
- * Connect to the sentry server
- *
- * @throws IOException
- */
- @Override
- public void connect() throws Exception {
- if ((transport != null) && transport.isOpen()) {
- return;
- }
-
- transport = transportPool.getTransport();
- TMultiplexedProtocol protocol = new TMultiplexedProtocol(
- new TBinaryProtocol(transport.getTTransport(), maxMessageSize, maxMessageSize,
- true, true),
- SentryPolicyStoreProcessor.SENTRY_POLICY_SERVICE_NAME);
- client = new Client(protocol);
- }
-
- @Override
- public void createRole(String requestorUserName, String roleName)
- throws SentryUserException {
- TCreateSentryRoleRequest request = new TCreateSentryRoleRequest();
- request.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT);
- request.setRequestorUserName(requestorUserName);
- request.setRoleName(roleName);
- try {
- TCreateSentryRoleResponse response = client.create_sentry_role(request);
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- @Override
- public void dropRole(String requestorUserName,
- String roleName)
- throws SentryUserException {
- dropRole(requestorUserName, roleName, false);
- }
-
- @Override
- public void dropRoleIfExists(String requestorUserName,
- String roleName)
- throws SentryUserException {
- dropRole(requestorUserName, roleName, true);
- }
-
- private void dropRole(String requestorUserName,
- String roleName, boolean ifExists)
- throws SentryUserException {
- TDropSentryRoleRequest request = new TDropSentryRoleRequest();
- request.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT);
- request.setRequestorUserName(requestorUserName);
- request.setRoleName(roleName);
- try {
- TDropSentryRoleResponse response = client.drop_sentry_role(request);
- Status status = Status.fromCode(response.getStatus().getValue());
- if (ifExists && status == Status.NO_SUCH_OBJECT) {
- return;
- }
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- /**
- * Gets sentry role objects for a given groupName using the Sentry service
- *
- * @param requestorUserName : user on whose behalf the request is issued
- * @param groupName : groupName to look up ( if null returns all roles for all groups)
- * @return Set of thrift sentry role objects
- * @throws SentryUserException
- */
- @Override
- public Set<TSentryRole> listRolesByGroupName(
- String requestorUserName,
- String groupName)
- throws SentryUserException {
- TListSentryRolesRequest request = new TListSentryRolesRequest();
- request.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT);
- request.setRequestorUserName(requestorUserName);
- request.setGroupName(groupName);
- TListSentryRolesResponse response;
- try {
- response = client.list_sentry_roles_by_group(request);
- Status status = Status.fromCode(response.getStatus().getValue());
- if (status == Status.NO_SUCH_OBJECT) {
- return Collections.emptySet();
- }
- Status.throwIfNotOk(response.getStatus());
- return response.getRoles();
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- /**
- * Gets sentry role objects for a given userName using the Sentry service
- *
- * @param requestorUserName : user on whose behalf the request is issued
- * @param userName : userName to look up (can't be empty)
- * @return Set of thrift sentry role objects
- * @throws SentryUserException
- */
- @Override
- public Set<TSentryRole> listRolesByUserName(String requestorUserName, String userName)
- throws SentryUserException {
- TListSentryRolesForUserRequest request = new TListSentryRolesForUserRequest();
- request.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT);
- request.setRequestorUserName(requestorUserName);
- request.setUserName(userName);
- TListSentryRolesResponse response;
- try {
- response = client.list_sentry_roles_by_user(request);
- Status.throwIfNotOk(response.getStatus());
- return response.getRoles();
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- @Override
- public Set<TSentryPrivilege> listAllPrivilegesByRoleName(String requestorUserName,
- String roleName)
- throws SentryUserException {
- return listPrivilegesByRoleName(requestorUserName, roleName, null);
- }
-
- /**
- * Gets sentry privilege objects for a given roleName using the Sentry service
- *
- * @param requestorUserName : user on whose behalf the request is issued
- * @param roleName : roleName to look up
- * @param authorizable : authorizable Hierarchy (server->db->table etc)
- * @return Set of thrift sentry privilege objects
- * @throws SentryUserException
- */
- @Override
- public Set<TSentryPrivilege> listPrivilegesByRoleName(String requestorUserName,
- String roleName, List<? extends Authorizable> authorizable)
- throws SentryUserException {
- TListSentryPrivilegesRequest request = new TListSentryPrivilegesRequest();
- request.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT);
- request.setRequestorUserName(requestorUserName);
- request.setRoleName(roleName);
- if (authorizable != null && !authorizable.isEmpty()) {
- TSentryAuthorizable tSentryAuthorizable = setupSentryAuthorizable(authorizable);
- request.setAuthorizableHierarchy(tSentryAuthorizable);
- }
- TListSentryPrivilegesResponse response;
- try {
- response = client.list_sentry_privileges_by_role(request);
- Status.throwIfNotOk(response.getStatus());
- return response.getPrivileges();
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- @Override
- public Set<TSentryRole> listAllRoles(String requestorUserName)
- throws SentryUserException {
- return listRolesByGroupName(requestorUserName, null);
- }
-
- @Override
- public Set<TSentryRole> listUserRoles(String requestorUserName)
- throws SentryUserException {
- Set<TSentryRole> tSentryRoles = Sets.newHashSet();
- tSentryRoles.addAll(listRolesByGroupName(requestorUserName, AccessConstants.ALL));
- tSentryRoles.addAll(listRolesByUserName(requestorUserName, requestorUserName));
- return tSentryRoles;
- }
-
- @Override
- public TSentryPrivilege grantURIPrivilege(String requestorUserName,
- String roleName, String server, String uri)
- throws SentryUserException {
- return grantPrivilege(requestorUserName, roleName,
- PrivilegeScope.URI, server, uri, null, null, null, AccessConstants.ALL);
- }
-
- @Override
- public TSentryPrivilege grantURIPrivilege(String requestorUserName,
- String roleName, String server, String uri, Boolean grantOption)
- throws SentryUserException {
- return grantPrivilege(requestorUserName, roleName,
- PrivilegeScope.URI, server, uri, null, null, null, AccessConstants.ALL, grantOption);
- }
-
- @Override
- public void grantServerPrivilege(String requestorUserName,
- String roleName, String server, String action)
- throws SentryUserException {
-
- // "ALL" and "*" should be synonyms for action and need to be unified with grantServerPrivilege without
- // action explicitly specified.
- if (AccessConstants.ACTION_ALL.equalsIgnoreCase(action) || AccessConstants.ALL.equals(action)) {
- action = AccessConstants.ALL;
- }
-
- grantPrivilege(requestorUserName, roleName,
- PrivilegeScope.SERVER, server, null, null, null, null, action);
- }
-
- @Deprecated
- /***
- * Should use grantServerPrivilege(String requestorUserName,
- * String roleName, String server, String action, Boolean grantOption)
- */
- public TSentryPrivilege grantServerPrivilege(String requestorUserName,
- String roleName, String server, Boolean grantOption) throws SentryUserException {
- return grantServerPrivilege(requestorUserName, roleName, server,
- AccessConstants.ALL, grantOption);
- }
-
- @Override
- public TSentryPrivilege grantServerPrivilege(String requestorUserName,
- String roleName, String server, String action, Boolean grantOption)
- throws SentryUserException {
-
- // "ALL" and "*" should be synonyms for action and need to be unified with grantServerPrivilege without
- // action explicitly specified.
- if (AccessConstants.ACTION_ALL.equalsIgnoreCase(action) || AccessConstants.ALL.equals(action)) {
- action = AccessConstants.ALL;
- }
-
- return grantPrivilege(requestorUserName, roleName,
- PrivilegeScope.SERVER, server, null, null, null, null, action, grantOption);
- }
-
- @Override
- public TSentryPrivilege grantDatabasePrivilege(String requestorUserName,
- String roleName, String server, String db, String action)
- throws SentryUserException {
- return grantPrivilege(requestorUserName, roleName,
- PrivilegeScope.DATABASE, server, null, db, null, null, action);
- }
-
- @Override
- public TSentryPrivilege grantDatabasePrivilege(String requestorUserName,
- String roleName, String server, String db, String action, Boolean grantOption)
- throws SentryUserException {
- return grantPrivilege(requestorUserName, roleName,
- PrivilegeScope.DATABASE, server, null, db, null, null, action, grantOption);
- }
-
- @Override
- public TSentryPrivilege grantTablePrivilege(String requestorUserName,
- String roleName, String server, String db, String table, String action)
- throws SentryUserException {
- return grantPrivilege(requestorUserName, roleName, PrivilegeScope.TABLE, server,
- null,
- db, table, null, action);
- }
-
- @Override
- public TSentryPrivilege grantTablePrivilege(String requestorUserName,
- String roleName, String server, String db, String table, String action, Boolean grantOption)
- throws SentryUserException {
- return grantPrivilege(requestorUserName, roleName, PrivilegeScope.TABLE, server,
- null, db, table, null, action, grantOption);
- }
-
- @Override
- public TSentryPrivilege grantColumnPrivilege(String requestorUserName,
- String roleName, String server, String db, String table, String columnName, String action)
- throws SentryUserException {
- return grantPrivilege(requestorUserName, roleName, PrivilegeScope.COLUMN, server,
- null,
- db, table, columnName, action);
- }
-
- @Override
- public TSentryPrivilege grantColumnPrivilege(String requestorUserName,
- String roleName, String server, String db, String table, String columnName, String action, Boolean grantOption)
- throws SentryUserException {
- return grantPrivilege(requestorUserName, roleName, PrivilegeScope.COLUMN, server,
- null, db, table, columnName, action, grantOption);
- }
-
- @Override
- public Set<TSentryPrivilege> grantColumnsPrivileges(String requestorUserName,
- String roleName, String server, String db, String table, List<String> columnNames, String action)
- throws SentryUserException {
- return grantPrivileges(requestorUserName, roleName, PrivilegeScope.COLUMN, server,
- null,
- db, table, columnNames, action);
- }
-
- @Override
- public Set<TSentryPrivilege> grantColumnsPrivileges(String requestorUserName,
- String roleName, String server, String db, String table, List<String> columnNames, String action, Boolean grantOption)
- throws SentryUserException {
- return grantPrivileges(requestorUserName, roleName, PrivilegeScope.COLUMN,
- server,
- null, db, table, columnNames, action, grantOption);
- }
-
- @Override
- public Set<TSentryPrivilege> grantPrivileges(
- String requestorUserName, String roleName,
- Set<TSentryPrivilege> privileges) throws SentryUserException {
- return grantPrivilegesCore(requestorUserName, roleName, privileges);
- }
-
- @Override
- public TSentryPrivilege grantPrivilege(String requestorUserName, String roleName,
- TSentryPrivilege privilege) throws SentryUserException {
- return grantPrivilegeCore(requestorUserName, roleName, privilege);
- }
-
- private TSentryPrivilege grantPrivilegeCore(String requestorUserName, String roleName,
- TSentryPrivilege privilege) throws SentryUserException {
- Set<TSentryPrivilege> results =
- grantPrivilegesCore(requestorUserName, roleName, ImmutableSet.of(privilege));
- if (results != null && results.size() > 0) {
- return results.iterator().next();
- } else {
- return new TSentryPrivilege();
- }
- }
-
- private Set<TSentryPrivilege> grantPrivilegesCore(String requestorUserName, String roleName,
- Set<TSentryPrivilege> privileges) throws SentryUserException {
- TAlterSentryRoleGrantPrivilegeRequest request = new TAlterSentryRoleGrantPrivilegeRequest();
- request.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT);
- request.setRequestorUserName(requestorUserName);
- request.setRoleName(roleName);
- request.setPrivileges(privileges);
- try {
- TAlterSentryRoleGrantPrivilegeResponse response =
- client.alter_sentry_role_grant_privilege(request);
- Status.throwIfNotOk(response.getStatus());
- return response.getPrivileges();
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- @VisibleForTesting
- public static TSentryAuthorizable setupSentryAuthorizable(
- List<? extends Authorizable> authorizable) {
- TSentryAuthorizable tSentryAuthorizable = new TSentryAuthorizable();
-
- for (Authorizable authzble : authorizable) {
- if (authzble.getTypeName().equalsIgnoreCase(
- DBModelAuthorizable.AuthorizableType.Server.toString())) {
- tSentryAuthorizable.setServer(authzble.getName());
- } else if (authzble.getTypeName().equalsIgnoreCase(
- DBModelAuthorizable.AuthorizableType.URI.toString())) {
- tSentryAuthorizable.setUri(authzble.getName());
- } else if (authzble.getTypeName().equalsIgnoreCase(
- DBModelAuthorizable.AuthorizableType.Db.toString())) {
- tSentryAuthorizable.setDb(authzble.getName());
- } else if (authzble.getTypeName().equalsIgnoreCase(
- DBModelAuthorizable.AuthorizableType.Table.toString())) {
- tSentryAuthorizable.setTable(authzble.getName());
- } else if (authzble.getTypeName().equalsIgnoreCase(
- DBModelAuthorizable.AuthorizableType.Column.toString())) {
- tSentryAuthorizable.setColumn(authzble.getName());
- }
- }
- return tSentryAuthorizable;
- }
-
- private TSentryPrivilege grantPrivilege(String requestorUserName,
- String roleName,
- PrivilegeScope scope, String serverName, String uri, String db,
- String table, String column, String action) throws SentryUserException {
- return grantPrivilege(requestorUserName, roleName, scope, serverName, uri,
- db, table, column, action, false);
- }
-
- private TSentryPrivilege grantPrivilege(String requestorUserName,
-
- String roleName, PrivilegeScope scope, String serverName, String uri, String db, String table,
- String column, String action, Boolean grantOption)
- throws SentryUserException {
- TSentryPrivilege privilege =
- convertToTSentryPrivilege(scope, serverName, uri, db, table, column, action, grantOption);
- return grantPrivilegeCore(requestorUserName, roleName, privilege);
- }
-
- private Set<TSentryPrivilege> grantPrivileges(String requestorUserName,
- String roleName,
- PrivilegeScope scope, String serverName, String uri, String db,
- String table, List<String> columns, String action) throws SentryUserException {
- return grantPrivileges(requestorUserName, roleName, scope, serverName, uri,
- db, table, columns, action, false);
- }
-
- private Set<TSentryPrivilege> grantPrivileges(String requestorUserName,
- String roleName, PrivilegeScope scope, String serverName, String uri, String db, String
- table,
- List<String> columns, String action, Boolean grantOption)
- throws SentryUserException {
- Set<TSentryPrivilege> privileges = convertColumnPrivileges(scope,
- serverName, uri, db, table, columns, action, grantOption);
- return grantPrivilegesCore(requestorUserName, roleName, privileges);
- }
-
- @Override
- public void revokePrivileges(String requestorUserName, String roleName, Set<TSentryPrivilege> privileges) throws SentryUserException {
- this.revokePrivilegesCore(requestorUserName, roleName, privileges);
- }
-
- @Override
- public void revokePrivilege(String requestorUserName, String roleName, TSentryPrivilege privilege) throws SentryUserException {
- this.revokePrivilegeCore(requestorUserName, roleName, privilege);
-
- }
-
- private void revokePrivilegeCore(String requestorUserName, String roleName, TSentryPrivilege privilege) throws SentryUserException {
- this.revokePrivilegesCore(requestorUserName, roleName, ImmutableSet.of(privilege));
- }
-
- private void revokePrivilegesCore(String requestorUserName, String roleName, Set<TSentryPrivilege> privileges) throws SentryUserException {
- TAlterSentryRoleRevokePrivilegeRequest request = new TAlterSentryRoleRevokePrivilegeRequest();
- request.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT);
- request.setRequestorUserName(requestorUserName);
- request.setRoleName(roleName);
- request.setPrivileges(privileges);
- try {
- TAlterSentryRoleRevokePrivilegeResponse response = client.alter_sentry_role_revoke_privilege(
- request);
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- @Override
- public void revokeURIPrivilege(String requestorUserName,
- String roleName, String server, String uri)
- throws SentryUserException {
- revokePrivilege(requestorUserName, roleName,
- PrivilegeScope.URI, server, uri, null, null, null, AccessConstants.ALL);
- }
-
- @Override
- public void revokeURIPrivilege(String requestorUserName,
- String roleName, String server, String uri, Boolean grantOption)
- throws SentryUserException {
- revokePrivilege(requestorUserName, roleName,
- PrivilegeScope.URI, server, uri, null, null, null, AccessConstants.ALL, grantOption);
- }
-
- @Override
- public void revokeServerPrivilege(String requestorUserName,
- String roleName, String server, String action)
- throws SentryUserException {
-
- // "ALL" and "*" should be synonyms for action and need to be unified with revokeServerPrivilege without
- // action explicitly specified.
- if (AccessConstants.ACTION_ALL.equalsIgnoreCase(action) || AccessConstants.ALL.equals(action)) {
- action = AccessConstants.ALL;
- }
-
- revokePrivilege(requestorUserName, roleName,
- PrivilegeScope.SERVER, server, null, null, null, null, action);
- }
-
- public void revokeServerPrivilege(String requestorUserName,
- String roleName, String server, String action, Boolean grantOption)
- throws SentryUserException {
-
- // "ALL" and "*" should be synonyms for action and need to be unified with revokeServerPrivilege without
- // action explicitly specified.
- if (AccessConstants.ACTION_ALL.equalsIgnoreCase(action) || AccessConstants.ALL.equals(action)) {
- action = AccessConstants.ALL;
- }
-
- revokePrivilege(requestorUserName, roleName,
- PrivilegeScope.SERVER, server, null, null, null, null, action, grantOption);
- }
-
- @Deprecated
- /***
- * Should use revokeServerPrivilege(String requestorUserName,
- * String roleName, String server, String action, Boolean grantOption)
- */
- @Override
- public void revokeServerPrivilege(String requestorUserName,
- String roleName, String server, boolean grantOption)
- throws SentryUserException {
- revokePrivilege(requestorUserName, roleName,
- PrivilegeScope.SERVER, server, null, null, null, null, AccessConstants.ALL, grantOption);
- }
-
- @Override
- public void revokeDatabasePrivilege(String requestorUserName,
- String roleName, String server, String db, String action)
- throws SentryUserException {
- revokePrivilege(requestorUserName, roleName,
- PrivilegeScope.DATABASE, server, null, db, null, null, action);
- }
-
- @Override
- public void revokeDatabasePrivilege(String requestorUserName,
- String roleName, String server, String db, String action, Boolean grantOption)
- throws SentryUserException {
- revokePrivilege(requestorUserName, roleName,
- PrivilegeScope.DATABASE, server, null, db, null, null, action, grantOption);
- }
-
- @Override
- public void revokeTablePrivilege(String requestorUserName,
- String roleName, String server, String db, String table, String action)
- throws SentryUserException {
- revokePrivilege(requestorUserName, roleName,
- PrivilegeScope.TABLE, server, null,
- db, table, null, action);
- }
-
- @Override
- public void revokeTablePrivilege(String requestorUserName,
- String roleName, String server, String db, String table, String action, Boolean grantOption)
- throws SentryUserException {
- revokePrivilege(requestorUserName, roleName,
- PrivilegeScope.TABLE, server, null,
- db, table, null, action, grantOption);
- }
-
- @Override
- public void revokeColumnPrivilege(String requestorUserName, String roleName,
- String server, String db, String table, String columnName, String action)
- throws SentryUserException {
- ImmutableList.Builder<String> listBuilder = ImmutableList.builder();
- listBuilder.add(columnName);
- revokePrivilege(requestorUserName, roleName,
- PrivilegeScope.COLUMN, server, null,
- db, table, listBuilder.build(), action);
- }
-
- @Override
- public void revokeColumnPrivilege(String requestorUserName, String roleName,
- String server, String db, String table, String columnName, String action, Boolean grantOption)
- throws SentryUserException {
- ImmutableList.Builder<String> listBuilder = ImmutableList.builder();
- listBuilder.add(columnName);
- revokePrivilege(requestorUserName, roleName,
- PrivilegeScope.COLUMN, server, null,
- db, table, listBuilder.build(), action, grantOption);
- }
-
- @Override
- public void revokeColumnsPrivilege(String requestorUserName, String roleName,
- String server, String db, String table, List<String> columns, String action)
- throws SentryUserException {
- revokePrivilege(requestorUserName, roleName,
- PrivilegeScope.COLUMN, server, null,
- db, table, columns, action);
- }
-
- @Override
- public void revokeColumnsPrivilege(String requestorUserName, String roleName,
- String server, String db, String table, List<String> columns, String action, Boolean grantOption)
- throws SentryUserException {
- revokePrivilege(requestorUserName, roleName,
- PrivilegeScope.COLUMN, server, null,
- db, table, columns, action, grantOption);
- }
-
- private void revokePrivilege(String requestorUserName,
- String roleName, PrivilegeScope scope, String serverName, String uri,
- String db, String table, List<String> columns, String action)
- throws SentryUserException {
- this.revokePrivilege(requestorUserName, roleName, scope, serverName, uri, db, table, columns, action, false);
- }
-
- private void revokePrivilege(String requestorUserName, String roleName,
- PrivilegeScope scope, String serverName, String uri, String db, String table, List<String> columns,
- String action, Boolean grantOption)
- throws SentryUserException {
- Set<TSentryPrivilege> privileges = convertColumnPrivileges(scope,
- serverName, uri, db, table, columns, action, grantOption);
- this.revokePrivilegesCore(requestorUserName, roleName, privileges);
- }
-
- private Set<TSentryPrivilege> convertColumnPrivileges(
- PrivilegeScope scope, String serverName, String uri, String db, String
- table, List<String> columns,
- String action, Boolean grantOption) {
- ImmutableSet.Builder<TSentryPrivilege> setBuilder = ImmutableSet.builder();
- if (columns == null || columns.isEmpty()) {
- TSentryPrivilege privilege = new TSentryPrivilege();
- privilege.setPrivilegeScope(scope.toString());
- privilege.setServerName(serverName);
- privilege.setURI(uri);
- privilege.setDbName(db);
- privilege.setTableName(table);
- privilege.setColumnName(null);
- privilege.setAction(action);
- privilege.setCreateTime(System.currentTimeMillis());
- privilege.setGrantOption(convertTSentryGrantOption(grantOption));
- setBuilder.add(privilege);
- } else {
- for (String column : columns) {
- TSentryPrivilege privilege = new TSentryPrivilege();
- privilege.setPrivilegeScope(scope.toString());
- privilege.setServerName(serverName);
- privilege.setURI(uri);
- privilege.setDbName(db);
- privilege.setTableName(table);
- privilege.setColumnName(column);
- privilege.setAction(action);
- privilege.setCreateTime(System.currentTimeMillis());
- privilege.setGrantOption(convertTSentryGrantOption(grantOption));
- setBuilder.add(privilege);
- }
- }
- return setBuilder.build();
- }
-
- private TSentryPrivilege convertToTSentryPrivilege(
- PrivilegeScope scope, String serverName, String uri, String db, String table, String
- column,
- String action, Boolean grantOption) {
- TSentryPrivilege privilege = new TSentryPrivilege();
- privilege.setPrivilegeScope(scope.toString());
- privilege.setServerName(serverName);
- privilege.setURI(uri);
- privilege.setDbName(db);
- privilege.setTableName(table);
- privilege.setColumnName(column);
- privilege.setAction(action);
- privilege.setCreateTime(System.currentTimeMillis());
- privilege.setGrantOption(convertTSentryGrantOption(grantOption));
- return privilege;
- }
-
- private TSentryGrantOption convertTSentryGrantOption(Boolean grantOption) {
- if (grantOption == null) {
- return TSentryGrantOption.UNSET;
- } else if (grantOption.equals(true)) {
- return TSentryGrantOption.TRUE;
- } else if (grantOption.equals(false)) {
- return TSentryGrantOption.FALSE;
- }
- return TSentryGrantOption.FALSE;
- }
-
- @Override
- public Set<String> listPrivilegesForProvider
- (Set<String> groups, Set<String> users,
- ActiveRoleSet roleSet, Authorizable... authorizable) throws SentryUserException {
- TSentryActiveRoleSet thriftRoleSet = new TSentryActiveRoleSet(roleSet.isAll(), roleSet.getRoles());
- TListSentryPrivilegesForProviderRequest request =
- new TListSentryPrivilegesForProviderRequest(ThriftConstants.
- TSENTRY_SERVICE_VERSION_CURRENT, groups, thriftRoleSet);
- if (authorizable != null && authorizable.length > 0) {
- TSentryAuthorizable tSentryAuthorizable = setupSentryAuthorizable(Lists
- .newArrayList(authorizable));
- request.setAuthorizableHierarchy(tSentryAuthorizable);
- }
- if (users != null) {
- request.setUsers(users);
- }
- try {
- TListSentryPrivilegesForProviderResponse response = client.list_sentry_privileges_for_provider(request);
- Status.throwIfNotOk(response.getStatus());
- return response.getPrivileges();
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- @Override
- public void grantRoleToGroup(String requestorUserName,
- String groupName, String roleName)
- throws SentryUserException {
- grantRoleToGroups(requestorUserName, roleName, Sets.newHashSet(groupName));
- }
-
- @Override
- public void revokeRoleFromGroup(String requestorUserName,
- String groupName, String roleName)
- throws SentryUserException {
- revokeRoleFromGroups(requestorUserName, roleName, Sets.newHashSet(groupName));
- }
-
- @Override
- public void grantRoleToGroups(String requestorUserName,
- String roleName, Set<String> groups)
- throws SentryUserException {
- TAlterSentryRoleAddGroupsRequest request = new TAlterSentryRoleAddGroupsRequest(
- ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT, requestorUserName,
- roleName, convert2TGroups(groups));
- try {
- TAlterSentryRoleAddGroupsResponse response = client.alter_sentry_role_add_groups(request);
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- @Override
- public void revokeRoleFromGroups(String requestorUserName,
- String roleName, Set<String> groups)
- throws SentryUserException {
- TAlterSentryRoleDeleteGroupsRequest request = new TAlterSentryRoleDeleteGroupsRequest(
- ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT, requestorUserName,
- roleName, convert2TGroups(groups));
- try {
- TAlterSentryRoleDeleteGroupsResponse response = client.alter_sentry_role_delete_groups(request);
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- @Override
- public void grantRoleToUser(String requestorUserName, String userName,
- String roleName) throws SentryUserException {
- grantRoleToUsers(requestorUserName, roleName, Sets.newHashSet(userName));
- }
-
- @Override
- public void revokeRoleFromUser(String requestorUserName, String userName,
- String roleName) throws SentryUserException {
- revokeRoleFromUsers(requestorUserName, roleName, Sets.newHashSet(userName));
- }
-
- @Override
- public void grantRoleToUsers(String requestorUserName, String roleName,
- Set<String> users) throws SentryUserException {
- TAlterSentryRoleAddUsersRequest request = new TAlterSentryRoleAddUsersRequest(
- ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT, requestorUserName, roleName, users);
- try {
- TAlterSentryRoleAddUsersResponse response = client.alter_sentry_role_add_users(request);
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- @Override
- public void revokeRoleFromUsers(String requestorUserName, String roleName,
- Set<String> users) throws SentryUserException {
- TAlterSentryRoleDeleteUsersRequest request = new TAlterSentryRoleDeleteUsersRequest(
- ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT, requestorUserName, roleName, users);
- try {
- TAlterSentryRoleDeleteUsersResponse response = client.alter_sentry_role_delete_users(request);
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- private Set<TSentryGroup> convert2TGroups(Set<String> groups) {
- Set<TSentryGroup> tGroups = Sets.newHashSet();
- if (groups != null) {
- for (String groupName : groups) {
- tGroups.add(new TSentryGroup(groupName));
- }
- }
- return tGroups;
- }
-
- @Override
- public void dropPrivileges(String requestorUserName,
- List<? extends Authorizable> authorizableObjects)
- throws SentryUserException {
- TSentryAuthorizable tSentryAuthorizable = setupSentryAuthorizable(authorizableObjects);
-
- TDropPrivilegesRequest request = new TDropPrivilegesRequest(
- ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT, requestorUserName,
- tSentryAuthorizable);
- try {
- TDropPrivilegesResponse response = client.drop_sentry_privilege(request);
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- @Override
- public void renamePrivileges(String requestorUserName,
- List<? extends Authorizable> oldAuthorizables,
- List<? extends Authorizable> newAuthorizables) throws SentryUserException {
- TSentryAuthorizable tOldSentryAuthorizable = setupSentryAuthorizable(oldAuthorizables);
- TSentryAuthorizable tNewSentryAuthorizable = setupSentryAuthorizable(newAuthorizables);
-
- TRenamePrivilegesRequest request = new TRenamePrivilegesRequest(
- ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT, requestorUserName,
- tOldSentryAuthorizable, tNewSentryAuthorizable);
- try {
- TRenamePrivilegesResponse response = client
- .rename_sentry_privilege(request);
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- @Override
- public Map<TSentryAuthorizable, TSentryPrivilegeMap> listPrivilegsbyAuthorizable
- (
- String requestorUserName,
- Set<List<? extends Authorizable>> authorizables, Set<String> groups,
- ActiveRoleSet roleSet) throws SentryUserException {
- Set<TSentryAuthorizable> authSet = Sets.newTreeSet();
-
- for (List<? extends Authorizable> authorizableHierarchy : authorizables) {
- authSet.add(setupSentryAuthorizable(authorizableHierarchy));
- }
- TListSentryPrivilegesByAuthRequest request = new TListSentryPrivilegesByAuthRequest(
- ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT, requestorUserName,
- authSet);
- if (groups != null) {
- request.setGroups(groups);
- }
- if (roleSet != null) {
- request.setRoleSet(new TSentryActiveRoleSet(roleSet.isAll(), roleSet.getRoles()));
- }
-
- try {
- TListSentryPrivilegesByAuthResponse response = client
- .list_sentry_privileges_by_authorizable(request);
- Status.throwIfNotOk(response.getStatus());
- return response.getPrivilegesMapByAuth();
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- /**
- * Returns the configuration value in the sentry server associated with
- * propertyName, or if propertyName does not exist, the defaultValue.
- * There is no "requestorUserName" because this is regarded as an
- * internal interface.
- *
- * @param propertyName Config attribute to search for
- * @param defaultValue String to return if not found
- * @return The value of the propertyName
- * @throws SentryUserException
- */
-
- @Override
- public String getConfigValue(String propertyName, String defaultValue)
- throws SentryUserException {
- TSentryConfigValueRequest request = new TSentryConfigValueRequest(
- ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT, propertyName);
- if (defaultValue != null) {
- request.setDefaultValue(defaultValue);
- }
- try {
- TSentryConfigValueResponse response = client.get_sentry_config_value(request);
- Status.throwIfNotOk(response.getStatus());
- return response.getValue();
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- /**
- * Import the sentry mapping data, convert the mapping data from map structure to
- * TSentryMappingData, and call the import API.
- *
- * @param policyFileMappingData Include 2 maps to save the mapping data, the following is the example of the data
- * structure:
- * for the following mapping data:
- * group1=role1,role2
- * group2=role2,role3
- * role1=server=server1->db=db1
- * role2=server=server1->db=db1->table=tbl1,server=server1->db=db1->table=tbl2
- * role3=server=server1->url=hdfs://localhost/path
- * <p>
- * The policyFileMappingData will be inputed as:
- * {
- * groups={[group1={role1, role2}], group2=[role2, role3]},
- * roles={role1=[server=server1->db=db1],
- * role2=[server=server1->db=db1->table=tbl1,server=server1->db=db1->table=tbl2],
- * role3=[server=server1->url=hdfs://localhost/path]
- * }
- * }
- * @param requestorUserName The name of the request user
- */
- @Override
- public void importPolicy
- (Map<String, Map<String, Set<String>>> policyFileMappingData,
- String requestorUserName, boolean isOverwriteRole)
- throws SentryUserException {
- try {
- TSentryMappingData tSentryMappingData = new TSentryMappingData();
- // convert the mapping data for [group,role] from map structure to
- // TSentryMappingData.GroupRolesMap
- tSentryMappingData.setGroupRolesMap(policyFileMappingData.get(PolicyFileConstants.GROUPS));
- tSentryMappingData.setUserRolesMap(policyFileMappingData.get(PolicyFileConstants.USER_ROLES));
- // convert the mapping data for [role,privilege] from map structure to
- // TSentryMappingData.RolePrivilegesMap
- tSentryMappingData
- .setRolePrivilegesMap(convertRolePrivilegesMapForSentryDB(policyFileMappingData
- .get(PolicyFileConstants.ROLES)));
- TSentryImportMappingDataRequest request = new TSentryImportMappingDataRequest(
- ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT, requestorUserName, isOverwriteRole,
- tSentryMappingData);
- TSentryImportMappingDataResponse response = client.import_sentry_mapping_data(request);
- Status.throwIfNotOk(response.getStatus());
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- // convert the mapping data for [role,privilege] from map structure to
- // TSentryMappingData.RolePrivilegesMap
- private Map<String, Set<TSentryPrivilege>> convertRolePrivilegesMapForSentryDB(
- Map<String, Set<String>> rolePrivilegesMap) {
- Map<String, Set<TSentryPrivilege>> rolePrivilegesMapResult = Maps.newHashMap();
- if (rolePrivilegesMap != null) {
- for (Map.Entry<String, Set<String>> entry : rolePrivilegesMap.entrySet()) {
- Set<TSentryPrivilege> tempTSentryPrivileges = Sets.newHashSet();
- Set<String> tempPrivileges = entry.getValue();
- for (String tempPrivilege : tempPrivileges) {
- tempTSentryPrivileges.add(SentryServiceUtil.convertToTSentryPrivilege(tempPrivilege));
- }
- rolePrivilegesMapResult.put(entry.getKey(), tempTSentryPrivileges);
- }
- }
- return rolePrivilegesMapResult;
- }
-
- // export the sentry mapping data with map structure
- @Override
- public Map<String, Map<String, Set<String>>> exportPolicy(String
- requestorUserName,
- String objectPath) throws SentryUserException {
- TSentryExportMappingDataRequest request = new TSentryExportMappingDataRequest(
- ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT, requestorUserName);
- request.setObjectPath(objectPath);
- try {
- TSentryExportMappingDataResponse response = client.export_sentry_mapping_data(request);
- Status.throwIfNotOk(response.getStatus());
- TSentryMappingData tSentryMappingData = response.getMappingData();
- Map<String, Map<String, Set<String>>> resultMap = Maps.newHashMap();
- resultMap.put(PolicyFileConstants.USER_ROLES, tSentryMappingData.getUserRolesMap());
- resultMap.put(PolicyFileConstants.GROUPS, tSentryMappingData.getGroupRolesMap());
- resultMap.put(PolicyFileConstants.ROLES, convertRolePrivilegesMapForPolicyFile(tSentryMappingData.getRolePrivilegesMap()));
- return resultMap;
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-
- // convert the mapping data for [roleName,privilege] from TSentryMappingData.RolePrivilegesMap to
- // map structure
- private Map<String, Set<String>> convertRolePrivilegesMapForPolicyFile(
- Map<String, Set<TSentryPrivilege>> rolePrivilegesMap) {
- Map<String, Set<String>> rolePrivilegesMapForFile = Maps.newHashMap();
- if (rolePrivilegesMap != null) {
- for (Map.Entry<String, Set<TSentryPrivilege>> entry : rolePrivilegesMap.entrySet()) {
- Set<TSentryPrivilege> tempSentryPrivileges = entry.getValue();
- Set<String> tempStrPrivileges = Sets.newHashSet();
- for (TSentryPrivilege tSentryPrivilege : tempSentryPrivileges) {
- // convert TSentryPrivilege to privilege in string
- String privilegeStr = SentryServiceUtil.convertTSentryPrivilegeToStr(tSentryPrivilege);
- if (!StringUtils.isEmpty(privilegeStr)) {
- tempStrPrivileges.add(privilegeStr);
- }
- }
- rolePrivilegesMapForFile.put(entry.getKey(), tempStrPrivileges);
- }
- }
- return rolePrivilegesMapForFile;
- }
-
- @Override
- public void close() {
- done();
- }
-
- @Override
- public void done() {
- if (transport != null) {
- transportPool.returnTransport(transport);
- transport = null;
- }
- }
-
- @Override
- public void invalidate() {
- if (transport != null) {
- transportPool.invalidateTransport(transport);
- transport = null;
- }
- }
-
- public long syncNotifications(long id) throws SentryUserException {
- TSentrySyncIDRequest request =
- new TSentrySyncIDRequest(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT, id);
-
- try {
- TSentrySyncIDResponse response = client.sentry_sync_notifications(request);
- Status.throwIfNotOk(response.getStatus());
- return response.getId();
- } catch (TException e) {
- throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
- }
- }
-}
\ No newline at end of file
[20/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreProcessor.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreProcessor.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreProcessor.java
deleted file mode 100644
index 2fbad36..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreProcessor.java
+++ /dev/null
@@ -1,1238 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeoutException;
-import java.util.regex.Pattern;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.sentry.core.common.exception.SentryUserException;
-import org.apache.sentry.core.common.exception.SentrySiteConfigurationException;
-import org.apache.sentry.core.model.db.AccessConstants;
-import org.apache.sentry.provider.common.GroupMappingService;
-import org.apache.sentry.core.common.utils.PolicyFileConstants;
-import org.apache.sentry.core.common.exception.SentryGroupNotFoundException;
-import org.apache.sentry.core.common.exception.SentryAccessDeniedException;
-import org.apache.sentry.core.common.exception.SentryAlreadyExistsException;
-import org.apache.sentry.core.common.exception.SentryInvalidInputException;
-import org.apache.sentry.core.common.exception.SentryNoSuchObjectException;
-import org.apache.sentry.provider.db.SentryPolicyStorePlugin;
-import org.apache.sentry.provider.db.SentryPolicyStorePlugin.SentryPluginException;
-import org.apache.sentry.core.common.exception.SentryThriftAPIMismatchException;
-import org.apache.sentry.provider.db.log.entity.JsonLogEntity;
-import org.apache.sentry.provider.db.log.entity.JsonLogEntityFactory;
-import org.apache.sentry.provider.db.log.util.Constants;
-import org.apache.sentry.provider.db.service.persistent.SentryStore;
-import org.apache.sentry.core.common.utils.PolicyStoreConstants.PolicyStoreServerConfig;
-import org.apache.sentry.provider.db.service.thrift.validator.GrantPrivilegeRequestValidator;
-import org.apache.sentry.provider.db.service.thrift.validator.RevokePrivilegeRequestValidator;
-import org.apache.sentry.service.thrift.SentryServiceUtil;
-import org.apache.sentry.service.thrift.ServiceConstants;
-import org.apache.sentry.service.thrift.ServiceConstants.ConfUtilties;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
-import org.apache.sentry.service.thrift.ServiceConstants.ThriftConstants;
-import org.apache.sentry.service.thrift.Status;
-import org.apache.sentry.service.thrift.TSentryResponseStatus;
-import org.apache.thrift.TException;
-import org.apache.log4j.Logger;
-
-import com.codahale.metrics.Timer;
-import static com.codahale.metrics.MetricRegistry.name;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-import static org.apache.sentry.hdfs.Updateable.Update;
-
-@SuppressWarnings("unused")
-public class SentryPolicyStoreProcessor implements SentryPolicyService.Iface {
- private static final Logger LOGGER = Logger.getLogger(SentryPolicyStoreProcessor.class);
- private static final Logger AUDIT_LOGGER = Logger.getLogger(Constants.AUDIT_LOGGER_NAME);
-
- static final String SENTRY_POLICY_SERVICE_NAME = "SentryPolicyService";
-
- private final String name;
- private final Configuration conf;
- private final SentryStore sentryStore;
- private final NotificationHandlerInvoker notificationHandlerInvoker;
- private final ImmutableSet<String> adminGroups;
- private SentryMetrics sentryMetrics;
- private final Timer hmsWaitTimer =
- SentryMetrics.getInstance().
- getTimer(name(SentryPolicyStoreProcessor.class, "hms", "wait"));
-
- private List<SentryPolicyStorePlugin> sentryPlugins = new LinkedList<SentryPolicyStorePlugin>();
-
- SentryPolicyStoreProcessor(String name,
- Configuration conf, SentryStore store) throws Exception {
- super();
- this.name = name;
- this.conf = conf;
- this.sentryStore = store;
- this.notificationHandlerInvoker = new NotificationHandlerInvoker(conf,
- createHandlers(conf));
- adminGroups = ImmutableSet.copyOf(toTrimedLower(Sets.newHashSet(conf.getStrings(
- ServerConfig.ADMIN_GROUPS, new String[]{}))));
- Iterable<String> pluginClasses = ConfUtilties.CLASS_SPLITTER
- .split(conf.get(ServerConfig.SENTRY_POLICY_STORE_PLUGINS,
- ServerConfig.SENTRY_POLICY_STORE_PLUGINS_DEFAULT).trim());
- for (String pluginClassStr : pluginClasses) {
- Class<?> clazz = conf.getClassByName(pluginClassStr);
- if (!SentryPolicyStorePlugin.class.isAssignableFrom(clazz)) {
- throw new IllegalArgumentException("Sentry Plugin ["
- + pluginClassStr + "] is not a "
- + SentryPolicyStorePlugin.class.getName());
- }
- SentryPolicyStorePlugin plugin = (SentryPolicyStorePlugin)clazz.newInstance();
- plugin.initialize(conf, sentryStore);
- sentryPlugins.add(plugin);
- }
- initMetrics();
- }
-
- private void initMetrics() {
- sentryMetrics = SentryMetrics.getInstance();
- sentryMetrics.addSentryStoreGauges(sentryStore);
- sentryMetrics.initReporting(conf);
- }
-
- public void stop() {
- sentryStore.stop();
- }
-
- public void registerPlugin(SentryPolicyStorePlugin plugin) throws SentryPluginException {
- plugin.initialize(conf, sentryStore);
- sentryPlugins.add(plugin);
- }
-
- @VisibleForTesting
- static List<NotificationHandler> createHandlers(Configuration conf)
- throws SentrySiteConfigurationException {
- List<NotificationHandler> handlers = Lists.newArrayList();
- Iterable<String> notificationHandlers = Splitter.onPattern("[\\s,]").trimResults()
- .omitEmptyStrings().split(conf.get(PolicyStoreServerConfig.NOTIFICATION_HANDLERS, ""));
- for (String notificationHandler : notificationHandlers) {
- Class<?> clazz = null;
- try {
- clazz = Class.forName(notificationHandler);
- if (!NotificationHandler.class.isAssignableFrom(clazz)) {
- throw new SentrySiteConfigurationException("Class " + notificationHandler + " is not a " +
- NotificationHandler.class.getName());
- }
- } catch (ClassNotFoundException e) {
- throw new SentrySiteConfigurationException("Value " + notificationHandler +
- " is not a class", e);
- }
- Preconditions.checkNotNull(clazz, "Error class cannot be null");
- try {
- Constructor<?> constructor = clazz.getConstructor(Configuration.class);
- handlers.add((NotificationHandler)constructor.newInstance(conf));
- } catch (Exception e) {
- throw new SentrySiteConfigurationException("Error attempting to create " + notificationHandler, e);
- }
- }
- return handlers;
- }
-
- @VisibleForTesting
- public Configuration getSentryStoreConf() {
- return conf;
- }
-
- private static Set<String> toTrimedLower(Set<String> s) {
- Set<String> result = Sets.newHashSet();
- for (String v : s) {
- result.add(v.trim().toLowerCase());
- }
- return result;
- }
-
- private boolean inAdminGroups(Set<String> requestorGroups) {
- Set<String> trimmedRequestorGroups = toTrimedLower(requestorGroups);
- return !Sets.intersection(adminGroups, trimmedRequestorGroups).isEmpty();
- }
-
- private void authorize(String requestorUser, Set<String> requestorGroups)
- throws SentryAccessDeniedException {
- if (!inAdminGroups(requestorGroups)) {
- String msg = "User: " + requestorUser + " is part of " + requestorGroups +
- " which does not, intersect admin groups " + adminGroups;
- LOGGER.warn(msg);
- throw new SentryAccessDeniedException("Access denied to " + requestorUser);
- }
- }
-
- @Override
- public TCreateSentryRoleResponse create_sentry_role(
- TCreateSentryRoleRequest request) throws TException {
- final Timer.Context timerContext = sentryMetrics.createRoleTimer.time();
- TCreateSentryRoleResponse response = new TCreateSentryRoleResponse();
- try {
- validateClientVersion(request.getProtocol_version());
- authorize(request.getRequestorUserName(),
- getRequestorGroups(request.getRequestorUserName()));
- sentryStore.createSentryRole(request.getRoleName());
- response.setStatus(Status.OK());
- notificationHandlerInvoker.create_sentry_role(request, response);
- } catch (SentryAlreadyExistsException e) {
- String msg = "Role: " + request + " already exists.";
- LOGGER.error(msg, e);
- response.setStatus(Status.AlreadyExists(e.getMessage(), e));
- } catch (SentryAccessDeniedException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryGroupNotFoundException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryThriftAPIMismatchException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
- } catch (Exception e) {
- String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
- LOGGER.error(msg, e);
- response.setStatus(Status.RuntimeError(msg, e));
- } finally {
- timerContext.stop();
- }
-
- try {
- AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
- .createJsonLogEntity(request, response, conf).toJsonFormatLog());
- } catch (Exception e) {
- // if any exception, log the exception.
- String msg = "Error creating audit log for create role: " + e.getMessage();
- LOGGER.error(msg, e);
- }
- return response;
- }
-
- @Override
- public TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege
- (TAlterSentryRoleGrantPrivilegeRequest request) throws TException {
- final Timer.Context timerContext = sentryMetrics.grantTimer.time();
- TAlterSentryRoleGrantPrivilegeResponse response = new TAlterSentryRoleGrantPrivilegeResponse();
- try {
- validateClientVersion(request.getProtocol_version());
- // There should only one field be set
- if ( !(request.isSetPrivileges()^request.isSetPrivilege()) ) {
- throw new SentryUserException("SENTRY API version is not right!");
- }
- // Maintain compatibility for old API: Set privilege field to privileges field
- if (request.isSetPrivilege()) {
- request.setPrivileges(Sets.newHashSet(request.getPrivilege()));
- }
- // TODO: now only has SentryPlugin. Once add more SentryPolicyStorePlugins,
- // TODO: need to differentiate the updates for different Plugins.
- Preconditions.checkState(sentryPlugins.size() <= 1);
- Map<TSentryPrivilege, Update> privilegesUpdateMap = new HashMap<>();
- for (SentryPolicyStorePlugin plugin : sentryPlugins) {
- plugin.onAlterSentryRoleGrantPrivilege(request, privilegesUpdateMap);
- }
-
- if (!privilegesUpdateMap.isEmpty()) {
- sentryStore.alterSentryRoleGrantPrivileges(request.getRequestorUserName(),
- request.getRoleName(), request.getPrivileges(), privilegesUpdateMap);
- } else {
- sentryStore.alterSentryRoleGrantPrivileges(request.getRequestorUserName(),
- request.getRoleName(), request.getPrivileges());
- }
- GrantPrivilegeRequestValidator.validate(request);
- response.setStatus(Status.OK());
- response.setPrivileges(request.getPrivileges());
- // Maintain compatibility for old API: Set privilege field to response
- if (response.isSetPrivileges() && response.getPrivileges().size() == 1) {
- response.setPrivilege(response.getPrivileges().iterator().next());
- }
- notificationHandlerInvoker.alter_sentry_role_grant_privilege(request,
- response);
- } catch (SentryNoSuchObjectException e) {
- String msg = "Role: " + request.getRoleName() + " doesn't exist";
- LOGGER.error(msg, e);
- response.setStatus(Status.NoSuchObject(msg, e));
- } catch (SentryInvalidInputException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.InvalidInput(e.getMessage(), e));
- } catch (SentryAccessDeniedException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryGroupNotFoundException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryThriftAPIMismatchException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
- } catch (Exception e) {
- String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
- LOGGER.error(msg, e);
- response.setStatus(Status.RuntimeError(msg, e));
- } finally {
- timerContext.stop();
- }
-
- try {
- Set<JsonLogEntity> jsonLogEntitys = JsonLogEntityFactory.getInstance().createJsonLogEntitys(
- request, response, conf);
- for (JsonLogEntity jsonLogEntity : jsonLogEntitys) {
- AUDIT_LOGGER.info(jsonLogEntity.toJsonFormatLog());
- }
- } catch (Exception e) {
- // if any exception, log the exception.
- String msg = "Error creating audit log for grant privilege to role: " + e.getMessage();
- LOGGER.error(msg, e);
- }
- return response;
- }
-
- @Override
- public TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege
- (TAlterSentryRoleRevokePrivilegeRequest request) throws TException {
- final Timer.Context timerContext = sentryMetrics.revokeTimer.time();
- TAlterSentryRoleRevokePrivilegeResponse response = new TAlterSentryRoleRevokePrivilegeResponse();
- try {
- validateClientVersion(request.getProtocol_version());
- // There should only one field be set
- if ( !(request.isSetPrivileges()^request.isSetPrivilege()) ) {
- throw new SentryUserException("SENTRY API version is not right!");
- }
- // Maintain compatibility for old API: Set privilege field to privileges field
- if (request.isSetPrivilege()) {
- request.setPrivileges(Sets.newHashSet(request.getPrivilege()));
- }
-
- // TODO: now only has SentryPlugin. Once add more SentryPolicyStorePlugins,
- // TODO: need to differentiate the updates for different Plugins.
- Preconditions.checkState(sentryPlugins.size() <= 1);
- Map<TSentryPrivilege, Update> privilegesUpdateMap = new HashMap<>();
- for (SentryPolicyStorePlugin plugin : sentryPlugins) {
- plugin.onAlterSentryRoleRevokePrivilege(request, privilegesUpdateMap);
- }
-
- if (!privilegesUpdateMap.isEmpty()) {
- sentryStore.alterSentryRoleRevokePrivileges(request.getRequestorUserName(),
- request.getRoleName(), request.getPrivileges(), privilegesUpdateMap);
- } else {
- sentryStore.alterSentryRoleRevokePrivileges(request.getRequestorUserName(),
- request.getRoleName(), request.getPrivileges());
- }
- RevokePrivilegeRequestValidator.validate(request);
- response.setStatus(Status.OK());
- notificationHandlerInvoker.alter_sentry_role_revoke_privilege(request,
- response);
- } catch (SentryNoSuchObjectException e) {
- StringBuilder msg = new StringBuilder();
- if (request.getPrivileges().size() > 0) {
- for (TSentryPrivilege privilege : request.getPrivileges()) {
- msg.append("Privilege: [server=");
- msg.append(privilege.getServerName());
- msg.append(",db=");
- msg.append(privilege.getDbName());
- msg.append(",table=");
- msg.append(privilege.getTableName());
- msg.append(",URI=");
- msg.append(privilege.getURI());
- msg.append(",action=");
- msg.append(privilege.getAction());
- msg.append("] ");
- }
- msg.append("doesn't exist.");
- }
- LOGGER.error(msg.toString(), e);
- response.setStatus(Status.NoSuchObject(msg.toString(), e));
- } catch (SentryInvalidInputException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.InvalidInput(e.getMessage(), e));
- } catch (SentryAccessDeniedException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryGroupNotFoundException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryThriftAPIMismatchException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
- } catch (Exception e) {
- String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
- LOGGER.error(msg, e);
- response.setStatus(Status.RuntimeError(msg, e));
- } finally {
- timerContext.stop();
- }
-
- try {
- Set<JsonLogEntity> jsonLogEntitys = JsonLogEntityFactory.getInstance().createJsonLogEntitys(
- request, response, conf);
- for (JsonLogEntity jsonLogEntity : jsonLogEntitys) {
- AUDIT_LOGGER.info(jsonLogEntity.toJsonFormatLog());
- }
- } catch (Exception e) {
- // if any exception, log the exception.
- String msg = "Error creating audit log for revoke privilege from role: " + e.getMessage();
- LOGGER.error(msg, e);
- }
- return response;
- }
-
- @Override
- public TDropSentryRoleResponse drop_sentry_role(
- TDropSentryRoleRequest request) throws TException {
- final Timer.Context timerContext = sentryMetrics.dropRoleTimer.time();
- TDropSentryRoleResponse response = new TDropSentryRoleResponse();
- TSentryResponseStatus status;
- try {
- validateClientVersion(request.getProtocol_version());
- authorize(request.getRequestorUserName(),
- getRequestorGroups(request.getRequestorUserName()));
-
- // TODO: now only has SentryPlugin. Once add more SentryPolicyStorePlugins,
- // TODO: need to differentiate the updates for different Plugins.
- Preconditions.checkState(sentryPlugins.size() <= 1);
- Update update = null;
- for (SentryPolicyStorePlugin plugin : sentryPlugins) {
- update = plugin.onDropSentryRole(request);
- }
-
- if (update != null) {
- sentryStore.dropSentryRole(request.getRoleName(), update);
- } else {
- sentryStore.dropSentryRole(request.getRoleName());
- }
- response.setStatus(Status.OK());
- notificationHandlerInvoker.drop_sentry_role(request, response);
- } catch (SentryNoSuchObjectException e) {
- String msg = "Role :" + request + " doesn't exist";
- LOGGER.error(msg, e);
- response.setStatus(Status.NoSuchObject(msg, e));
- } catch (SentryAccessDeniedException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryGroupNotFoundException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryThriftAPIMismatchException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
- } catch (Exception e) {
- String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
- LOGGER.error(msg, e);
- response.setStatus(Status.RuntimeError(msg, e));
- } finally {
- timerContext.stop();
- }
-
- try {
- AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
- .createJsonLogEntity(request, response, conf).toJsonFormatLog());
- } catch (Exception e) {
- // if any exception, log the exception.
- String msg = "Error creating audit log for drop role: " + e.getMessage();
- LOGGER.error(msg, e);
- }
- return response;
- }
-
- @Override
- public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(
- TAlterSentryRoleAddGroupsRequest request) throws TException {
- final Timer.Context timerContext = sentryMetrics.grantRoleTimer.time();
- TAlterSentryRoleAddGroupsResponse response = new TAlterSentryRoleAddGroupsResponse();
- try {
- validateClientVersion(request.getProtocol_version());
- authorize(request.getRequestorUserName(),
- getRequestorGroups(request.getRequestorUserName()));
-
- // TODO: now only has SentryPlugin. Once add more SentryPolicyStorePlugins,
- // TODO: need to differentiate the updates for different Plugins.
- Preconditions.checkState(sentryPlugins.size() <= 1);
- Update update = null;
- for (SentryPolicyStorePlugin plugin : sentryPlugins) {
- update = plugin.onAlterSentryRoleAddGroups(request);
- }
- if (update != null) {
- sentryStore.alterSentryRoleAddGroups(request.getRequestorUserName(),
- request.getRoleName(), request.getGroups(), update);
- } else {
- sentryStore.alterSentryRoleAddGroups(request.getRequestorUserName(),
- request.getRoleName(), request.getGroups());
- }
- response.setStatus(Status.OK());
- notificationHandlerInvoker.alter_sentry_role_add_groups(request,
- response);
- } catch (SentryNoSuchObjectException e) {
- String msg = "Role: " + request + " doesn't exist";
- LOGGER.error(msg, e);
- response.setStatus(Status.NoSuchObject(msg, e));
- } catch (SentryAccessDeniedException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryGroupNotFoundException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryThriftAPIMismatchException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
- } catch (Exception e) {
- String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
- LOGGER.error(msg, e);
- response.setStatus(Status.RuntimeError(msg, e));
- } finally {
- timerContext.stop();
- }
-
- try {
- AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
- .createJsonLogEntity(request, response, conf).toJsonFormatLog());
- } catch (Exception e) {
- // if any exception, log the exception.
- String msg = "Error creating audit log for add role to group: " + e.getMessage();
- LOGGER.error(msg, e);
- }
- return response;
- }
-
- @Override
- public TAlterSentryRoleAddUsersResponse alter_sentry_role_add_users(
- TAlterSentryRoleAddUsersRequest request) throws TException {
- final Timer.Context timerContext = sentryMetrics.grantRoleTimer.time();
- TAlterSentryRoleAddUsersResponse response = new TAlterSentryRoleAddUsersResponse();
- try {
- validateClientVersion(request.getProtocol_version());
- authorize(request.getRequestorUserName(), getRequestorGroups(request.getRequestorUserName()));
- sentryStore.alterSentryRoleAddUsers(request.getRoleName(), request.getUsers());
- response.setStatus(Status.OK());
- notificationHandlerInvoker.alter_sentry_role_add_users(request, response);
- } catch (SentryNoSuchObjectException e) {
- String msg = "Role: " + request + " does not exist.";
- LOGGER.error(msg, e);
- response.setStatus(Status.NoSuchObject(msg, e));
- } catch (SentryAccessDeniedException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryGroupNotFoundException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryThriftAPIMismatchException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
- } catch (Exception e) {
- String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
- LOGGER.error(msg, e);
- response.setStatus(Status.RuntimeError(msg, e));
- } finally {
- timerContext.stop();
- }
-
- try {
- AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
- .createJsonLogEntity(request, response, conf).toJsonFormatLog());
- } catch (Exception e) {
- // if any exception, log the exception.
- String msg = "Error creating audit log for add role to user: " + e.getMessage();
- LOGGER.error(msg, e);
- }
- return response;
- }
-
- @Override
- public TAlterSentryRoleDeleteUsersResponse alter_sentry_role_delete_users(
- TAlterSentryRoleDeleteUsersRequest request) throws TException {
- final Timer.Context timerContext = sentryMetrics.grantRoleTimer.time();
- TAlterSentryRoleDeleteUsersResponse response = new TAlterSentryRoleDeleteUsersResponse();
- try {
- validateClientVersion(request.getProtocol_version());
- authorize(request.getRequestorUserName(), getRequestorGroups(request.getRequestorUserName()));
- sentryStore.alterSentryRoleDeleteUsers(request.getRoleName(),
- request.getUsers());
- response.setStatus(Status.OK());
- notificationHandlerInvoker.alter_sentry_role_delete_users(request, response);
- } catch (SentryNoSuchObjectException e) {
- String msg = "Role: " + request + " does not exist.";
- LOGGER.error(msg, e);
- response.setStatus(Status.NoSuchObject(msg, e));
- } catch (SentryAccessDeniedException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryGroupNotFoundException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryThriftAPIMismatchException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
- } catch (Exception e) {
- String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
- LOGGER.error(msg, e);
- response.setStatus(Status.RuntimeError(msg, e));
- } finally {
- timerContext.stop();
- }
-
- try {
- AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
- .createJsonLogEntity(request, response, conf).toJsonFormatLog());
- } catch (Exception e) {
- // if any exception, log the exception.
- String msg = "Error creating audit log for delete role from user: " + e.getMessage();
- LOGGER.error(msg, e);
- }
- return response;
- }
-
- @Override
- public TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(
- TAlterSentryRoleDeleteGroupsRequest request) throws TException {
- final Timer.Context timerContext = sentryMetrics.revokeRoleTimer.time();
- TAlterSentryRoleDeleteGroupsResponse response = new TAlterSentryRoleDeleteGroupsResponse();
- try {
- validateClientVersion(request.getProtocol_version());
- authorize(request.getRequestorUserName(),
- getRequestorGroups(request.getRequestorUserName()));
-
- // TODO: now only has SentryPlugin. Once add more SentryPolicyStorePlugins,
- // TODO: need to differentiate the updates for different Plugins.
- Preconditions.checkState(sentryPlugins.size() <= 1);
- Update update = null;
- for (SentryPolicyStorePlugin plugin : sentryPlugins) {
- update = plugin.onAlterSentryRoleDeleteGroups(request);
- }
-
- if (update != null) {
- sentryStore.alterSentryRoleDeleteGroups(request.getRoleName(),
- request.getGroups(), update);
- } else {
- sentryStore.alterSentryRoleDeleteGroups(request.getRoleName(),
- request.getGroups());
- }
- response.setStatus(Status.OK());
- notificationHandlerInvoker.alter_sentry_role_delete_groups(request,
- response);
- } catch (SentryNoSuchObjectException e) {
- String msg = "Role: " + request + " does not exist.";
- LOGGER.error(msg, e);
- response.setStatus(Status.NoSuchObject(msg, e));
- } catch (SentryAccessDeniedException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryGroupNotFoundException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryThriftAPIMismatchException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
- } catch (Exception e) {
- String msg = "Unknown error adding groups to role: " + request;
- LOGGER.error(msg, e);
- response.setStatus(Status.RuntimeError(msg, e));
- } finally {
- timerContext.stop();
- }
-
- try {
- AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
- .createJsonLogEntity(request, response, conf).toJsonFormatLog());
- } catch (Exception e) {
- // if any exception, log the exception.
- String msg = "Error creating audit log for delete role from group: " + e.getMessage();
- LOGGER.error(msg, e);
- }
- return response;
- }
-
- @Override
- public TListSentryRolesResponse list_sentry_roles_by_group(
- TListSentryRolesRequest request) throws TException {
- final Timer.Context timerContext = sentryMetrics.listRolesByGroupTimer.time();
- TListSentryRolesResponse response = new TListSentryRolesResponse();
- TSentryResponseStatus status;
- Set<TSentryRole> roleSet = new HashSet<TSentryRole>();
- String subject = request.getRequestorUserName();
- boolean checkAllGroups = false;
- try {
- validateClientVersion(request.getProtocol_version());
- Set<String> groups = getRequestorGroups(subject);
- // Don't check admin permissions for listing requestor's own roles
- if (AccessConstants.ALL.equalsIgnoreCase(request.getGroupName())) {
- checkAllGroups = true;
- } else {
- boolean admin = inAdminGroups(groups);
- //Only admin users can list all roles in the system ( groupname = null)
- //Non admin users are only allowed to list only groups which they belong to
- if(!admin && (request.getGroupName() == null || !groups.contains(request.getGroupName()))) {
- throw new SentryAccessDeniedException("Access denied to " + subject);
- } else {
- groups.clear();
- groups.add(request.getGroupName());
- }
- }
- roleSet = sentryStore.getTSentryRolesByGroupName(groups, checkAllGroups);
- response.setRoles(roleSet);
- response.setStatus(Status.OK());
- } catch (SentryNoSuchObjectException e) {
- response.setRoles(roleSet);
- String msg = "Request: " + request + " couldn't be completed, message: " + e.getMessage();
- LOGGER.error(msg, e);
- response.setStatus(Status.NoSuchObject(msg, e));
- } catch (SentryAccessDeniedException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryGroupNotFoundException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryThriftAPIMismatchException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
- } catch (Exception e) {
- String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
- LOGGER.error(msg, e);
- response.setStatus(Status.RuntimeError(msg, e));
- } finally {
- timerContext.stop();
- }
- return response;
- }
-
- public TListSentryRolesResponse list_sentry_roles_by_user(TListSentryRolesForUserRequest request)
- throws TException {
- final Timer.Context timerContext = sentryMetrics.listRolesByGroupTimer.time();
- TListSentryRolesResponse response = new TListSentryRolesResponse();
- TSentryResponseStatus status;
- Set<TSentryRole> roleSet = new HashSet<TSentryRole>();
- String requestor = request.getRequestorUserName();
- String userName = request.getUserName();
- boolean checkAllGroups = false;
- try {
- validateClientVersion(request.getProtocol_version());
- // userName can't be empty
- if (StringUtils.isEmpty(userName)) {
- throw new SentryAccessDeniedException("The user name can't be empty.");
- }
-
- Set<String> requestorGroups;
- try {
- requestorGroups = getRequestorGroups(requestor);
- } catch (SentryGroupNotFoundException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- return response;
- }
-
- Set<String> userGroups;
- try {
- userGroups = getRequestorGroups(userName);
- } catch (SentryGroupNotFoundException e) {
- LOGGER.error(e.getMessage(), e);
- String msg = "Groups for user " + userName + " do not exist: " + e.getMessage();
- response.setStatus(Status.AccessDenied(msg, e));
- return response;
- }
- boolean isAdmin = inAdminGroups(requestorGroups);
-
- // Only admin users can list other user's roles in the system
- // Non admin users are only allowed to list only their own roles related user and group
- if (!isAdmin && !userName.equals(requestor)) {
- throw new SentryAccessDeniedException("Access denied to list the roles for " + userName);
- }
- roleSet = sentryStore.getTSentryRolesByUserNames(Sets.newHashSet(userName));
- response.setRoles(roleSet);
- response.setStatus(Status.OK());
- } catch (SentryNoSuchObjectException e) {
- response.setRoles(roleSet);
- String msg = "Role: " + request + " couldn't be retrieved.";
- LOGGER.error(msg, e);
- response.setStatus(Status.NoSuchObject(msg, e));
- } catch (SentryAccessDeniedException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryThriftAPIMismatchException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
- } catch (Exception e) {
- String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
- LOGGER.error(msg, e);
- response.setStatus(Status.RuntimeError(msg, e));
- } finally {
- timerContext.stop();
- }
- return response;
- }
-
- @Override
- public TListSentryPrivilegesResponse list_sentry_privileges_by_role(
- TListSentryPrivilegesRequest request) throws TException {
- final Timer.Context timerContext = sentryMetrics.listPrivilegesByRoleTimer.time();
- TListSentryPrivilegesResponse response = new TListSentryPrivilegesResponse();
- TSentryResponseStatus status;
- Set<TSentryPrivilege> privilegeSet = new HashSet<TSentryPrivilege>();
- String subject = request.getRequestorUserName();
- try {
- validateClientVersion(request.getProtocol_version());
- Set<String> groups = getRequestorGroups(subject);
- Boolean admin = inAdminGroups(groups);
- if(!admin) {
- Set<String> roleNamesForGroups = toTrimedLower(sentryStore.getRoleNamesForGroups(groups));
- if(!roleNamesForGroups.contains(request.getRoleName().trim().toLowerCase())) {
- throw new SentryAccessDeniedException("Access denied to " + subject);
- }
- }
- if (request.isSetAuthorizableHierarchy()) {
- TSentryAuthorizable authorizableHierarchy = request.getAuthorizableHierarchy();
- privilegeSet = sentryStore.getTSentryPrivileges(Sets.newHashSet(request.getRoleName()), authorizableHierarchy);
- } else {
- privilegeSet = sentryStore.getAllTSentryPrivilegesByRoleName(request.getRoleName());
- }
- response.setPrivileges(privilegeSet);
- response.setStatus(Status.OK());
- } catch (SentryNoSuchObjectException e) {
- response.setPrivileges(privilegeSet);
- String msg = "Privilege: " + request + " couldn't be retrieved.";
- LOGGER.error(msg, e);
- response.setStatus(Status.NoSuchObject(msg, e));
- } catch (SentryAccessDeniedException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryGroupNotFoundException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryThriftAPIMismatchException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
- } catch (Exception e) {
- String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
- LOGGER.error(msg, e);
- response.setStatus(Status.RuntimeError(msg, e));
- } finally {
- timerContext.stop();
- }
- return response;
- }
-
- /**
- * This method was created specifically for ProviderBackend.getPrivileges() and is not meant
- * to be used for general privilege retrieval. More details in the .thrift file.
- */
- @Override
- public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(
- TListSentryPrivilegesForProviderRequest request) throws TException {
- final Timer.Context timerContext = sentryMetrics.listPrivilegesForProviderTimer.time();
- TListSentryPrivilegesForProviderResponse response = new TListSentryPrivilegesForProviderResponse();
- response.setPrivileges(new HashSet<String>());
- try {
- validateClientVersion(request.getProtocol_version());
- Set<String> privilegesForProvider =
- sentryStore.listSentryPrivilegesForProvider(request.getGroups(), request.getUsers(),
- request.getRoleSet(), request.getAuthorizableHierarchy());
- response.setPrivileges(privilegesForProvider);
- if (privilegesForProvider == null
- || privilegesForProvider.size() == 0
- && request.getAuthorizableHierarchy() != null
- && sentryStore.hasAnyServerPrivileges(request.getGroups(), request.getUsers(),
- request.getRoleSet(), request.getAuthorizableHierarchy().getServer())) {
-
- // REQUIRED for ensuring 'default' Db is accessible by any user
- // with privileges to atleast 1 object with the specific server as root
-
- // Need some way to specify that even though user has no privilege
- // For the specific AuthorizableHierarchy.. he has privilege on
- // atleast 1 object in the server hierarchy
- HashSet<String> serverPriv = Sets.newHashSet("server=+");
- response.setPrivileges(serverPriv);
- }
- response.setStatus(Status.OK());
- } catch (SentryThriftAPIMismatchException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
- } catch (Exception e) {
- String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
- LOGGER.error(msg, e);
- response.setStatus(Status.RuntimeError(msg, e));
- } finally {
- timerContext.stop();
- }
- return response;
- }
-
- // retrieve the group mapping for the given user name
- private Set<String> getRequestorGroups(String userName)
- throws SentryUserException {
- return getGroupsFromUserName(this.conf, userName);
- }
-
- public static Set<String> getGroupsFromUserName(Configuration conf,
- String userName) throws SentryUserException {
- String groupMapping = conf.get(ServerConfig.SENTRY_STORE_GROUP_MAPPING,
- ServerConfig.SENTRY_STORE_GROUP_MAPPING_DEFAULT);
- String authResoruce = conf
- .get(ServerConfig.SENTRY_STORE_GROUP_MAPPING_RESOURCE);
-
- // load the group mapping provider class
- GroupMappingService groupMappingService;
- try {
- Constructor<?> constrctor = Class.forName(groupMapping)
- .getDeclaredConstructor(Configuration.class, String.class);
- constrctor.setAccessible(true);
- groupMappingService = (GroupMappingService) constrctor
- .newInstance(new Object[] { conf, authResoruce });
- } catch (NoSuchMethodException e) {
- throw new SentryUserException("Unable to instantiate group mapping", e);
- } catch (SecurityException e) {
- throw new SentryUserException("Unable to instantiate group mapping", e);
- } catch (ClassNotFoundException e) {
- throw new SentryUserException("Unable to instantiate group mapping", e);
- } catch (InstantiationException e) {
- throw new SentryUserException("Unable to instantiate group mapping", e);
- } catch (IllegalAccessException e) {
- throw new SentryUserException("Unable to instantiate group mapping", e);
- } catch (IllegalArgumentException e) {
- throw new SentryUserException("Unable to instantiate group mapping", e);
- } catch (InvocationTargetException e) {
- throw new SentryUserException("Unable to instantiate group mapping", e);
- }
- return groupMappingService.getGroups(userName);
- }
-
- @Override
- public TDropPrivilegesResponse drop_sentry_privilege(
- TDropPrivilegesRequest request) throws TException {
- final Timer.Context timerContext = sentryMetrics.dropPrivilegeTimer.time();
- TDropPrivilegesResponse response = new TDropPrivilegesResponse();
- try {
- validateClientVersion(request.getProtocol_version());
- authorize(request.getRequestorUserName(), adminGroups);
-
- // TODO: now only has SentryPlugin. Once add more SentryPolicyStorePlugins,
- // TODO: need to differentiate the updates for different Plugins.
- Preconditions.checkState(sentryPlugins.size() <= 1);
- Update update = null;
- for (SentryPolicyStorePlugin plugin : sentryPlugins) {
- update = plugin.onDropSentryPrivilege(request);
- }
- if (update != null) {
- sentryStore.dropPrivilege(request.getAuthorizable(), update);
- } else {
- sentryStore.dropPrivilege(request.getAuthorizable());
- }
- response.setStatus(Status.OK());
- } catch (SentryAccessDeniedException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryGroupNotFoundException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryThriftAPIMismatchException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
- } catch (Exception e) {
- String msg = "Unknown error for request: " + request + ", message: "
- + e.getMessage();
- LOGGER.error(msg, e);
- response.setStatus(Status.RuntimeError(msg, e));
- } finally {
- timerContext.stop();
- }
- return response;
- }
-
- @Override
- public TRenamePrivilegesResponse rename_sentry_privilege(
- TRenamePrivilegesRequest request) throws TException {
- final Timer.Context timerContext = sentryMetrics.renamePrivilegeTimer.time();
- TRenamePrivilegesResponse response = new TRenamePrivilegesResponse();
- try {
- validateClientVersion(request.getProtocol_version());
- authorize(request.getRequestorUserName(), adminGroups);
-
- // TODO: now only has SentryPlugin. Once add more SentryPolicyStorePlugins,
- // TODO: need to differentiate the updates for different Plugins.
- Preconditions.checkState(sentryPlugins.size() <= 1);
- Update update = null;
- for (SentryPolicyStorePlugin plugin : sentryPlugins) {
- update = plugin.onRenameSentryPrivilege(request);
- }
- if (update != null) {
- sentryStore.renamePrivilege(request.getOldAuthorizable(),
- request.getNewAuthorizable(), update);
- } else {
- sentryStore.renamePrivilege(request.getOldAuthorizable(),
- request.getNewAuthorizable());
- }
- response.setStatus(Status.OK());
- } catch (SentryAccessDeniedException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryGroupNotFoundException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryThriftAPIMismatchException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
- } catch (SentryInvalidInputException e) {
- response.setStatus(Status.InvalidInput(e.getMessage(), e));
- }
- catch (Exception e) {
- String msg = "Unknown error for request: " + request + ", message: "
- + e.getMessage();
- LOGGER.error(msg, e);
- response.setStatus(Status.RuntimeError(msg, e));
- } finally {
- timerContext.close();
- }
- return response;
- }
-
- @Override
- public TListSentryPrivilegesByAuthResponse list_sentry_privileges_by_authorizable(
- TListSentryPrivilegesByAuthRequest request) throws TException {
- final Timer.Context timerContext = sentryMetrics.listPrivilegesByAuthorizableTimer.time();
- TListSentryPrivilegesByAuthResponse response = new TListSentryPrivilegesByAuthResponse();
- Map<TSentryAuthorizable, TSentryPrivilegeMap> authRoleMap = Maps.newHashMap();
- String subject = request.getRequestorUserName();
- Set<String> requestedGroups = request.getGroups();
- TSentryActiveRoleSet requestedRoleSet = request.getRoleSet();
- try {
- validateClientVersion(request.getProtocol_version());
- Set<String> memberGroups = getRequestorGroups(subject);
- if(!inAdminGroups(memberGroups)) {
- // disallow non-admin to lookup groups that they are not part of
- if (requestedGroups != null && !requestedGroups.isEmpty()) {
- for (String requestedGroup : requestedGroups) {
- if (!memberGroups.contains(requestedGroup)) {
- // if user doesn't belong to one of the requested group then raise error
- throw new SentryAccessDeniedException("Access denied to " + subject);
- }
- }
- } else {
- // non-admin's search is limited to it's own groups
- requestedGroups = memberGroups;
- }
-
- // disallow non-admin to lookup roles that they are not part of
- if (requestedRoleSet != null && !requestedRoleSet.isAll()) {
- Set<String> roles = toTrimedLower(sentryStore
- .getRoleNamesForGroups(memberGroups));
- for (String role : toTrimedLower(requestedRoleSet.getRoles())) {
- if (!roles.contains(role)) {
- throw new SentryAccessDeniedException("Access denied to "
- + subject);
- }
- }
- }
- }
-
- // If user is not part of any group.. return empty response
- for (TSentryAuthorizable authorizable : request.getAuthorizableSet()) {
- authRoleMap.put(authorizable, sentryStore
- .listSentryPrivilegesByAuthorizable(requestedGroups,
- request.getRoleSet(), authorizable, inAdminGroups(memberGroups)));
- }
- response.setPrivilegesMapByAuth(authRoleMap);
- response.setStatus(Status.OK());
- // TODO : Sentry - HDFS : Have to handle this
- } catch (SentryAccessDeniedException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryGroupNotFoundException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryThriftAPIMismatchException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
- } catch (Exception e) {
- String msg = "Unknown error for request: " + request + ", message: "
- + e.getMessage();
- LOGGER.error(msg, e);
- response.setStatus(Status.RuntimeError(msg, e));
- } finally {
- timerContext.stop();
- }
- return response;
- }
-
- /**
- * Respond to a request for a config value in the sentry server. The client
- * can request any config value that starts with "sentry." and doesn't contain
- * "keytab".
- * @param request Contains config parameter sought and default if not found
- * @return The response, containing the value and status
- * @throws TException
- */
- @Override
- public TSentryConfigValueResponse get_sentry_config_value(
- TSentryConfigValueRequest request) throws TException {
-
- final String requirePattern = "^sentry\\..*";
- final String excludePattern = ".*keytab.*|.*\\.jdbc\\..*|.*password.*";
-
- TSentryConfigValueResponse response = new TSentryConfigValueResponse();
- String attr = request.getPropertyName();
-
- try {
- validateClientVersion(request.getProtocol_version());
- } catch (SentryThriftAPIMismatchException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e));
- }
- // Only allow config parameters like...
- if (!Pattern.matches(requirePattern, attr) ||
- Pattern.matches(excludePattern, attr)) {
- String msg = "Attempted access of the configuration property " + attr +
- " was denied";
- LOGGER.error(msg);
- response.setStatus(Status.AccessDenied(msg,
- new SentryAccessDeniedException(msg)));
- return response;
- }
-
- response.setValue(conf.get(attr,request.getDefaultValue()));
- response.setStatus(Status.OK());
- return response;
- }
-
- @VisibleForTesting
- static void validateClientVersion(int protocolVersion) throws SentryThriftAPIMismatchException {
- if (ServiceConstants.ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT != protocolVersion) {
- String msg = "Sentry thrift API protocol version mismatch: Client thrift version " +
- "is: " + protocolVersion + " , server thrift verion " +
- "is " + ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT;
- throw new SentryThriftAPIMismatchException(msg);
- }
- }
-
- // get the sentry mapping data and return the data with map structure
- @Override
- public TSentryExportMappingDataResponse export_sentry_mapping_data(
- TSentryExportMappingDataRequest request) throws TException {
- TSentryExportMappingDataResponse response = new TSentryExportMappingDataResponse();
- try {
- String requestor = request.getRequestorUserName();
- Set<String> memberGroups = getRequestorGroups(requestor);
- String objectPath = request.getObjectPath();
- String databaseName = null;
- String tableName = null;
-
- Map<String, String> objectMap =
- SentryServiceUtil.parseObjectPath(objectPath);
- databaseName = objectMap.get(PolicyFileConstants.PRIVILEGE_DATABASE_NAME);
- tableName = objectMap.get(PolicyFileConstants.PRIVILEGE_TABLE_NAME);
-
- if (!inAdminGroups(memberGroups)) {
- // disallow non-admin to import the metadata of sentry
- throw new SentryAccessDeniedException("Access denied to " + requestor
- + " for export the metadata of sentry.");
- }
- TSentryMappingData tSentryMappingData = new TSentryMappingData();
- Map<String, Set<TSentryPrivilege>> rolePrivileges =
- sentryStore.getRoleNameTPrivilegesMap(databaseName, tableName);
- tSentryMappingData.setRolePrivilegesMap(rolePrivileges);
- Set<String> roleNames = rolePrivileges.keySet();
- // roleNames should be null if databaseName == null and tableName == null
- if (databaseName == null && tableName == null) {
- roleNames = null;
- }
- List<Map<String, Set<String>>> mapList = sentryStore.getGroupUserRoleMapList(
- roleNames);
- tSentryMappingData.setGroupRolesMap(mapList.get(
- SentryStore.INDEX_GROUP_ROLES_MAP));
- tSentryMappingData.setUserRolesMap(mapList.get(SentryStore.INDEX_USER_ROLES_MAP));
-
- response.setMappingData(tSentryMappingData);
- response.setStatus(Status.OK());
- } catch (SentryAccessDeniedException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryGroupNotFoundException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (Exception e) {
- String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
- LOGGER.error(msg, e);
- response.setMappingData(new TSentryMappingData());
- response.setStatus(Status.RuntimeError(msg, e));
- }
- return response;
- }
-
- // import the sentry mapping data
- @Override
- public TSentryImportMappingDataResponse import_sentry_mapping_data(
- TSentryImportMappingDataRequest request) throws TException {
- TSentryImportMappingDataResponse response = new TSentryImportMappingDataResponse();
- try {
- String requestor = request.getRequestorUserName();
- Set<String> memberGroups = getRequestorGroups(requestor);
- if (!inAdminGroups(memberGroups)) {
- // disallow non-admin to import the metadata of sentry
- throw new SentryAccessDeniedException("Access denied to " + requestor
- + " for import the metadata of sentry.");
- }
- sentryStore.importSentryMetaData(request.getMappingData(), request.isOverwriteRole());
- response.setStatus(Status.OK());
- } catch (SentryAccessDeniedException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryGroupNotFoundException e) {
- LOGGER.error(e.getMessage(), e);
- response.setStatus(Status.AccessDenied(e.getMessage(), e));
- } catch (SentryInvalidInputException e) {
- String msg = "Invalid input privilege object";
- LOGGER.error(msg, e);
- response.setStatus(Status.InvalidInput(msg, e));
- } catch (Exception e) {
- String msg = "Unknown error for request: " + request + ", message: " + e.getMessage();
- LOGGER.error(msg, e);
- response.setStatus(Status.RuntimeError(msg, e));
- }
- return response;
- }
-
- @Override
- public TSentrySyncIDResponse sentry_sync_notifications(TSentrySyncIDRequest request)
- throws TException {
- TSentrySyncIDResponse response = new TSentrySyncIDResponse();
- try (Timer.Context timerContext = hmsWaitTimer.time()) {
- // Wait until Sentry Server processes specified HMS Notification ID.
- response.setId(sentryStore.getCounterWait().waitFor(request.getId()));
- response.setStatus(Status.OK());
- } catch (InterruptedException e) {
- String msg = String.format("wait request for id %d is interrupted",
- request.getId());
- LOGGER.error(msg, e);
- response.setId(0);
- response.setStatus(Status.RuntimeError(msg, e));
- Thread.currentThread().interrupt();
- } catch (TimeoutException e) {
- String msg = String.format("timed out wait request for id %d", request.getId());
- LOGGER.warn(msg, e);
- response.setId(0);
- response.setStatus(Status.RuntimeError(msg, e));
- }
- return response;
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreProcessorFactory.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreProcessorFactory.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreProcessorFactory.java
deleted file mode 100644
index 977152d..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreProcessorFactory.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.sentry.provider.db.service.persistent.SentryStore;
-import org.apache.sentry.service.thrift.ProcessorFactory;
-import org.apache.thrift.TMultiplexedProcessor;
-import org.apache.thrift.TProcessor;
-
-public class SentryPolicyStoreProcessorFactory extends ProcessorFactory {
- public SentryPolicyStoreProcessorFactory(Configuration conf) {
- super(conf);
- }
-
- public boolean register(TMultiplexedProcessor multiplexedProcessor,
- SentryStore sentryStore) throws Exception {
- SentryPolicyStoreProcessor sentryServiceHandler =
- new SentryPolicyStoreProcessor(SentryPolicyStoreProcessor.SENTRY_POLICY_SERVICE_NAME,
- conf, sentryStore);
- TProcessor processor =
- new SentryProcessorWrapper<SentryPolicyService.Iface>(sentryServiceHandler);
- multiplexedProcessor.registerProcessor(
- SentryPolicyStoreProcessor.SENTRY_POLICY_SERVICE_NAME, processor);
- return true;
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryProcessorWrapper.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryProcessorWrapper.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryProcessorWrapper.java
deleted file mode 100644
index 5e26486..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryProcessorWrapper.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.sentry.core.common.utils.ThriftUtil;
-import org.apache.thrift.TException;
-import org.apache.thrift.protocol.TProtocol;
-
-public class SentryProcessorWrapper<I extends SentryPolicyService.Iface> extends
- SentryPolicyService.Processor<SentryPolicyService.Iface> {
-
- public SentryProcessorWrapper(I iface) {
- super(iface);
- }
-
- @Override
- public boolean process(TProtocol in, TProtocol out) throws TException {
- ThriftUtil.setIpAddress(in);
- ThriftUtil.setImpersonator(in);
- return super.process(in, out);
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryWebServer.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryWebServer.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryWebServer.java
deleted file mode 100644
index 0e1f97e..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryWebServer.java
+++ /dev/null
@@ -1,240 +0,0 @@
-package org.apache.sentry.provider.db.service.thrift;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import com.codahale.metrics.servlets.AdminServlet;
-import com.google.common.base.Preconditions;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.EnumSet;
-import java.util.EventListener;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import com.google.common.base.Splitter;
-import com.google.common.base.Strings;
-import com.google.common.collect.Sets;
-import javax.servlet.DispatcherType;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.security.SecurityUtil;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
-import org.eclipse.jetty.security.ConstraintMapping;
-import org.eclipse.jetty.security.ConstraintSecurityHandler;
-import org.eclipse.jetty.server.Connector;
-import org.eclipse.jetty.server.Handler;
-import org.eclipse.jetty.server.HttpConfiguration;
-import org.eclipse.jetty.server.HttpConnectionFactory;
-import org.eclipse.jetty.server.SecureRequestCustomizer;
-import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.server.SslConnectionFactory;
-import org.eclipse.jetty.server.handler.ContextHandler;
-import org.eclipse.jetty.server.handler.ContextHandlerCollection;
-import org.eclipse.jetty.server.handler.ResourceHandler;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.util.security.Constraint;
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SentryWebServer {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(SentryWebServer.class);
- private static final String RESOURCE_DIR = "/webapp";
- private static final String WELCOME_PAGE = "SentryService.html";
-
- private Server server;
-
- public SentryWebServer(List<EventListener> listeners, int port, Configuration conf) {
- server = new Server();
-
- // Create a channel connector for "http/https" requests
- ServerConnector connector;
- if (conf.getBoolean(ServerConfig.SENTRY_WEB_USE_SSL, false)) {
- SslContextFactory sslContextFactory = new SslContextFactory();
- sslContextFactory.setKeyStorePath(conf.get(ServerConfig.SENTRY_WEB_SSL_KEYSTORE_PATH, ""));
- sslContextFactory.setKeyStorePassword(
- conf.get(ServerConfig.SENTRY_WEB_SSL_KEYSTORE_PASSWORD, ""));
- // Exclude SSL blacklist protocols
- sslContextFactory.setExcludeProtocols(ServerConfig.SENTRY_SSL_PROTOCOL_BLACKLIST_DEFAULT);
- Set<String> moreExcludedSSLProtocols =
- Sets.newHashSet(Splitter.on(",").trimResults().omitEmptyStrings()
- .split(Strings.nullToEmpty(conf.get(ServerConfig.SENTRY_SSL_PROTOCOL_BLACKLIST))));
- sslContextFactory.addExcludeProtocols(moreExcludedSSLProtocols.toArray(
- new String[moreExcludedSSLProtocols.size()]));
-
- HttpConfiguration httpConfiguration = new HttpConfiguration();
- httpConfiguration.setSecurePort(port);
- httpConfiguration.setSecureScheme("https");
- httpConfiguration.addCustomizer(new SecureRequestCustomizer());
-
- connector = new ServerConnector(
- server,
- new SslConnectionFactory(sslContextFactory, "http/1.1"),
- new HttpConnectionFactory(httpConfiguration));
-
- LOGGER.info("Now using SSL mode.");
- } else {
- connector = new ServerConnector(server, new HttpConnectionFactory());
- }
-
- connector.setPort(port);
- server.setConnectors(new Connector[] { connector });
-
- ServletContextHandler servletContextHandler = new ServletContextHandler();
- ServletHolder servletHolder = new ServletHolder(AdminServlet.class);
- servletContextHandler.addServlet(servletHolder, "/*");
-
- for(EventListener listener:listeners) {
- servletContextHandler.addEventListener(listener);
- }
-
- servletContextHandler.addServlet(new ServletHolder(ConfServlet.class), "/conf");
-
- if (conf.getBoolean(ServerConfig.SENTRY_WEB_ADMIN_SERVLET_ENABLED,
- ServerConfig.SENTRY_WEB_ADMIN_SERVLET_ENABLED_DEFAULT)) {
- servletContextHandler.addServlet(
- new ServletHolder(SentryAdminServlet.class), "/admin/*");
- }
- servletContextHandler.getServletContext()
- .setAttribute(ConfServlet.CONF_CONTEXT_ATTRIBUTE, conf);
-
- servletContextHandler.addServlet(new ServletHolder(LogLevelServlet.class), "/admin/logLevel");
-
- if (conf.getBoolean(ServerConfig.SENTRY_WEB_PUBSUB_SERVLET_ENABLED,
- ServerConfig.SENTRY_WEB_PUBSUB_SERVLET_ENABLED_DEFAULT)) {
- servletContextHandler.addServlet(new ServletHolder(PubSubServlet.class), "/admin/publishMessage");
- }
-
- ResourceHandler resourceHandler = new ResourceHandler();
- resourceHandler.setDirectoriesListed(true);
- URL url = this.getClass().getResource(RESOURCE_DIR);
- try {
- resourceHandler.setBaseResource(Resource.newResource(url.toString()));
- } catch (IOException e) {
- LOGGER.error("Got exception while setBaseResource for Sentry Service web UI", e);
- }
- resourceHandler.setWelcomeFiles(new String[]{WELCOME_PAGE});
- ContextHandler contextHandler= new ContextHandler();
- contextHandler.setHandler(resourceHandler);
-
- ContextHandlerCollection contextHandlerCollection = new ContextHandlerCollection();
- contextHandlerCollection.setHandlers(new Handler[]{contextHandler, servletContextHandler});
-
- String authMethod = conf.get(ServerConfig.SENTRY_WEB_SECURITY_TYPE);
- if (!ServerConfig.SENTRY_WEB_SECURITY_TYPE_NONE.equalsIgnoreCase(authMethod)) {
- /**
- * SentryAuthFilter is a subclass of AuthenticationFilter and
- * AuthenticationFilter tagged as private and unstable interface:
- * While there are not guarantees that this interface will not change,
- * it is fairly stable and used by other projects (ie - Oozie)
- */
- FilterHolder filterHolder = servletContextHandler.addFilter(SentryAuthFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
- filterHolder.setInitParameters(loadWebAuthenticationConf(conf));
- }
-
- server.setHandler(disableTraceMethod(contextHandlerCollection));
- }
-
- /**
- * Disables the HTTP TRACE method request which leads to Cross-Site Tracking (XST) problems.
- *
- * To disable it, we need to wrap the Handler (which has the HTTP TRACE enabled) with
- * a constraint that denies access to the HTTP TRACE method.
- *
- * @param handler The Handler which has the HTTP TRACE enabled.
- * @return A new Handler wrapped with the HTTP TRACE constraint and the Handler passed as parameter.
- */
- private Handler disableTraceMethod(Handler handler) {
- Constraint disableTraceConstraint = new Constraint();
- disableTraceConstraint.setName("Disable TRACE");
- disableTraceConstraint.setAuthenticate(true);
-
- ConstraintMapping mapping = new ConstraintMapping();
- mapping.setConstraint(disableTraceConstraint);
- mapping.setMethod("TRACE");
- mapping.setPathSpec("/");
-
- ConstraintSecurityHandler constraintSecurityHandler = new ConstraintSecurityHandler();
- constraintSecurityHandler.addConstraintMapping(mapping);
- constraintSecurityHandler.setHandler(handler);
-
- return constraintSecurityHandler;
- }
-
- public void start() throws Exception{
- server.start();
- }
- public void stop() throws Exception{
- server.stop();
- }
- public boolean isAlive() {
- return server != null && server.isStarted();
- }
- private static Map<String, String> loadWebAuthenticationConf(Configuration conf) {
- Map<String,String> prop = new HashMap<String, String>();
- prop.put(AuthenticationFilter.CONFIG_PREFIX, ServerConfig.SENTRY_WEB_SECURITY_PREFIX);
- String allowUsers = conf.get(ServerConfig.SENTRY_WEB_SECURITY_ALLOW_CONNECT_USERS);
- if (allowUsers == null || allowUsers.equals("")) {
- allowUsers = conf.get(ServerConfig.ALLOW_CONNECT);
- conf.set(ServerConfig.SENTRY_WEB_SECURITY_ALLOW_CONNECT_USERS, allowUsers);
- }
- validateConf(conf);
- for (Map.Entry<String, String> entry : conf) {
- String name = entry.getKey();
- if (name.startsWith(ServerConfig.SENTRY_WEB_SECURITY_PREFIX)) {
- String value = conf.get(name);
- prop.put(name, value);
- }
- }
- return prop;
- }
-
- private static void validateConf(Configuration conf) {
- String authHandlerName = conf.get(ServerConfig.SENTRY_WEB_SECURITY_TYPE);
- Preconditions.checkNotNull(authHandlerName, "Web authHandler should not be null.");
- String allowUsers = conf.get(ServerConfig.SENTRY_WEB_SECURITY_ALLOW_CONNECT_USERS);
- Preconditions.checkNotNull(allowUsers, "Allow connect user(s) should not be null.");
- if (ServerConfig.SENTRY_WEB_SECURITY_TYPE_KERBEROS.equalsIgnoreCase(authHandlerName)) {
- String principal = conf.get(ServerConfig.SENTRY_WEB_SECURITY_PRINCIPAL);
- Preconditions.checkNotNull(principal, "Kerberos principal should not be null.");
- Preconditions.checkArgument(principal.length() != 0, "Kerberos principal is not right.");
- String keytabFile = conf.get(ServerConfig.SENTRY_WEB_SECURITY_KEYTAB);
- Preconditions.checkNotNull(keytabFile, "Keytab File should not be null.");
- Preconditions.checkArgument(keytabFile.length() != 0, "Keytab File is not right.");
- try {
- UserGroupInformation.setConfiguration(conf);
- String hostPrincipal = SecurityUtil.getServerPrincipal(principal, ServerConfig.RPC_ADDRESS_DEFAULT);
- UserGroupInformation.loginUserFromKeytab(hostPrincipal, keytabFile);
- } catch (IOException ex) {
- throw new IllegalArgumentException("Can't use Kerberos authentication, principal ["
- + principal + "] keytab [" + keytabFile + "]", ex);
- }
- LOGGER.info("Using Kerberos authentication, principal [{}] keytab [{}]", principal, keytabFile);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/validator/GrantPrivilegeRequestValidator.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/validator/GrantPrivilegeRequestValidator.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/validator/GrantPrivilegeRequestValidator.java
deleted file mode 100644
index f714d5d..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/validator/GrantPrivilegeRequestValidator.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift.validator;
-
-import java.util.Set;
-
-import org.apache.sentry.core.common.exception.SentryInvalidInputException;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleGrantPrivilegeRequest;
-import org.apache.sentry.provider.db.service.thrift.TSentryGrantOption;
-import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege;
-
-/**
- * Check's for mandatory fields in the privileges and
- * checks to see if the UNSET option is present.
- */
-public final class GrantPrivilegeRequestValidator {
- private GrantPrivilegeRequestValidator() {
- }
-
- /**
- * Validates privileges in input request by making sure mandatory fields like
- * server name and action in the privileges are not empty and see all the values in the
- * request are valid.
- *
- * @param request to be validated.
- * @throws SentryInvalidInputException If all the mandatory fields in the privileges are
- * not present [OR] invalid fields a provided in request.
- */
- public static void validate(TAlterSentryRoleGrantPrivilegeRequest request)
- throws SentryInvalidInputException {
- if (request.isSetPrivileges() && (!request.getPrivileges().isEmpty())) {
- checkForMandatoryFieldsInPrivileges(request.getPrivileges());
- validateGrantOptionInprivileges(request.getPrivileges());
- }
- }
-
- /**
- * Checks for mandatory fields "serverName" and "action" in all the privileges
- * in the set are not empty.
- *
- * @param privileges Set of <code>TSentryPrivileges</code> to be inspected
- * @throws SentryInvalidInputException If all the mandatory fields in the privileges are
- * not present
- */
- static void checkForMandatoryFieldsInPrivileges(Set<TSentryPrivilege> privileges)
- throws SentryInvalidInputException {
- for (TSentryPrivilege privilege : privileges) {
- if (privilege.getServerName() == null ||
- privilege.getServerName().trim().isEmpty()) {
- throw new SentryInvalidInputException("Invalid Privilege input: Server Name is missing");
- }
- if (privilege.getAction() == null ||
- privilege.getAction().trim().isEmpty()) {
- throw new SentryInvalidInputException("Invalid Privilege input: Action is missing");
- }
- }
- }
-
- /**
- * Validates grant option in all the privileges.
- *
- * @param privileges Set of privileges to be validated
- * @throws SentryInvalidInputException If the validation for grant option fails for any
- * of the privileges.
- */
- private static void validateGrantOptionInprivileges(Set<TSentryPrivilege> privileges)
- throws SentryInvalidInputException {
- for (TSentryPrivilege privilege : privileges) {
- if (privilege.getGrantOption() == TSentryGrantOption.UNSET) {
- throw new SentryInvalidInputException("Invalid Privilege input," +
- " UNSET option for GRANT <PRIVILEGE> is not valid");
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/validator/RevokePrivilegeRequestValidator.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/validator/RevokePrivilegeRequestValidator.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/validator/RevokePrivilegeRequestValidator.java
deleted file mode 100644
index da4f0e9..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/validator/RevokePrivilegeRequestValidator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift.validator;
-
-import org.apache.sentry.core.common.exception.SentryInvalidInputException;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleRevokePrivilegeRequest;
-
-/**
- * Check's for mandatory fields in the privileges
- */
-public final class RevokePrivilegeRequestValidator {
- private RevokePrivilegeRequestValidator() {
- }
-
- /**
- * Validates privileges in input request by making sure mandatory fields like
- * server name and action in the privileges are not empty and see all the values in the
- * request are valid.
- *
- * @param request to be validated.
- * @throws SentryInvalidInputException If all the mandatory fields in the privileges are
- * not present [OR] invalid fields a provided in request.
- */
- public static void validate(TAlterSentryRoleRevokePrivilegeRequest request)
- throws SentryInvalidInputException {
- if (request.isSetPrivileges() && (!request.getPrivileges().isEmpty())) {
- GrantPrivilegeRequestValidator.checkForMandatoryFieldsInPrivileges(request.getPrivileges());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/FullUpdateInitializer.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/FullUpdateInitializer.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/FullUpdateInitializer.java
index d62196f..992d8ab 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/FullUpdateInitializer.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/FullUpdateInitializer.java
@@ -27,7 +27,7 @@ import org.apache.hadoop.hive.metastore.api.Table;
import org.apache.sentry.hdfs.PathsUpdate;
import org.apache.sentry.hdfs.SentryMalformedPathException;
import org.apache.sentry.hdfs.ServiceConstants.ServerConfig;
-import org.apache.sentry.provider.db.service.thrift.SentryMetrics;
+import org.apache.sentry.api.service.thrift.SentryMetrics;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/GSSCallback.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/GSSCallback.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/GSSCallback.java
index b668b95..d2d85d3 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/GSSCallback.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/GSSCallback.java
@@ -27,7 +27,7 @@ import javax.security.sasl.AuthorizeCallback;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.security.SaslRpcServer;
import org.apache.sentry.core.common.exception.ConnectionDeniedException;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
public class GSSCallback extends SaslRpcServer.SaslGssCallbackHandler {
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/HiveSimpleConnectionFactory.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/HiveSimpleConnectionFactory.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/HiveSimpleConnectionFactory.java
index 6a19e6b..31e58fd 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/HiveSimpleConnectionFactory.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/HiveSimpleConnectionFactory.java
@@ -34,7 +34,7 @@ import org.apache.hadoop.security.SaslRpcServer;
import org.apache.hadoop.security.SecurityUtil;
import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryHMSClient.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryHMSClient.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryHMSClient.java
index 6fe9b4e..b9a0563 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryHMSClient.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryHMSClient.java
@@ -33,7 +33,7 @@ import org.apache.hadoop.hive.metastore.messaging.MessageDeserializer;
import org.apache.sentry.binding.metastore.messaging.json.SentryJSONMessageDeserializer;
import org.apache.sentry.provider.db.service.persistent.PathsImage;
import org.apache.sentry.provider.db.service.persistent.SentryStore;
-import org.apache.sentry.provider.db.service.thrift.SentryMetrics;
+import org.apache.sentry.api.service.thrift.SentryMetrics;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
index 4236c02..d92ec21 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
@@ -47,16 +47,18 @@ import org.apache.hadoop.security.SaslRpcServer;
import org.apache.hadoop.security.SaslRpcServer.AuthMethod;
import org.apache.hadoop.security.SecurityUtil;
import org.apache.sentry.Command;
+import org.apache.sentry.api.common.SentryServiceUtil;
import org.apache.sentry.core.common.utils.SigUtils;
import org.apache.sentry.provider.db.service.persistent.HMSFollower;
import org.apache.sentry.provider.db.service.persistent.LeaderStatusMonitor;
import org.apache.sentry.provider.db.service.persistent.SentryStore;
-import org.apache.sentry.provider.db.service.thrift.SentryHealthCheckServletContextListener;
-import org.apache.sentry.provider.db.service.thrift.SentryMetrics;
-import org.apache.sentry.provider.db.service.thrift.SentryMetricsServletContextListener;
-import org.apache.sentry.provider.db.service.thrift.SentryWebServer;
-import org.apache.sentry.service.thrift.ServiceConstants.ConfUtilties;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
+import org.apache.sentry.api.service.thrift.SentryHealthCheckServletContextListener;
+import org.apache.sentry.api.service.thrift.SentryMetrics;
+import org.apache.sentry.api.service.thrift.SentryMetricsServletContextListener;
+import org.apache.sentry.api.service.thrift.SentryWebServer;
+import org.apache.sentry.service.common.ServiceConstants;
+import org.apache.sentry.service.common.ServiceConstants.ConfUtilties;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
import org.apache.thrift.TMultiplexedProcessor;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.server.TServer;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryServiceClientFactory.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryServiceClientFactory.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryServiceClientFactory.java
index 1324bd9..d146a0d 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryServiceClientFactory.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryServiceClientFactory.java
@@ -23,8 +23,8 @@ import org.apache.sentry.core.common.transport.RetryClientInvocationHandler;
import org.apache.sentry.core.common.transport.SentryPolicyClientTransportConfig;
import org.apache.sentry.core.common.transport.SentryTransportFactory;
import org.apache.sentry.core.common.transport.SentryTransportPool;
-import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient;
-import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClientDefaultImpl;
+import org.apache.sentry.api.service.thrift.SentryPolicyServiceClient;
+import org.apache.sentry.api.service.thrift.SentryPolicyServiceClientDefaultImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
[35/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeResponse.java
deleted file mode 100644
index 2b3b155..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeResponse.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/**
- * 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.provider.db.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 TAlterSentryRoleRevokePrivilegeResponse implements org.apache.thrift.TBase<TAlterSentryRoleRevokePrivilegeResponse, TAlterSentryRoleRevokePrivilegeResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleRevokePrivilegeResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleRevokePrivilegeResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleRevokePrivilegeResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleRevokePrivilegeResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.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)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleRevokePrivilegeResponse.class, metaDataMap);
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse() {
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleRevokePrivilegeResponse(TAlterSentryRoleRevokePrivilegeResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse deepCopy() {
- return new TAlterSentryRoleRevokePrivilegeResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleRevokePrivilegeResponse)
- return this.equals((TAlterSentryRoleRevokePrivilegeResponse)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleRevokePrivilegeResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleRevokePrivilegeResponse 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;
- }
- }
- 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("TAlterSentryRoleRevokePrivilegeResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // 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 {
- 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 TAlterSentryRoleRevokePrivilegeResponseStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleRevokePrivilegeResponseStandardScheme getScheme() {
- return new TAlterSentryRoleRevokePrivilegeResponseStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleRevokePrivilegeResponseStandardScheme extends StandardScheme<TAlterSentryRoleRevokePrivilegeResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleRevokePrivilegeResponse 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;
- 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, TAlterSentryRoleRevokePrivilegeResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleRevokePrivilegeResponseTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleRevokePrivilegeResponseTupleScheme getScheme() {
- return new TAlterSentryRoleRevokePrivilegeResponseTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleRevokePrivilegeResponseTupleScheme extends TupleScheme<TAlterSentryRoleRevokePrivilegeResponse> {
-
- @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 read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeResponse 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);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleRequest.java
deleted file mode 100644
index 24e185e..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleRequest.java
+++ /dev/null
@@ -1,591 +0,0 @@
-/**
- * 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.provider.db.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 TCreateSentryRoleRequest implements org.apache.thrift.TBase<TCreateSentryRoleRequest, TCreateSentryRoleRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TCreateSentryRoleRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCreateSentryRoleRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TCreateSentryRoleRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TCreateSentryRoleRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TCreateSentryRoleRequest.class, metaDataMap);
- }
-
- public TCreateSentryRoleRequest() {
- this.protocol_version = 2;
-
- }
-
- public TCreateSentryRoleRequest(
- int protocol_version,
- String requestorUserName,
- String roleName)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TCreateSentryRoleRequest(TCreateSentryRoleRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- }
-
- public TCreateSentryRoleRequest deepCopy() {
- return new TCreateSentryRoleRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.roleName = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TCreateSentryRoleRequest)
- return this.equals((TCreateSentryRoleRequest)that);
- return false;
- }
-
- public boolean equals(TCreateSentryRoleRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TCreateSentryRoleRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- 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("TCreateSentryRoleRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TCreateSentryRoleRequestStandardSchemeFactory implements SchemeFactory {
- public TCreateSentryRoleRequestStandardScheme getScheme() {
- return new TCreateSentryRoleRequestStandardScheme();
- }
- }
-
- private static class TCreateSentryRoleRequestStandardScheme extends StandardScheme<TCreateSentryRoleRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TCreateSentryRoleRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(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, TCreateSentryRoleRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TCreateSentryRoleRequestTupleSchemeFactory implements SchemeFactory {
- public TCreateSentryRoleRequestTupleScheme getScheme() {
- return new TCreateSentryRoleRequestTupleScheme();
- }
- }
-
- private static class TCreateSentryRoleRequestTupleScheme extends TupleScheme<TCreateSentryRoleRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleResponse.java
deleted file mode 100644
index 787af20..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleResponse.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/**
- * 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.provider.db.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 TCreateSentryRoleResponse implements org.apache.thrift.TBase<TCreateSentryRoleResponse, TCreateSentryRoleResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TCreateSentryRoleResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCreateSentryRoleResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TCreateSentryRoleResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TCreateSentryRoleResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.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)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TCreateSentryRoleResponse.class, metaDataMap);
- }
-
- public TCreateSentryRoleResponse() {
- }
-
- public TCreateSentryRoleResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TCreateSentryRoleResponse(TCreateSentryRoleResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- }
-
- public TCreateSentryRoleResponse deepCopy() {
- return new TCreateSentryRoleResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TCreateSentryRoleResponse)
- return this.equals((TCreateSentryRoleResponse)that);
- return false;
- }
-
- public boolean equals(TCreateSentryRoleResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TCreateSentryRoleResponse 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;
- }
- }
- 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("TCreateSentryRoleResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // 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 {
- 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 TCreateSentryRoleResponseStandardSchemeFactory implements SchemeFactory {
- public TCreateSentryRoleResponseStandardScheme getScheme() {
- return new TCreateSentryRoleResponseStandardScheme();
- }
- }
-
- private static class TCreateSentryRoleResponseStandardScheme extends StandardScheme<TCreateSentryRoleResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TCreateSentryRoleResponse 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;
- 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, TCreateSentryRoleResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TCreateSentryRoleResponseTupleSchemeFactory implements SchemeFactory {
- public TCreateSentryRoleResponseTupleScheme getScheme() {
- return new TCreateSentryRoleResponseTupleScheme();
- }
- }
-
- private static class TCreateSentryRoleResponseTupleScheme extends TupleScheme<TCreateSentryRoleResponse> {
-
- @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 read(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleResponse 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);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesRequest.java
deleted file mode 100644
index 1486af7..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesRequest.java
+++ /dev/null
@@ -1,596 +0,0 @@
-/**
- * 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.provider.db.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 TDropPrivilegesRequest implements org.apache.thrift.TBase<TDropPrivilegesRequest, TDropPrivilegesRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TDropPrivilegesRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropPrivilegesRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- 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)3);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TDropPrivilegesRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TDropPrivilegesRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- AUTHORIZABLE((short)3, "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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", 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(TDropPrivilegesRequest.class, metaDataMap);
- }
-
- public TDropPrivilegesRequest() {
- this.protocol_version = 2;
-
- }
-
- public TDropPrivilegesRequest(
- int protocol_version,
- String requestorUserName,
- TSentryAuthorizable authorizable)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.authorizable = authorizable;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TDropPrivilegesRequest(TDropPrivilegesRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetAuthorizable()) {
- this.authorizable = new TSentryAuthorizable(other.authorizable);
- }
- }
-
- public TDropPrivilegesRequest deepCopy() {
- return new TDropPrivilegesRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((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 REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case AUTHORIZABLE:
- return isSetAuthorizable();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TDropPrivilegesRequest)
- return this.equals((TDropPrivilegesRequest)that);
- return false;
- }
-
- public boolean equals(TDropPrivilegesRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_authorizable = true && (isSetAuthorizable());
- list.add(present_authorizable);
- if (present_authorizable)
- list.add(authorizable);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TDropPrivilegesRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- 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("TDropPrivilegesRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' 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 TDropPrivilegesRequestStandardSchemeFactory implements SchemeFactory {
- public TDropPrivilegesRequestStandardScheme getScheme() {
- return new TDropPrivilegesRequestStandardScheme();
- }
- }
-
- private static class TDropPrivilegesRequestStandardScheme extends StandardScheme<TDropPrivilegesRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TDropPrivilegesRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // 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, TDropPrivilegesRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.authorizable != null) {
- oprot.writeFieldBegin(AUTHORIZABLE_FIELD_DESC);
- struct.authorizable.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TDropPrivilegesRequestTupleSchemeFactory implements SchemeFactory {
- public TDropPrivilegesRequestTupleScheme getScheme() {
- return new TDropPrivilegesRequestTupleScheme();
- }
- }
-
- private static class TDropPrivilegesRequestTupleScheme extends TupleScheme<TDropPrivilegesRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- struct.authorizable.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.authorizable = new TSentryAuthorizable();
- struct.authorizable.read(iprot);
- struct.setAuthorizableIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesResponse.java
deleted file mode 100644
index 64897b6..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesResponse.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/**
- * 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.provider.db.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 TDropPrivilegesResponse implements org.apache.thrift.TBase<TDropPrivilegesResponse, TDropPrivilegesResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TDropPrivilegesResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropPrivilegesResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TDropPrivilegesResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TDropPrivilegesResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.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)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropPrivilegesResponse.class, metaDataMap);
- }
-
- public TDropPrivilegesResponse() {
- }
-
- public TDropPrivilegesResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TDropPrivilegesResponse(TDropPrivilegesResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- }
-
- public TDropPrivilegesResponse deepCopy() {
- return new TDropPrivilegesResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TDropPrivilegesResponse)
- return this.equals((TDropPrivilegesResponse)that);
- return false;
- }
-
- public boolean equals(TDropPrivilegesResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TDropPrivilegesResponse 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;
- }
- }
- 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("TDropPrivilegesResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // 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 {
- 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 TDropPrivilegesResponseStandardSchemeFactory implements SchemeFactory {
- public TDropPrivilegesResponseStandardScheme getScheme() {
- return new TDropPrivilegesResponseStandardScheme();
- }
- }
-
- private static class TDropPrivilegesResponseStandardScheme extends StandardScheme<TDropPrivilegesResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TDropPrivilegesResponse 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;
- 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, TDropPrivilegesResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TDropPrivilegesResponseTupleSchemeFactory implements SchemeFactory {
- public TDropPrivilegesResponseTupleScheme getScheme() {
- return new TDropPrivilegesResponseTupleScheme();
- }
- }
-
- private static class TDropPrivilegesResponseTupleScheme extends TupleScheme<TDropPrivilegesResponse> {
-
- @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 read(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesResponse 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);
- }
- }
-
-}
-
[38/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsRequest.java
deleted file mode 100644
index bf255ed..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsRequest.java
+++ /dev/null
@@ -1,746 +0,0 @@
-/**
- * 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.provider.db.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 TAlterSentryRoleAddGroupsRequest implements org.apache.thrift.TBase<TAlterSentryRoleAddGroupsRequest, TAlterSentryRoleAddGroupsRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleAddGroupsRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleAddGroupsRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)5);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleAddGroupsRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleAddGroupsRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private Set<TSentryGroup> groups; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName"),
- GROUPS((short)5, "groups");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- case 5: // GROUPS
- return GROUPS;
- 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryGroup.class))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleAddGroupsRequest.class, metaDataMap);
- }
-
- public TAlterSentryRoleAddGroupsRequest() {
- this.protocol_version = 2;
-
- }
-
- public TAlterSentryRoleAddGroupsRequest(
- int protocol_version,
- String requestorUserName,
- String roleName,
- Set<TSentryGroup> groups)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- this.groups = groups;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleAddGroupsRequest(TAlterSentryRoleAddGroupsRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetGroups()) {
- Set<TSentryGroup> __this__groups = new HashSet<TSentryGroup>(other.groups.size());
- for (TSentryGroup other_element : other.groups) {
- __this__groups.add(new TSentryGroup(other_element));
- }
- this.groups = __this__groups;
- }
- }
-
- public TAlterSentryRoleAddGroupsRequest deepCopy() {
- return new TAlterSentryRoleAddGroupsRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.groups = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public int getGroupsSize() {
- return (this.groups == null) ? 0 : this.groups.size();
- }
-
- public java.util.Iterator<TSentryGroup> getGroupsIterator() {
- return (this.groups == null) ? null : this.groups.iterator();
- }
-
- public void addToGroups(TSentryGroup elem) {
- if (this.groups == null) {
- this.groups = new HashSet<TSentryGroup>();
- }
- this.groups.add(elem);
- }
-
- public Set<TSentryGroup> getGroups() {
- return this.groups;
- }
-
- public void setGroups(Set<TSentryGroup> groups) {
- this.groups = groups;
- }
-
- public void unsetGroups() {
- this.groups = null;
- }
-
- /** Returns true if field groups is set (has been assigned a value) and false otherwise */
- public boolean isSetGroups() {
- return this.groups != null;
- }
-
- public void setGroupsIsSet(boolean value) {
- if (!value) {
- this.groups = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case GROUPS:
- if (value == null) {
- unsetGroups();
- } else {
- setGroups((Set<TSentryGroup>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case GROUPS:
- return getGroups();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case GROUPS:
- return isSetGroups();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleAddGroupsRequest)
- return this.equals((TAlterSentryRoleAddGroupsRequest)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleAddGroupsRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- boolean this_present_groups = true && this.isSetGroups();
- boolean that_present_groups = true && that.isSetGroups();
- if (this_present_groups || that_present_groups) {
- if (!(this_present_groups && that_present_groups))
- return false;
- if (!this.groups.equals(that.groups))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- boolean present_groups = true && (isSetGroups());
- list.add(present_groups);
- if (present_groups)
- list.add(groups);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleAddGroupsRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGroups()).compareTo(other.isSetGroups());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroups()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, other.groups);
- 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("TAlterSentryRoleAddGroupsRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("groups:");
- if (this.groups == null) {
- sb.append("null");
- } else {
- sb.append(this.groups);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- if (!isSetGroups()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'groups' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TAlterSentryRoleAddGroupsRequestStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleAddGroupsRequestStandardScheme getScheme() {
- return new TAlterSentryRoleAddGroupsRequestStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleAddGroupsRequestStandardScheme extends StandardScheme<TAlterSentryRoleAddGroupsRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleAddGroupsRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // GROUPS
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set0 = iprot.readSetBegin();
- struct.groups = new HashSet<TSentryGroup>(2*_set0.size);
- TSentryGroup _elem1;
- for (int _i2 = 0; _i2 < _set0.size; ++_i2)
- {
- _elem1 = new TSentryGroup();
- _elem1.read(iprot);
- struct.groups.add(_elem1);
- }
- iprot.readSetEnd();
- }
- struct.setGroupsIsSet(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, TAlterSentryRoleAddGroupsRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.groups != null) {
- oprot.writeFieldBegin(GROUPS_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.groups.size()));
- for (TSentryGroup _iter3 : struct.groups)
- {
- _iter3.write(oprot);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleAddGroupsRequestTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleAddGroupsRequestTupleScheme getScheme() {
- return new TAlterSentryRoleAddGroupsRequestTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleAddGroupsRequestTupleScheme extends TupleScheme<TAlterSentryRoleAddGroupsRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- {
- oprot.writeI32(struct.groups.size());
- for (TSentryGroup _iter4 : struct.groups)
- {
- _iter4.write(oprot);
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set5 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.groups = new HashSet<TSentryGroup>(2*_set5.size);
- TSentryGroup _elem6;
- for (int _i7 = 0; _i7 < _set5.size; ++_i7)
- {
- _elem6 = new TSentryGroup();
- _elem6.read(iprot);
- struct.groups.add(_elem6);
- }
- }
- struct.setGroupsIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsResponse.java
deleted file mode 100644
index f1e01b8..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsResponse.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/**
- * 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.provider.db.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 TAlterSentryRoleAddGroupsResponse implements org.apache.thrift.TBase<TAlterSentryRoleAddGroupsResponse, TAlterSentryRoleAddGroupsResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleAddGroupsResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleAddGroupsResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleAddGroupsResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleAddGroupsResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.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)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleAddGroupsResponse.class, metaDataMap);
- }
-
- public TAlterSentryRoleAddGroupsResponse() {
- }
-
- public TAlterSentryRoleAddGroupsResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleAddGroupsResponse(TAlterSentryRoleAddGroupsResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- }
-
- public TAlterSentryRoleAddGroupsResponse deepCopy() {
- return new TAlterSentryRoleAddGroupsResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleAddGroupsResponse)
- return this.equals((TAlterSentryRoleAddGroupsResponse)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleAddGroupsResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleAddGroupsResponse 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;
- }
- }
- 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("TAlterSentryRoleAddGroupsResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // 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 {
- 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 TAlterSentryRoleAddGroupsResponseStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleAddGroupsResponseStandardScheme getScheme() {
- return new TAlterSentryRoleAddGroupsResponseStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleAddGroupsResponseStandardScheme extends StandardScheme<TAlterSentryRoleAddGroupsResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleAddGroupsResponse 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;
- 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, TAlterSentryRoleAddGroupsResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleAddGroupsResponseTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleAddGroupsResponseTupleScheme getScheme() {
- return new TAlterSentryRoleAddGroupsResponseTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleAddGroupsResponseTupleScheme extends TupleScheme<TAlterSentryRoleAddGroupsResponse> {
-
- @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);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsResponse 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);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddUsersRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddUsersRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddUsersRequest.java
deleted file mode 100644
index 7490ce9..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddUsersRequest.java
+++ /dev/null
@@ -1,741 +0,0 @@
-/**
- * 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.provider.db.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 TAlterSentryRoleAddUsersRequest implements org.apache.thrift.TBase<TAlterSentryRoleAddUsersRequest, TAlterSentryRoleAddUsersRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleAddUsersRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleAddUsersRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField USERS_FIELD_DESC = new org.apache.thrift.protocol.TField("users", org.apache.thrift.protocol.TType.SET, (short)4);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleAddUsersRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleAddUsersRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private Set<String> users; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName"),
- USERS((short)4, "users");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- case 4: // USERS
- return USERS;
- 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.USERS, new org.apache.thrift.meta_data.FieldMetaData("users", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleAddUsersRequest.class, metaDataMap);
- }
-
- public TAlterSentryRoleAddUsersRequest() {
- this.protocol_version = 1;
-
- }
-
- public TAlterSentryRoleAddUsersRequest(
- int protocol_version,
- String requestorUserName,
- String roleName,
- Set<String> users)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- this.users = users;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleAddUsersRequest(TAlterSentryRoleAddUsersRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetUsers()) {
- Set<String> __this__users = new HashSet<String>(other.users);
- this.users = __this__users;
- }
- }
-
- public TAlterSentryRoleAddUsersRequest deepCopy() {
- return new TAlterSentryRoleAddUsersRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 1;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.users = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public int getUsersSize() {
- return (this.users == null) ? 0 : this.users.size();
- }
-
- public java.util.Iterator<String> getUsersIterator() {
- return (this.users == null) ? null : this.users.iterator();
- }
-
- public void addToUsers(String elem) {
- if (this.users == null) {
- this.users = new HashSet<String>();
- }
- this.users.add(elem);
- }
-
- public Set<String> getUsers() {
- return this.users;
- }
-
- public void setUsers(Set<String> users) {
- this.users = users;
- }
-
- public void unsetUsers() {
- this.users = null;
- }
-
- /** Returns true if field users is set (has been assigned a value) and false otherwise */
- public boolean isSetUsers() {
- return this.users != null;
- }
-
- public void setUsersIsSet(boolean value) {
- if (!value) {
- this.users = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case USERS:
- if (value == null) {
- unsetUsers();
- } else {
- setUsers((Set<String>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case USERS:
- return getUsers();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case USERS:
- return isSetUsers();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleAddUsersRequest)
- return this.equals((TAlterSentryRoleAddUsersRequest)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleAddUsersRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- boolean this_present_users = true && this.isSetUsers();
- boolean that_present_users = true && that.isSetUsers();
- if (this_present_users || that_present_users) {
- if (!(this_present_users && that_present_users))
- return false;
- if (!this.users.equals(that.users))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- boolean present_users = true && (isSetUsers());
- list.add(present_users);
- if (present_users)
- list.add(users);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleAddUsersRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetUsers()).compareTo(other.isSetUsers());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetUsers()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.users, other.users);
- 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("TAlterSentryRoleAddUsersRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("users:");
- if (this.users == null) {
- sb.append("null");
- } else {
- sb.append(this.users);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- if (!isSetUsers()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'users' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TAlterSentryRoleAddUsersRequestStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleAddUsersRequestStandardScheme getScheme() {
- return new TAlterSentryRoleAddUsersRequestStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleAddUsersRequestStandardScheme extends StandardScheme<TAlterSentryRoleAddUsersRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleAddUsersRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // USERS
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set8 = iprot.readSetBegin();
- struct.users = new HashSet<String>(2*_set8.size);
- String _elem9;
- for (int _i10 = 0; _i10 < _set8.size; ++_i10)
- {
- _elem9 = iprot.readString();
- struct.users.add(_elem9);
- }
- iprot.readSetEnd();
- }
- struct.setUsersIsSet(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, TAlterSentryRoleAddUsersRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.users != null) {
- oprot.writeFieldBegin(USERS_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.users.size()));
- for (String _iter11 : struct.users)
- {
- oprot.writeString(_iter11);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleAddUsersRequestTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleAddUsersRequestTupleScheme getScheme() {
- return new TAlterSentryRoleAddUsersRequestTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleAddUsersRequestTupleScheme extends TupleScheme<TAlterSentryRoleAddUsersRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddUsersRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- {
- oprot.writeI32(struct.users.size());
- for (String _iter12 : struct.users)
- {
- oprot.writeString(_iter12);
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddUsersRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set13 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.users = new HashSet<String>(2*_set13.size);
- String _elem14;
- for (int _i15 = 0; _i15 < _set13.size; ++_i15)
- {
- _elem14 = iprot.readString();
- struct.users.add(_elem14);
- }
- }
- struct.setUsersIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddUsersResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddUsersResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddUsersResponse.java
deleted file mode 100644
index 5ea8977..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddUsersResponse.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/**
- * 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.provider.db.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 TAlterSentryRoleAddUsersResponse implements org.apache.thrift.TBase<TAlterSentryRoleAddUsersResponse, TAlterSentryRoleAddUsersResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleAddUsersResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleAddUsersResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleAddUsersResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleAddUsersResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.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)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleAddUsersResponse.class, metaDataMap);
- }
-
- public TAlterSentryRoleAddUsersResponse() {
- }
-
- public TAlterSentryRoleAddUsersResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleAddUsersResponse(TAlterSentryRoleAddUsersResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- }
-
- public TAlterSentryRoleAddUsersResponse deepCopy() {
- return new TAlterSentryRoleAddUsersResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleAddUsersResponse)
- return this.equals((TAlterSentryRoleAddUsersResponse)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleAddUsersResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleAddUsersResponse 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;
- }
- }
- 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("TAlterSentryRoleAddUsersResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // 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 {
- 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 TAlterSentryRoleAddUsersResponseStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleAddUsersResponseStandardScheme getScheme() {
- return new TAlterSentryRoleAddUsersResponseStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleAddUsersResponseStandardScheme extends StandardScheme<TAlterSentryRoleAddUsersResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleAddUsersResponse 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;
- 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, TAlterSentryRoleAddUsersResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleAddUsersResponseTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleAddUsersResponseTupleScheme getScheme() {
- return new TAlterSentryRoleAddUsersResponseTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleAddUsersResponseTupleScheme extends TupleScheme<TAlterSentryRoleAddUsersResponse> {
-
- @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 read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddUsersResponse 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);
- }
- }
-
-}
-
[44/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesByAuthRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesByAuthRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesByAuthRequest.java
deleted file mode 100644
index 85435c9..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesByAuthRequest.java
+++ /dev/null
@@ -1,1112 +0,0 @@
-/**
- * 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.provider.db.generic.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 TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBase<TListSentryPrivilegesByAuthRequest, TListSentryPrivilegesByAuthRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesByAuthRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesByAuthRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField SERVICE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("serviceName", org.apache.thrift.protocol.TType.STRING, (short)4);
- private static final org.apache.thrift.protocol.TField AUTHORIZABLES_SET_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizablesSet", org.apache.thrift.protocol.TType.SET, (short)5);
- private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)6);
- private static final org.apache.thrift.protocol.TField ROLE_SET_FIELD_DESC = new org.apache.thrift.protocol.TField("roleSet", org.apache.thrift.protocol.TType.STRUCT, (short)7);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryPrivilegesByAuthRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryPrivilegesByAuthRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String component; // required
- private String serviceName; // required
- private Set<String> authorizablesSet; // required
- private Set<String> groups; // optional
- private TSentryActiveRoleSet roleSet; // optional
-
- /** 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- COMPONENT((short)3, "component"),
- SERVICE_NAME((short)4, "serviceName"),
- AUTHORIZABLES_SET((short)5, "authorizablesSet"),
- GROUPS((short)6, "groups"),
- ROLE_SET((short)7, "roleSet");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // COMPONENT
- return COMPONENT;
- case 4: // SERVICE_NAME
- return SERVICE_NAME;
- case 5: // AUTHORIZABLES_SET
- return AUTHORIZABLES_SET;
- case 6: // GROUPS
- return GROUPS;
- case 7: // ROLE_SET
- return ROLE_SET;
- 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 byte __isset_bitfield = 0;
- private static final _Fields optionals[] = {_Fields.GROUPS,_Fields.ROLE_SET};
- 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.SERVICE_NAME, new org.apache.thrift.meta_data.FieldMetaData("serviceName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.AUTHORIZABLES_SET, new org.apache.thrift.meta_data.FieldMetaData("authorizablesSet", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- tmpMap.put(_Fields.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- tmpMap.put(_Fields.ROLE_SET, new org.apache.thrift.meta_data.FieldMetaData("roleSet", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryActiveRoleSet.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesByAuthRequest.class, metaDataMap);
- }
-
- public TListSentryPrivilegesByAuthRequest() {
- this.protocol_version = 2;
-
- }
-
- public TListSentryPrivilegesByAuthRequest(
- int protocol_version,
- String requestorUserName,
- String component,
- String serviceName,
- Set<String> authorizablesSet)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.component = component;
- this.serviceName = serviceName;
- this.authorizablesSet = authorizablesSet;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryPrivilegesByAuthRequest(TListSentryPrivilegesByAuthRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetComponent()) {
- this.component = other.component;
- }
- if (other.isSetServiceName()) {
- this.serviceName = other.serviceName;
- }
- if (other.isSetAuthorizablesSet()) {
- Set<String> __this__authorizablesSet = new HashSet<String>(other.authorizablesSet);
- this.authorizablesSet = __this__authorizablesSet;
- }
- if (other.isSetGroups()) {
- Set<String> __this__groups = new HashSet<String>(other.groups);
- this.groups = __this__groups;
- }
- if (other.isSetRoleSet()) {
- this.roleSet = new TSentryActiveRoleSet(other.roleSet);
- }
- }
-
- public TListSentryPrivilegesByAuthRequest deepCopy() {
- return new TListSentryPrivilegesByAuthRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.component = null;
- this.serviceName = null;
- this.authorizablesSet = null;
- this.groups = null;
- this.roleSet = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getComponent() {
- return this.component;
- }
-
- public void setComponent(String component) {
- this.component = component;
- }
-
- public void unsetComponent() {
- this.component = null;
- }
-
- /** Returns true if field component is set (has been assigned a value) and false otherwise */
- public boolean isSetComponent() {
- return this.component != null;
- }
-
- public void setComponentIsSet(boolean value) {
- if (!value) {
- this.component = null;
- }
- }
-
- public String getServiceName() {
- return this.serviceName;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- public void unsetServiceName() {
- this.serviceName = null;
- }
-
- /** Returns true if field serviceName is set (has been assigned a value) and false otherwise */
- public boolean isSetServiceName() {
- return this.serviceName != null;
- }
-
- public void setServiceNameIsSet(boolean value) {
- if (!value) {
- this.serviceName = null;
- }
- }
-
- public int getAuthorizablesSetSize() {
- return (this.authorizablesSet == null) ? 0 : this.authorizablesSet.size();
- }
-
- public java.util.Iterator<String> getAuthorizablesSetIterator() {
- return (this.authorizablesSet == null) ? null : this.authorizablesSet.iterator();
- }
-
- public void addToAuthorizablesSet(String elem) {
- if (this.authorizablesSet == null) {
- this.authorizablesSet = new HashSet<String>();
- }
- this.authorizablesSet.add(elem);
- }
-
- public Set<String> getAuthorizablesSet() {
- return this.authorizablesSet;
- }
-
- public void setAuthorizablesSet(Set<String> authorizablesSet) {
- this.authorizablesSet = authorizablesSet;
- }
-
- public void unsetAuthorizablesSet() {
- this.authorizablesSet = null;
- }
-
- /** Returns true if field authorizablesSet is set (has been assigned a value) and false otherwise */
- public boolean isSetAuthorizablesSet() {
- return this.authorizablesSet != null;
- }
-
- public void setAuthorizablesSetIsSet(boolean value) {
- if (!value) {
- this.authorizablesSet = null;
- }
- }
-
- public int getGroupsSize() {
- return (this.groups == null) ? 0 : this.groups.size();
- }
-
- public java.util.Iterator<String> getGroupsIterator() {
- return (this.groups == null) ? null : this.groups.iterator();
- }
-
- public void addToGroups(String elem) {
- if (this.groups == null) {
- this.groups = new HashSet<String>();
- }
- this.groups.add(elem);
- }
-
- public Set<String> getGroups() {
- return this.groups;
- }
-
- public void setGroups(Set<String> groups) {
- this.groups = groups;
- }
-
- public void unsetGroups() {
- this.groups = null;
- }
-
- /** Returns true if field groups is set (has been assigned a value) and false otherwise */
- public boolean isSetGroups() {
- return this.groups != null;
- }
-
- public void setGroupsIsSet(boolean value) {
- if (!value) {
- this.groups = null;
- }
- }
-
- public TSentryActiveRoleSet getRoleSet() {
- return this.roleSet;
- }
-
- public void setRoleSet(TSentryActiveRoleSet roleSet) {
- this.roleSet = roleSet;
- }
-
- public void unsetRoleSet() {
- this.roleSet = null;
- }
-
- /** Returns true if field roleSet is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleSet() {
- return this.roleSet != null;
- }
-
- public void setRoleSetIsSet(boolean value) {
- if (!value) {
- this.roleSet = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case COMPONENT:
- if (value == null) {
- unsetComponent();
- } else {
- setComponent((String)value);
- }
- break;
-
- case SERVICE_NAME:
- if (value == null) {
- unsetServiceName();
- } else {
- setServiceName((String)value);
- }
- break;
-
- case AUTHORIZABLES_SET:
- if (value == null) {
- unsetAuthorizablesSet();
- } else {
- setAuthorizablesSet((Set<String>)value);
- }
- break;
-
- case GROUPS:
- if (value == null) {
- unsetGroups();
- } else {
- setGroups((Set<String>)value);
- }
- break;
-
- case ROLE_SET:
- if (value == null) {
- unsetRoleSet();
- } else {
- setRoleSet((TSentryActiveRoleSet)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case COMPONENT:
- return getComponent();
-
- case SERVICE_NAME:
- return getServiceName();
-
- case AUTHORIZABLES_SET:
- return getAuthorizablesSet();
-
- case GROUPS:
- return getGroups();
-
- case ROLE_SET:
- return getRoleSet();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case COMPONENT:
- return isSetComponent();
- case SERVICE_NAME:
- return isSetServiceName();
- case AUTHORIZABLES_SET:
- return isSetAuthorizablesSet();
- case GROUPS:
- return isSetGroups();
- case ROLE_SET:
- return isSetRoleSet();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryPrivilegesByAuthRequest)
- return this.equals((TListSentryPrivilegesByAuthRequest)that);
- return false;
- }
-
- public boolean equals(TListSentryPrivilegesByAuthRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_component = true && this.isSetComponent();
- boolean that_present_component = true && that.isSetComponent();
- if (this_present_component || that_present_component) {
- if (!(this_present_component && that_present_component))
- return false;
- if (!this.component.equals(that.component))
- return false;
- }
-
- boolean this_present_serviceName = true && this.isSetServiceName();
- boolean that_present_serviceName = true && that.isSetServiceName();
- if (this_present_serviceName || that_present_serviceName) {
- if (!(this_present_serviceName && that_present_serviceName))
- return false;
- if (!this.serviceName.equals(that.serviceName))
- return false;
- }
-
- boolean this_present_authorizablesSet = true && this.isSetAuthorizablesSet();
- boolean that_present_authorizablesSet = true && that.isSetAuthorizablesSet();
- if (this_present_authorizablesSet || that_present_authorizablesSet) {
- if (!(this_present_authorizablesSet && that_present_authorizablesSet))
- return false;
- if (!this.authorizablesSet.equals(that.authorizablesSet))
- return false;
- }
-
- boolean this_present_groups = true && this.isSetGroups();
- boolean that_present_groups = true && that.isSetGroups();
- if (this_present_groups || that_present_groups) {
- if (!(this_present_groups && that_present_groups))
- return false;
- if (!this.groups.equals(that.groups))
- return false;
- }
-
- boolean this_present_roleSet = true && this.isSetRoleSet();
- boolean that_present_roleSet = true && that.isSetRoleSet();
- if (this_present_roleSet || that_present_roleSet) {
- if (!(this_present_roleSet && that_present_roleSet))
- return false;
- if (!this.roleSet.equals(that.roleSet))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_component = true && (isSetComponent());
- list.add(present_component);
- if (present_component)
- list.add(component);
-
- boolean present_serviceName = true && (isSetServiceName());
- list.add(present_serviceName);
- if (present_serviceName)
- list.add(serviceName);
-
- boolean present_authorizablesSet = true && (isSetAuthorizablesSet());
- list.add(present_authorizablesSet);
- if (present_authorizablesSet)
- list.add(authorizablesSet);
-
- boolean present_groups = true && (isSetGroups());
- list.add(present_groups);
- if (present_groups)
- list.add(groups);
-
- boolean present_roleSet = true && (isSetRoleSet());
- list.add(present_roleSet);
- if (present_roleSet)
- list.add(roleSet);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TListSentryPrivilegesByAuthRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetComponent()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetServiceName()).compareTo(other.isSetServiceName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetServiceName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serviceName, other.serviceName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetAuthorizablesSet()).compareTo(other.isSetAuthorizablesSet());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAuthorizablesSet()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizablesSet, other.authorizablesSet);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGroups()).compareTo(other.isSetGroups());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroups()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, other.groups);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleSet()).compareTo(other.isSetRoleSet());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleSet()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleSet, other.roleSet);
- 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("TListSentryPrivilegesByAuthRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("component:");
- if (this.component == null) {
- sb.append("null");
- } else {
- sb.append(this.component);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("serviceName:");
- if (this.serviceName == null) {
- sb.append("null");
- } else {
- sb.append(this.serviceName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("authorizablesSet:");
- if (this.authorizablesSet == null) {
- sb.append("null");
- } else {
- sb.append(this.authorizablesSet);
- }
- first = false;
- if (isSetGroups()) {
- if (!first) sb.append(", ");
- sb.append("groups:");
- if (this.groups == null) {
- sb.append("null");
- } else {
- sb.append(this.groups);
- }
- first = false;
- }
- if (isSetRoleSet()) {
- if (!first) sb.append(", ");
- sb.append("roleSet:");
- if (this.roleSet == null) {
- sb.append("null");
- } else {
- sb.append(this.roleSet);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetComponent()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
- }
-
- if (!isSetServiceName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'serviceName' is unset! Struct:" + toString());
- }
-
- if (!isSetAuthorizablesSet()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'authorizablesSet' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (roleSet != null) {
- roleSet.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 TListSentryPrivilegesByAuthRequestStandardSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesByAuthRequestStandardScheme getScheme() {
- return new TListSentryPrivilegesByAuthRequestStandardScheme();
- }
- }
-
- private static class TListSentryPrivilegesByAuthRequestStandardScheme extends StandardScheme<TListSentryPrivilegesByAuthRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesByAuthRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // COMPONENT
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // SERVICE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.serviceName = iprot.readString();
- struct.setServiceNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // AUTHORIZABLES_SET
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set122 = iprot.readSetBegin();
- struct.authorizablesSet = new HashSet<String>(2*_set122.size);
- String _elem123;
- for (int _i124 = 0; _i124 < _set122.size; ++_i124)
- {
- _elem123 = iprot.readString();
- struct.authorizablesSet.add(_elem123);
- }
- iprot.readSetEnd();
- }
- struct.setAuthorizablesSetIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 6: // GROUPS
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set125 = iprot.readSetBegin();
- struct.groups = new HashSet<String>(2*_set125.size);
- String _elem126;
- for (int _i127 = 0; _i127 < _set125.size; ++_i127)
- {
- _elem126 = iprot.readString();
- struct.groups.add(_elem126);
- }
- iprot.readSetEnd();
- }
- struct.setGroupsIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 7: // ROLE_SET
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.roleSet = new TSentryActiveRoleSet();
- struct.roleSet.read(iprot);
- struct.setRoleSetIsSet(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, TListSentryPrivilegesByAuthRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.component != null) {
- oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
- oprot.writeString(struct.component);
- oprot.writeFieldEnd();
- }
- if (struct.serviceName != null) {
- oprot.writeFieldBegin(SERVICE_NAME_FIELD_DESC);
- oprot.writeString(struct.serviceName);
- oprot.writeFieldEnd();
- }
- if (struct.authorizablesSet != null) {
- oprot.writeFieldBegin(AUTHORIZABLES_SET_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.authorizablesSet.size()));
- for (String _iter128 : struct.authorizablesSet)
- {
- oprot.writeString(_iter128);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- if (struct.groups != null) {
- if (struct.isSetGroups()) {
- oprot.writeFieldBegin(GROUPS_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.groups.size()));
- for (String _iter129 : struct.groups)
- {
- oprot.writeString(_iter129);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- if (struct.roleSet != null) {
- if (struct.isSetRoleSet()) {
- oprot.writeFieldBegin(ROLE_SET_FIELD_DESC);
- struct.roleSet.write(oprot);
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryPrivilegesByAuthRequestTupleSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesByAuthRequestTupleScheme getScheme() {
- return new TListSentryPrivilegesByAuthRequestTupleScheme();
- }
- }
-
- private static class TListSentryPrivilegesByAuthRequestTupleScheme extends TupleScheme<TListSentryPrivilegesByAuthRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesByAuthRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.component);
- oprot.writeString(struct.serviceName);
- {
- oprot.writeI32(struct.authorizablesSet.size());
- for (String _iter130 : struct.authorizablesSet)
- {
- oprot.writeString(_iter130);
- }
- }
- BitSet optionals = new BitSet();
- if (struct.isSetGroups()) {
- optionals.set(0);
- }
- if (struct.isSetRoleSet()) {
- optionals.set(1);
- }
- oprot.writeBitSet(optionals, 2);
- if (struct.isSetGroups()) {
- {
- oprot.writeI32(struct.groups.size());
- for (String _iter131 : struct.groups)
- {
- oprot.writeString(_iter131);
- }
- }
- }
- if (struct.isSetRoleSet()) {
- struct.roleSet.write(oprot);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesByAuthRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- struct.serviceName = iprot.readString();
- struct.setServiceNameIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set132 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.authorizablesSet = new HashSet<String>(2*_set132.size);
- String _elem133;
- for (int _i134 = 0; _i134 < _set132.size; ++_i134)
- {
- _elem133 = iprot.readString();
- struct.authorizablesSet.add(_elem133);
- }
- }
- struct.setAuthorizablesSetIsSet(true);
- BitSet incoming = iprot.readBitSet(2);
- if (incoming.get(0)) {
- {
- org.apache.thrift.protocol.TSet _set135 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.groups = new HashSet<String>(2*_set135.size);
- String _elem136;
- for (int _i137 = 0; _i137 < _set135.size; ++_i137)
- {
- _elem136 = iprot.readString();
- struct.groups.add(_elem136);
- }
- }
- struct.setGroupsIsSet(true);
- }
- if (incoming.get(1)) {
- struct.roleSet = new TSentryActiveRoleSet();
- struct.roleSet.read(iprot);
- struct.setRoleSetIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesByAuthResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesByAuthResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesByAuthResponse.java
deleted file mode 100644
index 82ff0ec..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TListSentryPrivilegesByAuthResponse.java
+++ /dev/null
@@ -1,569 +0,0 @@
-/**
- * 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.provider.db.generic.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 TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TBase<TListSentryPrivilegesByAuthResponse, TListSentryPrivilegesByAuthResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesByAuthResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesByAuthResponse");
-
- 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 PRIVILEGES_MAP_BY_AUTH_FIELD_DESC = new org.apache.thrift.protocol.TField("privilegesMapByAuth", org.apache.thrift.protocol.TType.MAP, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryPrivilegesByAuthResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryPrivilegesByAuthResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
- private Map<String,TSentryPrivilegeMap> privilegesMapByAuth; // optional
-
- /** 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"),
- PRIVILEGES_MAP_BY_AUTH((short)2, "privilegesMapByAuth");
-
- 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: // PRIVILEGES_MAP_BY_AUTH
- return PRIVILEGES_MAP_BY_AUTH;
- 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 _Fields optionals[] = {_Fields.PRIVILEGES_MAP_BY_AUTH};
- 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.PRIVILEGES_MAP_BY_AUTH, new org.apache.thrift.meta_data.FieldMetaData("privilegesMapByAuth", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilegeMap.class))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesByAuthResponse.class, metaDataMap);
- }
-
- public TListSentryPrivilegesByAuthResponse() {
- }
-
- public TListSentryPrivilegesByAuthResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryPrivilegesByAuthResponse(TListSentryPrivilegesByAuthResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- if (other.isSetPrivilegesMapByAuth()) {
- Map<String,TSentryPrivilegeMap> __this__privilegesMapByAuth = new HashMap<String,TSentryPrivilegeMap>(other.privilegesMapByAuth.size());
- for (Map.Entry<String, TSentryPrivilegeMap> other_element : other.privilegesMapByAuth.entrySet()) {
-
- String other_element_key = other_element.getKey();
- TSentryPrivilegeMap other_element_value = other_element.getValue();
-
- String __this__privilegesMapByAuth_copy_key = other_element_key;
-
- TSentryPrivilegeMap __this__privilegesMapByAuth_copy_value = new TSentryPrivilegeMap(other_element_value);
-
- __this__privilegesMapByAuth.put(__this__privilegesMapByAuth_copy_key, __this__privilegesMapByAuth_copy_value);
- }
- this.privilegesMapByAuth = __this__privilegesMapByAuth;
- }
- }
-
- public TListSentryPrivilegesByAuthResponse deepCopy() {
- return new TListSentryPrivilegesByAuthResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- this.privilegesMapByAuth = null;
- }
-
- 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 int getPrivilegesMapByAuthSize() {
- return (this.privilegesMapByAuth == null) ? 0 : this.privilegesMapByAuth.size();
- }
-
- public void putToPrivilegesMapByAuth(String key, TSentryPrivilegeMap val) {
- if (this.privilegesMapByAuth == null) {
- this.privilegesMapByAuth = new HashMap<String,TSentryPrivilegeMap>();
- }
- this.privilegesMapByAuth.put(key, val);
- }
-
- public Map<String,TSentryPrivilegeMap> getPrivilegesMapByAuth() {
- return this.privilegesMapByAuth;
- }
-
- public void setPrivilegesMapByAuth(Map<String,TSentryPrivilegeMap> privilegesMapByAuth) {
- this.privilegesMapByAuth = privilegesMapByAuth;
- }
-
- public void unsetPrivilegesMapByAuth() {
- this.privilegesMapByAuth = null;
- }
-
- /** Returns true if field privilegesMapByAuth is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivilegesMapByAuth() {
- return this.privilegesMapByAuth != null;
- }
-
- public void setPrivilegesMapByAuthIsSet(boolean value) {
- if (!value) {
- this.privilegesMapByAuth = null;
- }
- }
-
- 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 PRIVILEGES_MAP_BY_AUTH:
- if (value == null) {
- unsetPrivilegesMapByAuth();
- } else {
- setPrivilegesMapByAuth((Map<String,TSentryPrivilegeMap>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- case PRIVILEGES_MAP_BY_AUTH:
- return getPrivilegesMapByAuth();
-
- }
- 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 PRIVILEGES_MAP_BY_AUTH:
- return isSetPrivilegesMapByAuth();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryPrivilegesByAuthResponse)
- return this.equals((TListSentryPrivilegesByAuthResponse)that);
- return false;
- }
-
- public boolean equals(TListSentryPrivilegesByAuthResponse 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_privilegesMapByAuth = true && this.isSetPrivilegesMapByAuth();
- boolean that_present_privilegesMapByAuth = true && that.isSetPrivilegesMapByAuth();
- if (this_present_privilegesMapByAuth || that_present_privilegesMapByAuth) {
- if (!(this_present_privilegesMapByAuth && that_present_privilegesMapByAuth))
- return false;
- if (!this.privilegesMapByAuth.equals(that.privilegesMapByAuth))
- 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_privilegesMapByAuth = true && (isSetPrivilegesMapByAuth());
- list.add(present_privilegesMapByAuth);
- if (present_privilegesMapByAuth)
- list.add(privilegesMapByAuth);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TListSentryPrivilegesByAuthResponse 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(isSetPrivilegesMapByAuth()).compareTo(other.isSetPrivilegesMapByAuth());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivilegesMapByAuth()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilegesMapByAuth, other.privilegesMapByAuth);
- 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("TListSentryPrivilegesByAuthResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- if (isSetPrivilegesMapByAuth()) {
- if (!first) sb.append(", ");
- sb.append("privilegesMapByAuth:");
- if (this.privilegesMapByAuth == null) {
- sb.append("null");
- } else {
- sb.append(this.privilegesMapByAuth);
- }
- 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());
- }
-
- // 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 {
- 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 TListSentryPrivilegesByAuthResponseStandardSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesByAuthResponseStandardScheme getScheme() {
- return new TListSentryPrivilegesByAuthResponseStandardScheme();
- }
- }
-
- private static class TListSentryPrivilegesByAuthResponseStandardScheme extends StandardScheme<TListSentryPrivilegesByAuthResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesByAuthResponse 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: // PRIVILEGES_MAP_BY_AUTH
- if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
- {
- org.apache.thrift.protocol.TMap _map138 = iprot.readMapBegin();
- struct.privilegesMapByAuth = new HashMap<String,TSentryPrivilegeMap>(2*_map138.size);
- String _key139;
- TSentryPrivilegeMap _val140;
- for (int _i141 = 0; _i141 < _map138.size; ++_i141)
- {
- _key139 = iprot.readString();
- _val140 = new TSentryPrivilegeMap();
- _val140.read(iprot);
- struct.privilegesMapByAuth.put(_key139, _val140);
- }
- iprot.readMapEnd();
- }
- struct.setPrivilegesMapByAuthIsSet(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, TListSentryPrivilegesByAuthResponse 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();
- }
- if (struct.privilegesMapByAuth != null) {
- if (struct.isSetPrivilegesMapByAuth()) {
- oprot.writeFieldBegin(PRIVILEGES_MAP_BY_AUTH_FIELD_DESC);
- {
- oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, struct.privilegesMapByAuth.size()));
- for (Map.Entry<String, TSentryPrivilegeMap> _iter142 : struct.privilegesMapByAuth.entrySet())
- {
- oprot.writeString(_iter142.getKey());
- _iter142.getValue().write(oprot);
- }
- oprot.writeMapEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryPrivilegesByAuthResponseTupleSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesByAuthResponseTupleScheme getScheme() {
- return new TListSentryPrivilegesByAuthResponseTupleScheme();
- }
- }
-
- private static class TListSentryPrivilegesByAuthResponseTupleScheme extends TupleScheme<TListSentryPrivilegesByAuthResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesByAuthResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- BitSet optionals = new BitSet();
- if (struct.isSetPrivilegesMapByAuth()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetPrivilegesMapByAuth()) {
- {
- oprot.writeI32(struct.privilegesMapByAuth.size());
- for (Map.Entry<String, TSentryPrivilegeMap> _iter143 : struct.privilegesMapByAuth.entrySet())
- {
- oprot.writeString(_iter143.getKey());
- _iter143.getValue().write(oprot);
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesByAuthResponse 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);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- {
- org.apache.thrift.protocol.TMap _map144 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.privilegesMapByAuth = new HashMap<String,TSentryPrivilegeMap>(2*_map144.size);
- String _key145;
- TSentryPrivilegeMap _val146;
- for (int _i147 = 0; _i147 < _map144.size; ++_i147)
- {
- _key145 = iprot.readString();
- _val146 = new TSentryPrivilegeMap();
- _val146.read(iprot);
- struct.privilegesMapByAuth.put(_key145, _val146);
- }
- }
- struct.setPrivilegesMapByAuthIsSet(true);
- }
- }
- }
-
-}
-
[17/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServerPubSub.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServerPubSub.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServerPubSub.java
new file mode 100644
index 0000000..716109f
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServerPubSub.java
@@ -0,0 +1,181 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.service.thrift;
+
+import org.apache.sentry.core.common.utils.PubSub;
+import org.apache.sentry.core.common.utils.PubSub.Topic;
+import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+
+import org.junit.*;
+
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+public class TestSentryServerPubSub extends SentryServiceIntegrationBase {
+
+ private static final Topic[] topics = Topic.values();
+ private static final String[] messages = { "message1", "message2", "message3", "" };
+
+ private static volatile String REQUEST_URL;
+
+ private final TestSubscriber testSubscriber = new TestSubscriber();
+
+ private static final class TestSubscriber implements PubSub.Subscriber {
+ private volatile Topic topic;
+ private volatile String message;
+ private volatile int count;
+ @Override
+ public void onMessage(Topic topic, String message) {
+ this.topic = topic;
+ this.message = message;
+ this.count++;
+ }
+ }
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ webServerEnabled = true;
+ webSecurity = false;
+ SentryServiceIntegrationBase.setup();
+ REQUEST_URL= "http://" + SERVER_HOST + ":" + webServerPort + "/admin/publishMessage?topic=%s&message=%s";
+ }
+
+ @Override
+ @Before
+ public void before() throws Exception {
+
+ // Subscribe to all defined topics.
+ // After each successfull HTTP-GET, testSubscriber.onMessage()
+ // will be called and "topic" and "message" fields will be
+ // set according to HTTP-GET parameters.
+ testSubscriber.count = 0;
+ for (Topic topic : topics) {
+ PubSub.getInstance().subscribe(topic, testSubscriber);
+ }
+ Assert.assertEquals("Unexpected number of registered topics", topics.length, PubSub.getInstance().getTopics().size());
+ }
+
+ @Override
+ @After
+ public void after() {
+ // unsubscribe
+ for (Topic topic : topics) {
+ PubSub.getInstance().unsubscribe(topic, testSubscriber);
+ }
+ testSubscriber.count = 0;
+ Assert.assertTrue("Topics should have been removed after unsubscribe()", PubSub.getInstance().getTopics().isEmpty());
+ }
+
+ /**
+ * Successfully publish notifications
+ * @throws Exception
+ */
+ @Test
+ public void testPubSub() throws Exception {
+ int count = 0;
+ for (Topic topic : topics) {
+ for (String message : messages) {
+ URL url = new URL(String.format(REQUEST_URL, topic.getName(), message));
+ HttpURLConnection conn = null;
+ try {
+ conn = (HttpURLConnection) url.openConnection();
+ Assert.assertEquals("Unexpected response code", HttpURLConnection.HTTP_OK, conn.getResponseCode());
+ } finally {
+ safeClose(conn);
+ }
+ Assert.assertEquals("Unexpected topic", topic, testSubscriber.topic);
+ if (message.isEmpty()) {
+ Assert.assertEquals("Unexpected message", null, testSubscriber.message);
+ } else {
+ Assert.assertEquals("Unexpected message", message, testSubscriber.message);
+ }
+ Assert.assertEquals("Unexpected number of PubSub.onMessage() callbacks", ++count, testSubscriber.count);
+ }
+ }
+ }
+
+ /**
+ * Submit empty topic. It's ok, generates form page.
+ * @throws Exception
+ */
+ @Test
+ public void testPubSubEmptyTopic() throws Exception {
+ URL url = new URL(String.format(REQUEST_URL, "", "message"));
+ HttpURLConnection conn = null;
+ try {
+ conn = (HttpURLConnection) url.openConnection();
+ Assert.assertEquals("Unexpected response code", HttpURLConnection.HTTP_OK, conn.getResponseCode());
+ } finally {
+ safeClose(conn);
+ }
+ Assert.assertEquals("Unexpected number of PubSub.onMessage() callbacks", 0, testSubscriber.count);
+ }
+
+ /**
+ * Submit invalid topic
+ * @throws Exception
+ */
+ @Test
+ public void testPubSubInvalidTopic() throws Exception {
+ String[] invalid_topics = { "invalid_topic_1", "invalid_topic_2", "invalid_topic_3" };
+ for (String topic : invalid_topics) {
+ URL url = new URL(String.format(REQUEST_URL, topic, "message"));
+ HttpURLConnection conn = null;
+ try {
+ conn = (HttpURLConnection) url.openConnection();
+ Assert.assertEquals("Unexpected response code", HttpURLConnection.HTTP_BAD_REQUEST, conn.getResponseCode());
+ } finally {
+ safeClose(conn);
+ }
+ Assert.assertEquals("Unexpected number of PubSub.onMessage() callbacks", 0, testSubscriber.count);
+ }
+ }
+
+ /**
+ * Submit topic that has no subscribers.
+ * @throws Exception
+ */
+ @Test
+ public void testPubSubNonSubscribedTopic() throws Exception {
+ // At this point all valid Topic values have been subscribed to
+ // in before() method.
+ // Unsubscribe from one topic and then try publishing to it.
+ PubSub.getInstance().unsubscribe(Topic.HDFS_SYNC_HMS, testSubscriber);
+ Assert.assertEquals("Unexpected number of registered topics", topics.length-1, PubSub.getInstance().getTopics().size());
+
+ URL url = new URL(String.format(REQUEST_URL, Topic.HDFS_SYNC_HMS.getName(), "message"));
+ HttpURLConnection conn = null;
+ try {
+ conn = (HttpURLConnection) url.openConnection();
+ Assert.assertEquals("Unexpected response code", HttpURLConnection.HTTP_BAD_REQUEST, conn.getResponseCode());
+ } finally {
+ safeClose(conn);
+ }
+ // re-subscribe, not to upset after() method which expects all topics to be subscribed to
+ PubSub.getInstance().subscribe(Topic.HDFS_SYNC_HMS, testSubscriber);
+ }
+
+ private static void safeClose(HttpURLConnection conn) {
+ if (conn != null) {
+ try {
+ conn.disconnect();
+ } catch (Exception ignore) {
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServerWithoutKerberos.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServerWithoutKerberos.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServerWithoutKerberos.java
new file mode 100644
index 0000000..3deadab
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServerWithoutKerberos.java
@@ -0,0 +1,214 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless createRequired by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sentry.api.service.thrift;
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.sentry.core.common.ActiveRoleSet;
+import org.apache.sentry.core.common.Authorizable;
+import org.apache.sentry.core.model.db.AccessConstants;
+import org.apache.sentry.core.model.db.Database;
+import org.apache.sentry.core.model.db.Server;
+import org.apache.sentry.core.model.db.Table;
+import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+public class TestSentryServerWithoutKerberos extends SentryServiceIntegrationBase {
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ kerberos = false;
+ beforeSetup();
+ setupConf();
+ startSentryService();
+ afterSetup();
+ }
+
+ @Test
+ public void testCreateRole() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+ String roleName = "admin_r";
+ client.dropRoleIfExists(requestorUserName, roleName);
+ client.createRole(requestorUserName, roleName);
+ client.dropRole(requestorUserName, roleName);
+ }
+
+ @Test
+ public void testQueryPushDown() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ String roleName1 = "admin_r1";
+ String roleName2 = "admin_r2";
+
+ String group1 = "g1";
+ String group2 = "g2";
+
+ client.dropRoleIfExists(requestorUserName, roleName1);
+ client.createRole(requestorUserName, roleName1);
+ client.grantRoleToGroup(requestorUserName, group1, roleName1);
+
+ client.grantTablePrivilege(requestorUserName, roleName1, "server", "db1", "table1", "ALL");
+ client.grantTablePrivilege(requestorUserName, roleName1, "server", "db1", "table2", "ALL");
+ client.grantTablePrivilege(requestorUserName, roleName1, "server", "db2", "table3", "ALL");
+ client.grantTablePrivilege(requestorUserName, roleName1, "server", "db2", "table4", "ALL");
+
+ client.dropRoleIfExists(requestorUserName, roleName2);
+ client.createRole(requestorUserName, roleName2);
+ client.grantRoleToGroup(requestorUserName, group1, roleName2);
+ client.grantRoleToGroup(requestorUserName, group2, roleName2);
+
+ client.grantTablePrivilege(requestorUserName, roleName2, "server", "db1", "table1", "ALL");
+ client.grantTablePrivilege(requestorUserName, roleName2, "server", "db1", "table2", "ALL");
+ client.grantTablePrivilege(requestorUserName, roleName2, "server", "db2", "table3", "ALL");
+ client.grantTablePrivilege(requestorUserName, roleName2, "server", "db2", "table4", "ALL");
+ client.grantTablePrivilege(requestorUserName, roleName2, "server", "db3", "table5", "ALL");
+
+ Set<TSentryPrivilege> listPrivilegesByRoleName = client.listPrivilegesByRoleName(requestorUserName, roleName2, null);
+ assertEquals("Privilege not assigned to role2 !!", 5, listPrivilegesByRoleName.size());
+
+ listPrivilegesByRoleName = client.listPrivilegesByRoleName(requestorUserName, roleName2, new ArrayList<Authorizable>());
+ assertEquals("Privilege not assigned to role2 !!", 5, listPrivilegesByRoleName.size());
+
+ listPrivilegesByRoleName = client.listPrivilegesByRoleName(requestorUserName, roleName2, Lists.newArrayList(new Server("server"), new Database("db1")));
+ assertEquals("Privilege not assigned to role2 !!", 2, listPrivilegesByRoleName.size());
+
+ listPrivilegesByRoleName = client.listPrivilegesByRoleName(requestorUserName, roleName2, Lists.newArrayList(new Server("server"), new Database("db2"), new Table("table1")));
+ assertEquals("Privilege not assigned to role2 !!", 0, listPrivilegesByRoleName.size());
+
+ listPrivilegesByRoleName = client.listPrivilegesByRoleName(requestorUserName, roleName2, Lists.newArrayList(new Server("server"), new Database("db1"), new Table("table1")));
+ assertEquals("Privilege not assigned to role2 !!", 1, listPrivilegesByRoleName.size());
+
+ listPrivilegesByRoleName = client.listPrivilegesByRoleName(requestorUserName, roleName2, Lists.newArrayList(new Server("server"), new Database("db3")));
+ assertEquals("Privilege not assigned to role2 !!", 1, listPrivilegesByRoleName.size());
+
+ Set<String> listPrivilegesForProvider = client.listPrivilegesForProvider(Sets.newHashSet(group1, group2), null, ActiveRoleSet.ALL, new Server("server"), new Database("db2"));
+ assertEquals("Privilege not correctly assigned to roles !!",
+ Sets.newHashSet("server=server->db=db2->table=table4->action=all", "server=server->db=db2->table=table3->action=all"),
+ listPrivilegesForProvider);
+
+ listPrivilegesForProvider = client.listPrivilegesForProvider(Sets.newHashSet(group1, group2), null, ActiveRoleSet.ALL, new Server("server"), new Database("db3"));
+ assertEquals("Privilege not correctly assigned to roles !!", Sets.newHashSet("server=server->db=db3->table=table5->action=all"), listPrivilegesForProvider);
+
+ listPrivilegesForProvider = client.listPrivilegesForProvider(Sets.newHashSet(group1, group2), null, new ActiveRoleSet(Sets.newHashSet(roleName1)), new Server("server"), new Database("db3"));
+ assertEquals("Privilege not correctly assigned to roles !!", Sets.newHashSet("server=+"), listPrivilegesForProvider);
+
+ listPrivilegesForProvider = client.listPrivilegesForProvider(Sets.newHashSet(group1, group2), null, new ActiveRoleSet(Sets.newHashSet(roleName1)), new Server("server1"));
+ assertEquals("Privilege not correctly assigned to roles !!", new HashSet<String>(), listPrivilegesForProvider);
+ }
+
+
+
+ /**
+ * Create role, add privileges and grant it to a group drop the role and
+ * verify the privileges are no longer visible recreate the role with same
+ * name and verify the privileges again.
+ * @throws Exception
+ */
+ @Test
+ public void testDropRole() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+ String roleName = "admin_r";
+
+ // create role and add privileges
+ client.dropRoleIfExists(requestorUserName, roleName);
+ client.createRole(requestorUserName, roleName);
+ client.grantRoleToGroup(requestorUserName, ADMIN_GROUP, roleName);
+ client.grantDatabasePrivilege(requestorUserName, roleName, "server1", "db2", AccessConstants.ALL);
+ client.grantTablePrivilege(requestorUserName, roleName, "server1", "db3", "tab3", "ALL");
+ assertEquals(2, client.listPrivilegesForProvider(requestorUserGroupNames, null,
+ ActiveRoleSet.ALL).size());
+
+ // drop role and verify privileges
+ client.dropRole(requestorUserName, roleName);
+ assertEquals(0, client.listPrivilegesForProvider(requestorUserGroupNames, null,
+ ActiveRoleSet.ALL).size());
+
+ // recreate the role
+ client.createRole(requestorUserName, roleName);
+ client.grantRoleToGroup(requestorUserName, ADMIN_GROUP, roleName);
+ assertEquals(0, client.listPrivilegesForProvider(requestorUserGroupNames, null,
+ ActiveRoleSet.ALL).size());
+
+ // grant different privileges and verify
+ client.grantDatabasePrivilege(requestorUserName, roleName, "server1", "db2", AccessConstants.ALL);
+ assertEquals(1, client.listPrivilegesForProvider(requestorUserGroupNames, null,
+ ActiveRoleSet.ALL).size());
+ client.dropRole(requestorUserName, roleName);
+ assertEquals(0, client.listPrivilegesForProvider(requestorUserGroupNames, null,
+ ActiveRoleSet.ALL).size());
+ assertEquals(0, client.listPrivilegesForProvider(requestorUserGroupNames, null,
+ ActiveRoleSet.ALL).size());
+ }
+
+ @Test
+ public void testDropRoleOnUser() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ Set<String> requestorUserNames = Sets.newHashSet(ADMIN_USER);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+ String roleName = "admin_r";
+
+ // create role and add privileges
+ client.dropRoleIfExists(requestorUserName, roleName);
+ client.createRole(requestorUserName, roleName);
+ client.grantRoleToUser(requestorUserName, ADMIN_USER, roleName);
+ client.grantDatabasePrivilege(requestorUserName, roleName, "server1", "db2", AccessConstants.ALL);
+ client.grantTablePrivilege(requestorUserName, roleName, "server1", "db3", "tab3", "ALL");
+ assertEquals(2, client.listPrivilegesForProvider(requestorUserGroupNames, requestorUserNames,
+ ActiveRoleSet.ALL).size());
+
+ // drop role and verify privileges
+ client.dropRole(requestorUserName, roleName);
+ assertEquals(0, client.listPrivilegesForProvider(requestorUserGroupNames, requestorUserNames,
+ ActiveRoleSet.ALL).size());
+
+ // recreate the role
+ client.createRole(requestorUserName, roleName);
+ client.grantRoleToGroup(requestorUserName, ADMIN_GROUP, roleName);
+ assertEquals(0, client.listPrivilegesForProvider(requestorUserGroupNames, requestorUserNames,
+ ActiveRoleSet.ALL).size());
+
+ // grant different privileges and verify
+ client.grantDatabasePrivilege(requestorUserName, roleName, "server1", "db2", AccessConstants.ALL);
+ assertEquals(1, client.listPrivilegesForProvider(requestorUserGroupNames, requestorUserNames,
+ ActiveRoleSet.ALL).size());
+ client.dropRole(requestorUserName, roleName);
+ assertEquals(0, client.listPrivilegesForProvider(requestorUserGroupNames, requestorUserNames,
+ ActiveRoleSet.ALL).size());
+ assertEquals(0, client.listPrivilegesForProvider(requestorUserGroupNames, requestorUserNames,
+ ActiveRoleSet.ALL).size());
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceClientPool.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceClientPool.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceClientPool.java
new file mode 100644
index 0000000..6c88955
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceClientPool.java
@@ -0,0 +1,111 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sentry.api.service.thrift;
+
+import static org.junit.Assert.assertTrue;
+
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.FutureTask;
+
+import org.apache.sentry.core.common.exception.SentryUserException;
+import org.apache.sentry.service.thrift.SentryServiceFactory;
+import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+import org.junit.Test;
+
+import com.google.common.collect.Sets;
+
+public class TestSentryServiceClientPool extends SentryServiceIntegrationBase {
+
+ @Test
+ public void testConnectionWhenReconnect() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ String roleName = "admin_r";
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName);
+ client.createRole(requestorUserName, roleName);
+ client.listAllRoles(requestorUserName);
+ stopSentryService();
+ server = SentryServiceFactory.create(conf);
+ startSentryService();
+ client.listAllRoles(requestorUserName);
+ client.dropRole(requestorUserName, roleName);
+ }
+ });
+ }
+
+ @Test
+ public void testConnectionWithMultipleRetries() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ List<Future<Boolean>> tasks = new ArrayList<Future<Boolean>>();
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ String roleName = "admin_r";
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName);
+ client.createRole(requestorUserName, roleName);
+
+ ExecutorService executorService = Executors.newFixedThreadPool(20);
+
+ Callable<Boolean> func = new Callable<Boolean>() {
+ public Boolean call() throws Exception {
+ return clientUgi.doAs(new PrivilegedExceptionAction<Boolean>() {
+ @Override
+ public Boolean run() throws Exception {
+ try {
+ client.listAllRoles(ADMIN_USER);
+ return true;
+ } catch (SentryUserException sue) {
+ return false;
+ }
+ }
+ });
+ }
+ };
+
+ for (int i = 0; i < 30; i++) {
+ FutureTask<Boolean> task = new FutureTask<Boolean>(func);
+ tasks.add(task);
+ executorService.submit(task);
+ }
+
+ for (Future<Boolean> task : tasks) {
+ Boolean result = task.get();
+ assertTrue("Some tasks are failed.", result);
+ }
+ }
+ });
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceFailureCase.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceFailureCase.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceFailureCase.java
new file mode 100644
index 0000000..fa67f27
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceFailureCase.java
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sentry.api.service.thrift;
+
+import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Strings;
+
+public class TestSentryServiceFailureCase extends SentryServiceIntegrationBase {
+ private static final Logger LOGGER = LoggerFactory.getLogger(TestSentryServiceFailureCase.class);
+ private static final String PEER_CALLBACK_FAILURE = "Peer indicated failure: Problem with callback handler";
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ kerberos = true;
+ beforeSetup();
+ setupConf();
+ conf.set(ServerConfig.ALLOW_CONNECT, "");
+ startSentryService();
+ afterSetup();
+ }
+
+ @Override
+ @Before
+ public void before() throws Exception {
+ }
+
+ @Override
+ @After
+ public void after() {
+ }
+
+ @Test
+ public void testClientServerConnectionFailure() throws Exception {
+ try {
+ connectToSentryService();
+ String requestorUserName = ADMIN_USER;
+ client.listAllRoles(requestorUserName);
+ Assert.fail("Failed to receive Exception");
+ } catch(Exception e) {
+ LOGGER.info("Excepted exception", e);
+ Throwable cause = e.getCause();
+ if (cause == null) {
+ throw e;
+ }
+ String msg = "Exception message: " + cause.getMessage();
+ Assert.assertTrue(msg, Strings.nullToEmpty(cause.getMessage())
+ .contains(PEER_CALLBACK_FAILURE));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceForPoolWithKerberos.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceForPoolWithKerberos.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceForPoolWithKerberos.java
new file mode 100644
index 0000000..aa156f2
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceForPoolWithKerberos.java
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless createRequired by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sentry.api.service.thrift;
+
+import org.junit.BeforeClass;
+
+public class TestSentryServiceForPoolWithKerberos extends TestSentryServiceWithKerberos {
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ kerberos = true;
+ pooled = true;
+ beforeSetup();
+ setupConf();
+ startSentryService();
+ afterSetup();
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceImportExport.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceImportExport.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceImportExport.java
new file mode 100644
index 0000000..cf1fdab
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceImportExport.java
@@ -0,0 +1,751 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sentry.api.service.thrift;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.sentry.core.common.utils.SentryConstants;
+import org.apache.sentry.core.common.utils.PolicyFileConstants;
+import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+
+public class TestSentryServiceImportExport extends SentryServiceIntegrationBase {
+
+ // define the privileges
+ public static String PRIVILIEGE1 = "server=server1";
+ public static String PRIVILIEGE2 = "server=server1->action=select->grantoption=false";
+ public static String PRIVILIEGE3 = "server=server1->db=db2->action=insert->grantoption=true";
+ public static String PRIVILIEGE4 = "server=server1->db=db1->table=tbl1->action=insert";
+ public static String PRIVILIEGE5 = "server=server1->db=db1->table=tbl2->column=col1->action=insert";
+ public static String PRIVILIEGE6 = "server=server1->db=db1->table=tbl3->column=col1->action=*->grantoption=true";
+ public static String PRIVILIEGE7 = "server=server1->db=db1->table=tbl4->column=col1->action=all->grantoption=true";
+ public static String PRIVILIEGE8 = "server=server1->uri=hdfs://testserver:9999/path2->action=insert";
+ public static String PRIVILIEGE9 = "server=server1->db=db2->table=tbl1->action=insert";
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ kerberos = false;
+ setupConf();
+ startSentryService();
+ }
+
+ @Before
+ public void preparePolicyFile() throws Exception {
+ super.before();
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+ }
+
+ // Befor import, database is empty.
+ // The following information is imported:
+ // group1=role1,role2,role3
+ // group2=role1,role2,role3
+ // group3=role1,role2,role3
+ // role1=privilege1,privilege2,privilege3,privilege4,privilege5,privilege6,privilege7,privilege8
+ // role2=privilege1,privilege2,privilege3,privilege4,privilege5,privilege6,privilege7,privilege8
+ // role3=privilege1,privilege2,privilege3,privilege4,privilege5,privilege6,privilege7,privilege8
+ // Both import API importPolicy and export API exportPoicy are tested.
+ @Test
+ public void testImportExportPolicy1() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ Map<String, Map<String, Set<String>>> policyFileMappingData = Maps.newHashMap();
+ Map<String, Set<String>> groupRolesMap = Maps.newHashMap();
+ Set<String> roles = Sets.newHashSet("role1", "role2", "role3");
+ groupRolesMap.put("group1", roles);
+ groupRolesMap.put("group2", roles);
+ groupRolesMap.put("group3", roles);
+ Map<String, Set<String>> rolePrivilegesMap = Maps.newHashMap();
+ for (String roleName : roles) {
+ rolePrivilegesMap.put(roleName, Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3,
+ PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
+ }
+ policyFileMappingData.put(PolicyFileConstants.GROUPS, groupRolesMap);
+ policyFileMappingData.put(PolicyFileConstants.ROLES, rolePrivilegesMap);
+ client.importPolicy(policyFileMappingData, ADMIN_USER, false);
+
+ Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
+ validateSentryMappingData(sentryMappingData,
+ policyFileMappingData);
+ }
+ });
+ }
+
+ // call import twice, and there has no duplicate data:
+ // The data for 1st import:
+ // group1=role1
+ // role1=privilege1,privilege2,privilege3,privilege4
+ // The data for 2nd import:
+ // group2=role2,role3
+ // group3=role2,role3
+ // role2=privilege5,privilege6,privilege7,privilege8
+ // role3=privilege5,privilege6,privilege7,privilege8
+ // Both import API importPolicy and export API exportPoicy are tested.
+ @Test
+ public void testImportExportPolicy2() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ Map<String, Map<String, Set<String>>> policyFileMappingData1 = Maps.newHashMap();
+ Map<String, Set<String>> groupRolesMap1 = Maps.newHashMap();
+ groupRolesMap1.put("group1", Sets.newHashSet("role1"));
+ Map<String, Set<String>> rolePrivilegesMap1 = Maps.newHashMap();
+ rolePrivilegesMap1.put("role1",
+ Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3, PRIVILIEGE4));
+ policyFileMappingData1.put(PolicyFileConstants.GROUPS, groupRolesMap1);
+ policyFileMappingData1.put(PolicyFileConstants.ROLES, rolePrivilegesMap1);
+ client.importPolicy(policyFileMappingData1, ADMIN_USER, false);
+
+ Map<String, Map<String, Set<String>>> policyFileMappingData2 = Maps.newHashMap();
+ Map<String, Set<String>> groupRolesMap2 = Maps.newHashMap();
+ groupRolesMap2.put("group2", Sets.newHashSet("role2", "role3"));
+ groupRolesMap2.put("group3", Sets.newHashSet("role2", "role3"));
+ Map<String, Set<String>> rolePrivilegesMap2 = Maps.newHashMap();
+ rolePrivilegesMap2.put("role2",
+ Sets.newHashSet(PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
+ rolePrivilegesMap2.put("role3",
+ Sets.newHashSet(PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
+ policyFileMappingData2.put(PolicyFileConstants.GROUPS, groupRolesMap2);
+ policyFileMappingData2.put(PolicyFileConstants.ROLES, rolePrivilegesMap2);
+ client.importPolicy(policyFileMappingData2, ADMIN_USER, false);
+
+ Map<String, Map<String, Set<String>>> exceptedMappingData = Maps.newHashMap();
+ // for exceptedMappingData, combine policyFileMappingData1 and policyFileMappingData2
+ exceptedMappingData.put(PolicyFileConstants.GROUPS,
+ policyFileMappingData1.get(PolicyFileConstants.GROUPS));
+ exceptedMappingData.get(PolicyFileConstants.GROUPS).putAll(
+ policyFileMappingData2.get(PolicyFileConstants.GROUPS));
+ exceptedMappingData.put(PolicyFileConstants.ROLES,
+ policyFileMappingData1.get(PolicyFileConstants.ROLES));
+ exceptedMappingData.get(PolicyFileConstants.ROLES).putAll(
+ policyFileMappingData2.get(PolicyFileConstants.ROLES));
+
+ Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
+ validateSentryMappingData(sentryMappingData, exceptedMappingData);
+ }
+ });
+ }
+
+ // Call import twice, and there has overlapping groups
+ // The data for 1st import:
+ // group1=role1, role2
+ // group2=role1, role2
+ // group3=role1, role2
+ // role1=privilege1,privilege2,privilege3,privilege4,privilege5
+ // role2=privilege1,privilege2,privilege3,privilege4,privilege5
+ // The data for 2nd import:
+ // group1=role2,role3
+ // group2=role2,role3
+ // group3=role2,role3
+ // role2=privilege4,privilege5,privilege6,privilege7,privilege8
+ // role3=privilege4,privilege5,privilege6,privilege7,privilege8
+ // Both import API importPolicy and export API exportPoicy are tested.
+ @Test
+ public void testImportExportPolicy3() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ Map<String, Map<String, Set<String>>> policyFileMappingData1 = Maps.newHashMap();
+ Map<String, Set<String>> groupRolesMap1 = Maps.newHashMap();
+ groupRolesMap1.put("group1", Sets.newHashSet("role1", "role2"));
+ groupRolesMap1.put("group2", Sets.newHashSet("role1", "role2"));
+ groupRolesMap1.put("group3", Sets.newHashSet("role1", "role2"));
+ Map<String, Set<String>> rolePrivilegesMap1 = Maps.newHashMap();
+ rolePrivilegesMap1.put("role1",
+ Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE5));
+ rolePrivilegesMap1.put("role2",
+ Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE5));
+ policyFileMappingData1.put(PolicyFileConstants.GROUPS, groupRolesMap1);
+ policyFileMappingData1.put(PolicyFileConstants.ROLES, rolePrivilegesMap1);
+ client.importPolicy(policyFileMappingData1, ADMIN_USER, false);
+
+ Map<String, Map<String, Set<String>>> policyFileMappingData2 = Maps.newHashMap();
+ Map<String, Set<String>> groupRolesMap2 = Maps.newHashMap();
+ groupRolesMap2.put("group1", Sets.newHashSet("role2", "role3"));
+ groupRolesMap2.put("group2", Sets.newHashSet("role2", "role3"));
+ groupRolesMap2.put("group3", Sets.newHashSet("role2", "role3"));
+ Map<String, Set<String>> rolePrivilegesMap2 = Maps.newHashMap();
+ rolePrivilegesMap2.put("role2",
+ Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
+ rolePrivilegesMap2.put("role3",
+ Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
+ policyFileMappingData2.put(PolicyFileConstants.GROUPS, groupRolesMap2);
+ policyFileMappingData2.put(PolicyFileConstants.ROLES, rolePrivilegesMap2);
+ client.importPolicy(policyFileMappingData2, ADMIN_USER, false);
+
+ Map<String, Map<String, Set<String>>> exceptedMappingData = Maps.newHashMap();
+ Map<String, Set<String>> exceptedRolesMap = Maps.newHashMap();
+ exceptedRolesMap.put("group1", Sets.newHashSet("role1", "role2", "role3"));
+ exceptedRolesMap.put("group2", Sets.newHashSet("role1", "role2", "role3"));
+ exceptedRolesMap.put("group3", Sets.newHashSet("role1", "role2", "role3"));
+ Map<String, Set<String>> exceptedPrivilegesMap = Maps.newHashMap();
+ exceptedPrivilegesMap.put("role1",
+ Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE5));
+ exceptedPrivilegesMap.put("role2", Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3,
+ PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
+ exceptedPrivilegesMap.put("role3",
+ Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
+ exceptedMappingData.put(PolicyFileConstants.GROUPS, exceptedRolesMap);
+ exceptedMappingData.put(PolicyFileConstants.ROLES, exceptedPrivilegesMap);
+
+ Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
+ validateSentryMappingData(sentryMappingData, exceptedMappingData);
+ }
+ });
+ }
+
+ // Only mapping data for [group,role] is imported:
+ // group1=role1,role2
+ @Test
+ public void testImportExportPolicy4() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ Map<String, Map<String, Set<String>>> policyFileMappingData = Maps.newHashMap();
+ Map<String, Set<String>> groupRolesMap = Maps.newHashMap();
+ Set<String> roles = Sets.newHashSet("role1", "role2");
+ groupRolesMap.put("group1", roles);
+ Map<String, Set<String>> rolePrivilegesMap = Maps.newHashMap();
+ policyFileMappingData.put(PolicyFileConstants.GROUPS, groupRolesMap);
+ policyFileMappingData.put(PolicyFileConstants.ROLES, rolePrivilegesMap);
+ client.importPolicy(policyFileMappingData, ADMIN_USER, false);
+
+ Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
+ validateSentryMappingData(sentryMappingData,
+ policyFileMappingData);
+ }
+ });
+ }
+
+ // call import twice, and there has no duplicate data, the import will be with the overwrite mode:
+ // The data for 1st import:
+ // group1=role1
+ // role1=privilege1
+ // The data for 2nd import:
+ // group2=role2,role3
+ // group3=role2,role3
+ // role2=privilege2
+ // role3=privilege2
+ // Both import API importSentryMetaData and export APIs getRolesMap, getGroupsMap,
+ // getPrivilegesList are tested.
+ @Test
+ public void testImportExportPolicy5() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ Map<String, Map<String, Set<String>>> policyFileMappingData1 = Maps.newHashMap();
+ Map<String, Set<String>> groupRolesMap1 = Maps.newHashMap();
+ groupRolesMap1.put("group1", Sets.newHashSet("role1"));
+ Map<String, Set<String>> rolePrivilegesMap1 = Maps.newHashMap();
+ rolePrivilegesMap1.put("role1", Sets.newHashSet(PRIVILIEGE1));
+ policyFileMappingData1.put(PolicyFileConstants.GROUPS, groupRolesMap1);
+ policyFileMappingData1.put(PolicyFileConstants.ROLES, rolePrivilegesMap1);
+ client.importPolicy(policyFileMappingData1, ADMIN_USER, true);
+
+ Map<String, Map<String, Set<String>>> policyFileMappingData2 = Maps.newHashMap();
+ Map<String, Set<String>> groupRolesMap2 = Maps.newHashMap();
+ groupRolesMap2.put("group2", Sets.newHashSet("role2", "role3"));
+ groupRolesMap2.put("group3", Sets.newHashSet("role2", "role3"));
+ Map<String, Set<String>> rolePrivilegesMap2 = Maps.newHashMap();
+ rolePrivilegesMap2.put("role2", Sets.newHashSet(PRIVILIEGE2));
+ rolePrivilegesMap2.put("role3", Sets.newHashSet(PRIVILIEGE2));
+ policyFileMappingData2.put(PolicyFileConstants.GROUPS, groupRolesMap2);
+ policyFileMappingData2.put(PolicyFileConstants.ROLES, rolePrivilegesMap2);
+ client.importPolicy(policyFileMappingData2, ADMIN_USER, true);
+
+ Map<String, Map<String, Set<String>>> exceptedMappingData = Maps.newHashMap();
+ Map<String, Set<String>> exceptedRolesMap = Maps.newHashMap();
+ exceptedRolesMap.put("group1", Sets.newHashSet("role1"));
+ exceptedRolesMap.put("group2", Sets.newHashSet("role2", "role3"));
+ exceptedRolesMap.put("group3", Sets.newHashSet("role2", "role3"));
+ Map<String, Set<String>> exceptedPrivilegesMap = Maps.newHashMap();
+ exceptedPrivilegesMap.put("role1", Sets.newHashSet(PRIVILIEGE1));
+ exceptedPrivilegesMap.put("role2", Sets.newHashSet(PRIVILIEGE2));
+ exceptedPrivilegesMap.put("role3", Sets.newHashSet(PRIVILIEGE2));
+ exceptedMappingData.put(PolicyFileConstants.GROUPS, exceptedRolesMap);
+ exceptedMappingData.put(PolicyFileConstants.ROLES, exceptedPrivilegesMap);
+
+ Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
+ validateSentryMappingData(sentryMappingData, exceptedMappingData);
+ }
+ });
+ }
+
+ // call import twice, and there has data overlap, the import will be with the overwrite mode:
+ // The data for 1st import:
+ // group1=role1, role2
+ // group2=role1, role2
+ // group3=role1, role2
+ // role1=privilege1,privilege2,privilege3,privilege4,privilege5
+ // role2=privilege1,privilege2,privilege3,privilege4,privilege5
+ // The data for 2nd import:
+ // group1=role2,role3
+ // group2=role2,role3
+ // group3=role2,role3
+ // role2=privilege4,privilege5,privilege6,privilege7,privilege8
+ // role3=privilege4,privilege5,privilege6,privilege7,privilege8
+ // Both import API importSentryMetaData and export APIs getRolesMap, getGroupsMap,
+ // getPrivilegesList are tested.
+ @Test
+ public void testImportExportPolicy6() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ Map<String, Map<String, Set<String>>> policyFileMappingData1 = Maps.newHashMap();
+ Map<String, Set<String>> groupRolesMap1 = Maps.newHashMap();
+ groupRolesMap1.put("group1", Sets.newHashSet("role1", "role2"));
+ groupRolesMap1.put("group2", Sets.newHashSet("role1", "role2"));
+ groupRolesMap1.put("group3", Sets.newHashSet("role1", "role2"));
+ Map<String, Set<String>> rolePrivilegesMap1 = Maps.newHashMap();
+ rolePrivilegesMap1.put("role1",
+ Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE5));
+ rolePrivilegesMap1.put("role2",
+ Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE5));
+ policyFileMappingData1.put(PolicyFileConstants.GROUPS, groupRolesMap1);
+ policyFileMappingData1.put(PolicyFileConstants.ROLES, rolePrivilegesMap1);
+ client.importPolicy(policyFileMappingData1, ADMIN_USER, true);
+
+ Map<String, Map<String, Set<String>>> policyFileMappingData2 = Maps.newHashMap();
+ Map<String, Set<String>> groupRolesMap2 = Maps.newHashMap();
+ groupRolesMap2.put("group1", Sets.newHashSet("role2", "role3"));
+ groupRolesMap2.put("group2", Sets.newHashSet("role2", "role3"));
+ groupRolesMap2.put("group3", Sets.newHashSet("role2", "role3"));
+ Map<String, Set<String>> rolePrivilegesMap2 = Maps.newHashMap();
+ rolePrivilegesMap2.put("role2",
+ Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
+ rolePrivilegesMap2.put("role3",
+ Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
+ policyFileMappingData2.put(PolicyFileConstants.GROUPS, groupRolesMap2);
+ policyFileMappingData2.put(PolicyFileConstants.ROLES, rolePrivilegesMap2);
+ client.importPolicy(policyFileMappingData2, ADMIN_USER, true);
+
+ Map<String, Map<String, Set<String>>> exceptedMappingData = Maps.newHashMap();
+ Map<String, Set<String>> exceptedRolesMap = Maps.newHashMap();
+ exceptedRolesMap.put("group1", Sets.newHashSet("role1", "role2", "role3"));
+ exceptedRolesMap.put("group2", Sets.newHashSet("role1", "role2", "role3"));
+ exceptedRolesMap.put("group3", Sets.newHashSet("role1", "role2", "role3"));
+ Map<String, Set<String>> exceptedPrivilegesMap = Maps.newHashMap();
+ exceptedPrivilegesMap.put("role1",
+ Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE5));
+ exceptedPrivilegesMap.put("role2",
+ Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
+ exceptedPrivilegesMap.put("role3",
+ Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
+ exceptedMappingData.put(PolicyFileConstants.GROUPS, exceptedRolesMap);
+ exceptedMappingData.put(PolicyFileConstants.ROLES, exceptedPrivilegesMap);
+
+ Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
+ validateSentryMappingData(sentryMappingData, exceptedMappingData);
+ }
+ });
+ }
+
+ // test the import privileges with the action: All, *, select, insert
+ // All and * should replace the select and insert
+ // The data for import:
+ // group1=role1, role2
+ // role1=testPrivilege1,testPrivilege2,testPrivilege3,testPrivilege4
+ // role2=testPrivilege5, testPrivilege6,testPrivilege7,testPrivilege8
+ @Test
+ public void testImportExportPolicy7() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String testPrivilege1 = "server=server1->db=db1->table=tbl1->action=select->grantoption=true";
+ String testPrivilege2 = "server=server1->db=db1->table=tbl1->action=insert->grantoption=false";
+ String testPrivilege3 = "server=server1->db=db1->table=tbl1->action=all->grantoption=true";
+ String testPrivilege4 = "server=server1->db=db1->table=tbl1->action=insert->grantoption=true";
+ String testPrivilege5 = "server=server1->db=db1->table=tbl2->action=select->grantoption=true";
+ String testPrivilege6 = "server=server1->db=db1->table=tbl2->action=insert->grantoption=false";
+ String testPrivilege7 = "server=server1->db=db1->table=tbl2->action=*->grantoption=true";
+ String testPrivilege8 = "server=server1->db=db1->table=tbl2->action=insert->grantoption=true";
+
+ Map<String, Map<String, Set<String>>> policyFileMappingData1 = Maps.newHashMap();
+ Map<String, Set<String>> groupRolesMap1 = Maps.newHashMap();
+ groupRolesMap1.put("group1", Sets.newHashSet("role1", "role2"));
+ Map<String, Set<String>> rolePrivilegesMap1 = Maps.newHashMap();
+ rolePrivilegesMap1.put("role1",
+ Sets.newHashSet(testPrivilege1, testPrivilege2, testPrivilege3, testPrivilege4));
+ rolePrivilegesMap1.put("role2",
+ Sets.newHashSet(testPrivilege5, testPrivilege6, testPrivilege7, testPrivilege8));
+ policyFileMappingData1.put(PolicyFileConstants.GROUPS, groupRolesMap1);
+ policyFileMappingData1.put(PolicyFileConstants.ROLES, rolePrivilegesMap1);
+ client.importPolicy(policyFileMappingData1, ADMIN_USER, true);
+
+ Map<String, Map<String, Set<String>>> exceptedMappingData = Maps.newHashMap();
+ Map<String, Set<String>> exceptedRolesMap = Maps.newHashMap();
+ exceptedRolesMap.put("group1", Sets.newHashSet("role1", "role2"));
+ Map<String, Set<String>> exceptedPrivilegesMap = Maps.newHashMap();
+ exceptedPrivilegesMap.put("role1", Sets.newHashSet(testPrivilege2, testPrivilege3));
+ exceptedPrivilegesMap.put("role2", Sets.newHashSet(testPrivilege6, testPrivilege7));
+ exceptedMappingData.put(PolicyFileConstants.GROUPS, exceptedRolesMap);
+ exceptedMappingData.put(PolicyFileConstants.ROLES, exceptedPrivilegesMap);
+
+ Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
+ validateSentryMappingData(sentryMappingData, exceptedMappingData);
+ }
+ });
+ }
+
+ // Call import twice, and there has overlapping actions, all and * should replace the select and
+ // insert
+ // The data for 1st import:
+ // group1=role1, role2
+ // role1=privilege1(with select action),privilege2(with insert action)
+ // role2=privilege4(with select action),privilege5(with insert action)
+ // The data for 2nd import:
+ // group1=role1, role2
+ // role1=privilege3(with all action)
+ // role2=privilege6(with * action)
+ @Test
+ public void testImportExportPolicy8() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String testPrivilege1 = "server=server1->db=db1->table=tbl1->action=select->grantoption=true";
+ String testPrivilege2 = "server=server1->db=db1->table=tbl1->action=insert->grantoption=true";
+ String testPrivilege3 = "server=server1->db=db1->table=tbl1->action=all->grantoption=true";
+ String testPrivilege4 = "server=server1->db=db1->table=tbl2->action=select->grantoption=true";
+ String testPrivilege5 = "server=server1->db=db1->table=tbl2->action=insert->grantoption=true";
+ String testPrivilege6 = "server=server1->db=db1->table=tbl2->action=*->grantoption=true";
+
+ Map<String, Map<String, Set<String>>> policyFileMappingData1 = Maps.newHashMap();
+ Map<String, Set<String>> groupRolesMap1 = Maps.newHashMap();
+ groupRolesMap1.put("group1", Sets.newHashSet("role1", "role2"));
+ Map<String, Set<String>> rolePrivilegesMap1 = Maps.newHashMap();
+ rolePrivilegesMap1.put("role1", Sets.newHashSet(testPrivilege1, testPrivilege2));
+ rolePrivilegesMap1.put("role2", Sets.newHashSet(testPrivilege4, testPrivilege5));
+ policyFileMappingData1.put(PolicyFileConstants.GROUPS, groupRolesMap1);
+ policyFileMappingData1.put(PolicyFileConstants.ROLES, rolePrivilegesMap1);
+ client.importPolicy(policyFileMappingData1, ADMIN_USER, false);
+
+ Map<String, Map<String, Set<String>>> policyFileMappingData2 = Maps.newHashMap();
+ Map<String, Set<String>> groupRolesMap2 = Maps.newHashMap();
+ groupRolesMap2.put("group1", Sets.newHashSet("role1", "role2"));
+ Map<String, Set<String>> rolePrivilegesMap2 = Maps.newHashMap();
+ rolePrivilegesMap2.put("role1", Sets.newHashSet(testPrivilege3));
+ rolePrivilegesMap2.put("role2", Sets.newHashSet(testPrivilege6));
+ policyFileMappingData2.put(PolicyFileConstants.GROUPS, groupRolesMap2);
+ policyFileMappingData2.put(PolicyFileConstants.ROLES, rolePrivilegesMap2);
+ client.importPolicy(policyFileMappingData2, ADMIN_USER, false);
+
+ Map<String, Map<String, Set<String>>> exceptedMappingData = policyFileMappingData2;
+ Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
+ // all and * should replace the select and insert
+ validateSentryMappingData(sentryMappingData, exceptedMappingData);
+ }
+ });
+ }
+
+ // test the user not in the admin group can't do the import/export
+ @Test
+ public void testImportExportPolicy9() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ Map<String, Map<String, Set<String>>> policyFileMappingData1 = Maps.newHashMap();
+ Map<String, Set<String>> groupRolesMap1 = Maps.newHashMap();
+ Map<String, Set<String>> rolePrivilegesMap1 = Maps.newHashMap();
+ policyFileMappingData1.put(PolicyFileConstants.GROUPS, groupRolesMap1);
+ policyFileMappingData1.put(PolicyFileConstants.ROLES, rolePrivilegesMap1);
+ try {
+ client.importPolicy(policyFileMappingData1, "no-admin-user", false);
+ fail("non-admin can't do the import.");
+ } catch (Exception e) {
+ // excepted exception
+ }
+
+ try {
+ client.exportPolicy("no-admin-user", null);
+ fail("non-admin can't do the export.");
+ } catch (Exception e) {
+ // excepted exception
+ }
+ }
+ });
+ }
+
+ // The following data is imported:
+ // group1=role1
+ // group2=role1,role2
+ // group3=role2,role3
+ // group4=role1,role2,role3
+ // role1=privilege3,privilege4,privilege9
+ // role2=privilege3,privilege4,privilege5,privilege6,privilege7
+ // role3=privilege4,privilege5,privilege6,privilege7,privilege8
+ // Export APIs getRoleNameTPrivilegesMap, getGroupNameRoleNamesMap are tested.
+ @Test
+ public void testExportPolicyWithSpecificObject() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ // import the test data
+ Map<String, Map<String, Set<String>>> policyFileMappingData = Maps.newHashMap();
+ Map<String, Set<String>> groupRolesMap = Maps.newHashMap();
+ groupRolesMap.put("group1", Sets.newHashSet("role1"));
+ groupRolesMap.put("group2", Sets.newHashSet("role1", "role2"));
+ groupRolesMap.put("group3", Sets.newHashSet("role2", "role3"));
+ groupRolesMap.put("group4", Sets.newHashSet("role1", "role2", "role3"));
+ Map<String, Set<String>> rolePrivilegesMap1 = Maps.newHashMap();
+ rolePrivilegesMap1.put("role1",
+ Sets.newHashSet(PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE9));
+ rolePrivilegesMap1.put("role2",
+ Sets.newHashSet(PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE5,
+ PRIVILIEGE6, PRIVILIEGE7));
+ rolePrivilegesMap1.put("role3",
+ Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6,
+ PRIVILIEGE7, PRIVILIEGE8));
+ policyFileMappingData.put(PolicyFileConstants.GROUPS, groupRolesMap);
+ policyFileMappingData.put(PolicyFileConstants.ROLES, rolePrivilegesMap1);
+ client.importPolicy(policyFileMappingData, ADMIN_USER, true);
+
+ // verify the rolePrivilegesMap and groupRolesMap with null objectPath
+ Map<String, Map<String, Set<String>>> expectedMappingData = Maps.newHashMap();
+ Map<String, Set<String>> expectedGroupRoles = Maps.newHashMap();
+ expectedGroupRoles.put("group1", Sets.newHashSet("role1"));
+ expectedGroupRoles.put("group2", Sets.newHashSet("role1", "role2"));
+ expectedGroupRoles.put("group3", Sets.newHashSet("role2", "role3"));
+ expectedGroupRoles.put("group4", Sets.newHashSet("role1", "role2", "role3"));
+ Map<String, Set<String>> expectedRolePrivileges = Maps.newHashMap();
+ expectedRolePrivileges.put("role1", Sets.newHashSet(
+ PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE9));
+ expectedRolePrivileges.put("role2", Sets.newHashSet(PRIVILIEGE3, PRIVILIEGE4,
+ PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7));
+ expectedRolePrivileges.put("role3", Sets.newHashSet(PRIVILIEGE4,
+ PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
+ expectedMappingData.put(PolicyFileConstants.GROUPS, expectedGroupRoles);
+ expectedMappingData.put(PolicyFileConstants.ROLES, expectedRolePrivileges);
+
+ Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
+ validateSentryMappingData(sentryMappingData, expectedMappingData);
+
+ // verify the rolePrivilegesMap and groupRolesMap with empty objectPath
+ expectedMappingData = Maps.newHashMap();
+ expectedGroupRoles = Maps.newHashMap();
+ expectedGroupRoles.put("group1", Sets.newHashSet("role1"));
+ expectedGroupRoles.put("group2", Sets.newHashSet("role1", "role2"));
+ expectedGroupRoles.put("group3", Sets.newHashSet("role2", "role3"));
+ expectedGroupRoles.put("group4", Sets.newHashSet("role1", "role2", "role3"));
+ expectedRolePrivileges = Maps.newHashMap();
+ expectedRolePrivileges.put("role1", Sets.newHashSet(
+ PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE9));
+ expectedRolePrivileges.put("role2", Sets.newHashSet(PRIVILIEGE3, PRIVILIEGE4,
+ PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7));
+ expectedRolePrivileges.put("role3", Sets.newHashSet(PRIVILIEGE4,
+ PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
+ expectedMappingData.put(PolicyFileConstants.GROUPS, expectedGroupRoles);
+ expectedMappingData.put(PolicyFileConstants.ROLES, expectedRolePrivileges);
+
+ sentryMappingData = client.exportPolicy(ADMIN_USER, "");
+ validateSentryMappingData(sentryMappingData, expectedMappingData);
+
+ // verify the rolePrivilegesMap and groupRolesMap for db=db1
+ expectedMappingData = Maps.newHashMap();
+ expectedGroupRoles = Maps.newHashMap();
+ expectedGroupRoles.put("group1", Sets.newHashSet("role1"));
+ expectedGroupRoles.put("group2", Sets.newHashSet("role1", "role2"));
+ expectedGroupRoles.put("group3", Sets.newHashSet("role2", "role3"));
+ expectedGroupRoles.put("group4", Sets.newHashSet("role1", "role2", "role3"));
+ expectedRolePrivileges = Maps.newHashMap();
+ expectedRolePrivileges.put("role1", Sets.newHashSet(PRIVILIEGE4));
+ expectedRolePrivileges.put("role2", Sets.newHashSet(PRIVILIEGE4,
+ PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7));
+ expectedRolePrivileges.put("role3", Sets.newHashSet(PRIVILIEGE4,
+ PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7));
+ expectedMappingData.put(PolicyFileConstants.GROUPS, expectedGroupRoles);
+ expectedMappingData.put(PolicyFileConstants.ROLES, expectedRolePrivileges);
+
+ sentryMappingData = client.exportPolicy(ADMIN_USER, "db=db1");
+ validateSentryMappingData(sentryMappingData, expectedMappingData);
+
+ // verify the rolePrivilegesMap and groupRolesMap for db=db2
+ expectedMappingData = Maps.newHashMap();
+ expectedGroupRoles = Maps.newHashMap();
+ expectedGroupRoles.put("group1", Sets.newHashSet("role1"));
+ expectedGroupRoles.put("group2", Sets.newHashSet("role1", "role2"));
+ expectedGroupRoles.put("group3", Sets.newHashSet("role2"));
+ expectedGroupRoles.put("group4", Sets.newHashSet("role1", "role2"));
+ expectedRolePrivileges = Maps.newHashMap();
+ expectedRolePrivileges.put("role1", Sets.newHashSet(PRIVILIEGE3, PRIVILIEGE9));
+ expectedRolePrivileges.put("role2", Sets.newHashSet(PRIVILIEGE3));
+ expectedMappingData.put(PolicyFileConstants.GROUPS, expectedGroupRoles);
+ expectedMappingData.put(PolicyFileConstants.ROLES, expectedRolePrivileges);
+
+ sentryMappingData = client.exportPolicy(ADMIN_USER, "db=db2");
+ validateSentryMappingData(sentryMappingData, expectedMappingData);
+
+ // verify the rolePrivilegesMap and groupRolesMap for db=db1->table=tbl1
+ expectedMappingData = Maps.newHashMap();
+ expectedGroupRoles = Maps.newHashMap();
+ expectedGroupRoles.put("group1", Sets.newHashSet("role1"));
+ expectedGroupRoles.put("group2", Sets.newHashSet("role1", "role2"));
+ expectedGroupRoles.put("group3", Sets.newHashSet("role2", "role3"));
+ expectedGroupRoles.put("group4", Sets.newHashSet("role1", "role2", "role3"));
+ expectedRolePrivileges = Maps.newHashMap();
+ expectedRolePrivileges.put("role1", Sets.newHashSet(PRIVILIEGE4));
+ expectedRolePrivileges.put("role2", Sets.newHashSet(PRIVILIEGE4));
+ expectedRolePrivileges.put("role3", Sets.newHashSet(PRIVILIEGE4));
+ expectedMappingData.put(PolicyFileConstants.GROUPS, expectedGroupRoles);
+ expectedMappingData.put(PolicyFileConstants.ROLES, expectedRolePrivileges);
+
+ sentryMappingData = client.exportPolicy(ADMIN_USER, "db=db1->table=tbl1");
+ validateSentryMappingData(sentryMappingData, expectedMappingData);
+
+ // verify the rolePrivilegesMap and groupRolesMap for db=db1->table=tbl2
+ expectedMappingData = Maps.newHashMap();
+ expectedGroupRoles = Maps.newHashMap();
+ expectedGroupRoles.put("group2", Sets.newHashSet("role2"));
+ expectedGroupRoles.put("group3", Sets.newHashSet("role2", "role3"));
+ expectedGroupRoles.put("group4", Sets.newHashSet("role2", "role3"));
+ expectedRolePrivileges = Maps.newHashMap();
+ expectedRolePrivileges.put("role2", Sets.newHashSet(PRIVILIEGE5));
+ expectedRolePrivileges.put("role3", Sets.newHashSet(PRIVILIEGE5));
+ expectedMappingData.put(PolicyFileConstants.GROUPS, expectedGroupRoles);
+ expectedMappingData.put(PolicyFileConstants.ROLES, expectedRolePrivileges);
+
+ sentryMappingData = client.exportPolicy(ADMIN_USER, "db=db1->table=tbl2");
+ validateSentryMappingData(sentryMappingData, expectedMappingData);
+
+ // verify the rolePrivilegesMap and groupRolesMap for db=db1->table=tbl1
+ expectedMappingData = Maps.newHashMap();
+ expectedGroupRoles = Maps.newHashMap();
+ expectedGroupRoles.put("group1", Sets.newHashSet("role1"));
+ expectedGroupRoles.put("group2", Sets.newHashSet("role1", "role2"));
+ expectedGroupRoles.put("group3", Sets.newHashSet("role2", "role3"));
+ expectedGroupRoles.put("group4", Sets.newHashSet("role1", "role2", "role3"));
+ expectedRolePrivileges = Maps.newHashMap();
+ expectedRolePrivileges.put("role1", Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE9));
+ expectedRolePrivileges.put("role2", Sets.newHashSet(PRIVILIEGE4));
+ expectedRolePrivileges.put("role3", Sets.newHashSet(PRIVILIEGE4));
+ expectedMappingData.put(PolicyFileConstants.GROUPS, expectedGroupRoles);
+ expectedMappingData.put(PolicyFileConstants.ROLES, expectedRolePrivileges);
+
+ sentryMappingData = client.exportPolicy(ADMIN_USER, "table=tbl1");
+ validateSentryMappingData(sentryMappingData, expectedMappingData);
+
+ // verify the invalid exportObject string
+ try {
+ client.exportPolicy(ADMIN_USER, "invalidString");
+ fail("RuntimeException should be thrown.");
+ } catch (RuntimeException sue) {
+ // excepted exception
+ }
+ }
+ });
+ }
+
+ // Befor import, database is empty.
+ // The following information is imported:
+ // group1=role1,role2,role3
+ // group2=role1,role2,role3
+ // user1=role1,role2,role3
+ // user2=role1,role2,role3
+ // role1=privilege1,privilege2,privilege3,privilege4
+ // role2=privilege1,privilege2,privilege3,privilege4
+ // role3=privilege1,privilege2,privilege3,privilege4
+ @Test
+ public void testImportExportPolicyWithUser() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ Map<String, Map<String, Set<String>>> policyFileMappingData = Maps.newHashMap();
+ Map<String, Set<String>> groupRolesMap = Maps.newHashMap();
+ Map<String, Set<String>> userRolesMap = Maps.newHashMap();
+ Set<String> roles = Sets.newHashSet("role1", "role2", "role3");
+ groupRolesMap.put("group1", roles);
+ groupRolesMap.put("group2", roles);
+ userRolesMap.put("user1", roles);
+ userRolesMap.put("user2", roles);
+ Map<String, Set<String>> rolePrivilegesMap = Maps.newHashMap();
+ for (String roleName : roles) {
+ rolePrivilegesMap.put(roleName, Sets.newHashSet(PRIVILIEGE1,
+ PRIVILIEGE2, PRIVILIEGE3, PRIVILIEGE4));
+ }
+ policyFileMappingData.put(PolicyFileConstants.USER_ROLES, userRolesMap);
+ policyFileMappingData.put(PolicyFileConstants.GROUPS, groupRolesMap);
+ policyFileMappingData.put(PolicyFileConstants.ROLES, rolePrivilegesMap);
+ client.importPolicy(policyFileMappingData, ADMIN_USER, false);
+
+ Map<String, Map<String, Set<String>>> sentryMappingData =
+ client.exportPolicy(ADMIN_USER, null);
+ // validate the [user, role] mapping
+ validateRolesMap(sentryMappingData.get(PolicyFileConstants.USER_ROLES),
+ policyFileMappingData.get(PolicyFileConstants.USER_ROLES));
+ validateSentryMappingData(sentryMappingData,
+ policyFileMappingData);
+ }
+ });
+ }
+
+ // verify the mapping data
+ public void validateSentryMappingData(
+ Map<String, Map<String, Set<String>>> actualMappingData,
+ Map<String, Map<String, Set<String>>> expectedMappingData) {
+ validateRolesMap(actualMappingData.get(PolicyFileConstants.GROUPS),
+ expectedMappingData.get(PolicyFileConstants.GROUPS));
+ validateRolePrivilegesMap(actualMappingData.get(PolicyFileConstants.ROLES),
+ expectedMappingData.get(PolicyFileConstants.ROLES));
+ }
+
+ // verify the mapping data for [group,role] and [user,role]
+ private void validateRolesMap(Map<String, Set<String>> actualMap,
+ Map<String, Set<String>> expectedMap) {
+ assertEquals(expectedMap.keySet().size(), actualMap.keySet().size());
+ for (String name : actualMap.keySet()) {
+ Set<String> actualRoles = actualMap.get(name);
+ Set<String> expectedRoles = expectedMap.get(name);
+ assertEquals(actualRoles.size(), expectedRoles.size());
+ assertTrue(actualRoles.equals(expectedRoles));
+ }
+ }
+
+ // verify the mapping data for [role,privilege]
+ private void validateRolePrivilegesMap(Map<String, Set<String>> actualMap,
+ Map<String, Set<String>> expectedMap) {
+ assertEquals(expectedMap.keySet().size(), actualMap.keySet().size());
+ for (String roleName : actualMap.keySet()) {
+ Set<String> actualPrivileges = actualMap.get(roleName);
+ Set<String> exceptedPrivileges = expectedMap.get(roleName);
+ assertEquals(exceptedPrivileges.size(), actualPrivileges.size());
+ for (String actualPrivilege : actualPrivileges) {
+ boolean isFound = exceptedPrivileges.contains(actualPrivilege);
+ if (!isFound) {
+ String withOptionPrivilege = SentryConstants.AUTHORIZABLE_JOINER.join(actualPrivilege,
+ SentryConstants.KV_JOINER.join(PolicyFileConstants.PRIVILEGE_GRANT_OPTION_NAME,
+ "false"));
+ isFound = exceptedPrivileges.contains(withOptionPrivilege);
+ }
+ assertTrue(isFound);
+ }
+ }
+ }
+}
[36/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
deleted file mode 100644
index ab85418..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
+++ /dev/null
@@ -1,866 +0,0 @@
-/**
- * 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.provider.db.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 TAlterSentryRoleGrantPrivilegeRequest implements org.apache.thrift.TBase<TAlterSentryRoleGrantPrivilegeRequest, TAlterSentryRoleGrantPrivilegeRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleGrantPrivilegeRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleGrantPrivilegeRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField PRIVILEGE_FIELD_DESC = new org.apache.thrift.protocol.TField("privilege", org.apache.thrift.protocol.TType.STRUCT, (short)5);
- private static final org.apache.thrift.protocol.TField PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)6);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleGrantPrivilegeRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleGrantPrivilegeRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private TSentryPrivilege privilege; // optional
- private Set<TSentryPrivilege> privileges; // optional
-
- /** 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName"),
- PRIVILEGE((short)5, "privilege"),
- PRIVILEGES((short)6, "privileges");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- case 5: // PRIVILEGE
- return PRIVILEGE;
- case 6: // PRIVILEGES
- return PRIVILEGES;
- 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 byte __isset_bitfield = 0;
- private static final _Fields optionals[] = {_Fields.PRIVILEGE,_Fields.PRIVILEGES};
- 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.PRIVILEGE, new org.apache.thrift.meta_data.FieldMetaData("privilege", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class)));
- tmpMap.put(_Fields.PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("privileges", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleGrantPrivilegeRequest.class, metaDataMap);
- }
-
- public TAlterSentryRoleGrantPrivilegeRequest() {
- this.protocol_version = 2;
-
- }
-
- public TAlterSentryRoleGrantPrivilegeRequest(
- int protocol_version,
- String requestorUserName,
- String roleName)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleGrantPrivilegeRequest(TAlterSentryRoleGrantPrivilegeRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetPrivilege()) {
- this.privilege = new TSentryPrivilege(other.privilege);
- }
- if (other.isSetPrivileges()) {
- Set<TSentryPrivilege> __this__privileges = new HashSet<TSentryPrivilege>(other.privileges.size());
- for (TSentryPrivilege other_element : other.privileges) {
- __this__privileges.add(new TSentryPrivilege(other_element));
- }
- this.privileges = __this__privileges;
- }
- }
-
- public TAlterSentryRoleGrantPrivilegeRequest deepCopy() {
- return new TAlterSentryRoleGrantPrivilegeRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.privilege = null;
- this.privileges = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public TSentryPrivilege getPrivilege() {
- return this.privilege;
- }
-
- public void setPrivilege(TSentryPrivilege privilege) {
- this.privilege = privilege;
- }
-
- public void unsetPrivilege() {
- this.privilege = null;
- }
-
- /** Returns true if field privilege is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivilege() {
- return this.privilege != null;
- }
-
- public void setPrivilegeIsSet(boolean value) {
- if (!value) {
- this.privilege = null;
- }
- }
-
- public int getPrivilegesSize() {
- return (this.privileges == null) ? 0 : this.privileges.size();
- }
-
- public java.util.Iterator<TSentryPrivilege> getPrivilegesIterator() {
- return (this.privileges == null) ? null : this.privileges.iterator();
- }
-
- public void addToPrivileges(TSentryPrivilege elem) {
- if (this.privileges == null) {
- this.privileges = new HashSet<TSentryPrivilege>();
- }
- this.privileges.add(elem);
- }
-
- public Set<TSentryPrivilege> getPrivileges() {
- return this.privileges;
- }
-
- public void setPrivileges(Set<TSentryPrivilege> privileges) {
- this.privileges = privileges;
- }
-
- public void unsetPrivileges() {
- this.privileges = null;
- }
-
- /** Returns true if field privileges is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivileges() {
- return this.privileges != null;
- }
-
- public void setPrivilegesIsSet(boolean value) {
- if (!value) {
- this.privileges = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case PRIVILEGE:
- if (value == null) {
- unsetPrivilege();
- } else {
- setPrivilege((TSentryPrivilege)value);
- }
- break;
-
- case PRIVILEGES:
- if (value == null) {
- unsetPrivileges();
- } else {
- setPrivileges((Set<TSentryPrivilege>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case PRIVILEGE:
- return getPrivilege();
-
- case PRIVILEGES:
- return getPrivileges();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case PRIVILEGE:
- return isSetPrivilege();
- case PRIVILEGES:
- return isSetPrivileges();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleGrantPrivilegeRequest)
- return this.equals((TAlterSentryRoleGrantPrivilegeRequest)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleGrantPrivilegeRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- boolean this_present_privilege = true && this.isSetPrivilege();
- boolean that_present_privilege = true && that.isSetPrivilege();
- if (this_present_privilege || that_present_privilege) {
- if (!(this_present_privilege && that_present_privilege))
- return false;
- if (!this.privilege.equals(that.privilege))
- return false;
- }
-
- boolean this_present_privileges = true && this.isSetPrivileges();
- boolean that_present_privileges = true && that.isSetPrivileges();
- if (this_present_privileges || that_present_privileges) {
- if (!(this_present_privileges && that_present_privileges))
- return false;
- if (!this.privileges.equals(that.privileges))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- boolean present_privilege = true && (isSetPrivilege());
- list.add(present_privilege);
- if (present_privilege)
- list.add(privilege);
-
- boolean present_privileges = true && (isSetPrivileges());
- list.add(present_privileges);
- if (present_privileges)
- list.add(privileges);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleGrantPrivilegeRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetPrivilege()).compareTo(other.isSetPrivilege());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivilege()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilege, other.privilege);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetPrivileges()).compareTo(other.isSetPrivileges());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivileges()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, other.privileges);
- 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("TAlterSentryRoleGrantPrivilegeRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (isSetPrivilege()) {
- if (!first) sb.append(", ");
- sb.append("privilege:");
- if (this.privilege == null) {
- sb.append("null");
- } else {
- sb.append(this.privilege);
- }
- first = false;
- }
- if (isSetPrivileges()) {
- if (!first) sb.append(", ");
- sb.append("privileges:");
- if (this.privileges == null) {
- sb.append("null");
- } else {
- sb.append(this.privileges);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (privilege != null) {
- privilege.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 TAlterSentryRoleGrantPrivilegeRequestStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleGrantPrivilegeRequestStandardScheme getScheme() {
- return new TAlterSentryRoleGrantPrivilegeRequestStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleGrantPrivilegeRequestStandardScheme extends StandardScheme<TAlterSentryRoleGrantPrivilegeRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleGrantPrivilegeRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // PRIVILEGE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.privilege = new TSentryPrivilege();
- struct.privilege.read(iprot);
- struct.setPrivilegeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 6: // PRIVILEGES
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set32 = iprot.readSetBegin();
- struct.privileges = new HashSet<TSentryPrivilege>(2*_set32.size);
- TSentryPrivilege _elem33;
- for (int _i34 = 0; _i34 < _set32.size; ++_i34)
- {
- _elem33 = new TSentryPrivilege();
- _elem33.read(iprot);
- struct.privileges.add(_elem33);
- }
- iprot.readSetEnd();
- }
- struct.setPrivilegesIsSet(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, TAlterSentryRoleGrantPrivilegeRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.privilege != null) {
- if (struct.isSetPrivilege()) {
- oprot.writeFieldBegin(PRIVILEGE_FIELD_DESC);
- struct.privilege.write(oprot);
- oprot.writeFieldEnd();
- }
- }
- if (struct.privileges != null) {
- if (struct.isSetPrivileges()) {
- oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.privileges.size()));
- for (TSentryPrivilege _iter35 : struct.privileges)
- {
- _iter35.write(oprot);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleGrantPrivilegeRequestTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleGrantPrivilegeRequestTupleScheme getScheme() {
- return new TAlterSentryRoleGrantPrivilegeRequestTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleGrantPrivilegeRequestTupleScheme extends TupleScheme<TAlterSentryRoleGrantPrivilegeRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- BitSet optionals = new BitSet();
- if (struct.isSetPrivilege()) {
- optionals.set(0);
- }
- if (struct.isSetPrivileges()) {
- optionals.set(1);
- }
- oprot.writeBitSet(optionals, 2);
- if (struct.isSetPrivilege()) {
- struct.privilege.write(oprot);
- }
- if (struct.isSetPrivileges()) {
- {
- oprot.writeI32(struct.privileges.size());
- for (TSentryPrivilege _iter36 : struct.privileges)
- {
- _iter36.write(oprot);
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- BitSet incoming = iprot.readBitSet(2);
- if (incoming.get(0)) {
- struct.privilege = new TSentryPrivilege();
- struct.privilege.read(iprot);
- struct.setPrivilegeIsSet(true);
- }
- if (incoming.get(1)) {
- {
- org.apache.thrift.protocol.TSet _set37 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.privileges = new HashSet<TSentryPrivilege>(2*_set37.size);
- TSentryPrivilege _elem38;
- for (int _i39 = 0; _i39 < _set37.size; ++_i39)
- {
- _elem38 = new TSentryPrivilege();
- _elem38.read(iprot);
- struct.privileges.add(_elem38);
- }
- }
- struct.setPrivilegesIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeResponse.java
deleted file mode 100644
index 9ef6718..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeResponse.java
+++ /dev/null
@@ -1,669 +0,0 @@
-/**
- * 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.provider.db.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 TAlterSentryRoleGrantPrivilegeResponse implements org.apache.thrift.TBase<TAlterSentryRoleGrantPrivilegeResponse, TAlterSentryRoleGrantPrivilegeResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleGrantPrivilegeResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleGrantPrivilegeResponse");
-
- 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 PRIVILEGE_FIELD_DESC = new org.apache.thrift.protocol.TField("privilege", org.apache.thrift.protocol.TType.STRUCT, (short)2);
- private static final org.apache.thrift.protocol.TField PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)3);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleGrantPrivilegeResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleGrantPrivilegeResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
- private TSentryPrivilege privilege; // optional
- private Set<TSentryPrivilege> privileges; // optional
-
- /** 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"),
- PRIVILEGE((short)2, "privilege"),
- PRIVILEGES((short)3, "privileges");
-
- 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: // PRIVILEGE
- return PRIVILEGE;
- case 3: // PRIVILEGES
- return PRIVILEGES;
- 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 _Fields optionals[] = {_Fields.PRIVILEGE,_Fields.PRIVILEGES};
- 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.PRIVILEGE, new org.apache.thrift.meta_data.FieldMetaData("privilege", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class)));
- tmpMap.put(_Fields.PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("privileges", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleGrantPrivilegeResponse.class, metaDataMap);
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse() {
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleGrantPrivilegeResponse(TAlterSentryRoleGrantPrivilegeResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- if (other.isSetPrivilege()) {
- this.privilege = new TSentryPrivilege(other.privilege);
- }
- if (other.isSetPrivileges()) {
- Set<TSentryPrivilege> __this__privileges = new HashSet<TSentryPrivilege>(other.privileges.size());
- for (TSentryPrivilege other_element : other.privileges) {
- __this__privileges.add(new TSentryPrivilege(other_element));
- }
- this.privileges = __this__privileges;
- }
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse deepCopy() {
- return new TAlterSentryRoleGrantPrivilegeResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- this.privilege = null;
- this.privileges = null;
- }
-
- 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 TSentryPrivilege getPrivilege() {
- return this.privilege;
- }
-
- public void setPrivilege(TSentryPrivilege privilege) {
- this.privilege = privilege;
- }
-
- public void unsetPrivilege() {
- this.privilege = null;
- }
-
- /** Returns true if field privilege is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivilege() {
- return this.privilege != null;
- }
-
- public void setPrivilegeIsSet(boolean value) {
- if (!value) {
- this.privilege = null;
- }
- }
-
- public int getPrivilegesSize() {
- return (this.privileges == null) ? 0 : this.privileges.size();
- }
-
- public java.util.Iterator<TSentryPrivilege> getPrivilegesIterator() {
- return (this.privileges == null) ? null : this.privileges.iterator();
- }
-
- public void addToPrivileges(TSentryPrivilege elem) {
- if (this.privileges == null) {
- this.privileges = new HashSet<TSentryPrivilege>();
- }
- this.privileges.add(elem);
- }
-
- public Set<TSentryPrivilege> getPrivileges() {
- return this.privileges;
- }
-
- public void setPrivileges(Set<TSentryPrivilege> privileges) {
- this.privileges = privileges;
- }
-
- public void unsetPrivileges() {
- this.privileges = null;
- }
-
- /** Returns true if field privileges is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivileges() {
- return this.privileges != null;
- }
-
- public void setPrivilegesIsSet(boolean value) {
- if (!value) {
- this.privileges = null;
- }
- }
-
- 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 PRIVILEGE:
- if (value == null) {
- unsetPrivilege();
- } else {
- setPrivilege((TSentryPrivilege)value);
- }
- break;
-
- case PRIVILEGES:
- if (value == null) {
- unsetPrivileges();
- } else {
- setPrivileges((Set<TSentryPrivilege>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- case PRIVILEGE:
- return getPrivilege();
-
- case PRIVILEGES:
- return getPrivileges();
-
- }
- 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 PRIVILEGE:
- return isSetPrivilege();
- case PRIVILEGES:
- return isSetPrivileges();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleGrantPrivilegeResponse)
- return this.equals((TAlterSentryRoleGrantPrivilegeResponse)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleGrantPrivilegeResponse 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_privilege = true && this.isSetPrivilege();
- boolean that_present_privilege = true && that.isSetPrivilege();
- if (this_present_privilege || that_present_privilege) {
- if (!(this_present_privilege && that_present_privilege))
- return false;
- if (!this.privilege.equals(that.privilege))
- return false;
- }
-
- boolean this_present_privileges = true && this.isSetPrivileges();
- boolean that_present_privileges = true && that.isSetPrivileges();
- if (this_present_privileges || that_present_privileges) {
- if (!(this_present_privileges && that_present_privileges))
- return false;
- if (!this.privileges.equals(that.privileges))
- 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_privilege = true && (isSetPrivilege());
- list.add(present_privilege);
- if (present_privilege)
- list.add(privilege);
-
- boolean present_privileges = true && (isSetPrivileges());
- list.add(present_privileges);
- if (present_privileges)
- list.add(privileges);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleGrantPrivilegeResponse 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(isSetPrivilege()).compareTo(other.isSetPrivilege());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivilege()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilege, other.privilege);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetPrivileges()).compareTo(other.isSetPrivileges());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivileges()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, other.privileges);
- 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("TAlterSentryRoleGrantPrivilegeResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- if (isSetPrivilege()) {
- if (!first) sb.append(", ");
- sb.append("privilege:");
- if (this.privilege == null) {
- sb.append("null");
- } else {
- sb.append(this.privilege);
- }
- first = false;
- }
- if (isSetPrivileges()) {
- if (!first) sb.append(", ");
- sb.append("privileges:");
- if (this.privileges == null) {
- sb.append("null");
- } else {
- sb.append(this.privileges);
- }
- 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());
- }
-
- // check for sub-struct validity
- if (status != null) {
- status.validate();
- }
- if (privilege != null) {
- privilege.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 TAlterSentryRoleGrantPrivilegeResponseStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleGrantPrivilegeResponseStandardScheme getScheme() {
- return new TAlterSentryRoleGrantPrivilegeResponseStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleGrantPrivilegeResponseStandardScheme extends StandardScheme<TAlterSentryRoleGrantPrivilegeResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleGrantPrivilegeResponse 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: // PRIVILEGE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.privilege = new TSentryPrivilege();
- struct.privilege.read(iprot);
- struct.setPrivilegeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // PRIVILEGES
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set40 = iprot.readSetBegin();
- struct.privileges = new HashSet<TSentryPrivilege>(2*_set40.size);
- TSentryPrivilege _elem41;
- for (int _i42 = 0; _i42 < _set40.size; ++_i42)
- {
- _elem41 = new TSentryPrivilege();
- _elem41.read(iprot);
- struct.privileges.add(_elem41);
- }
- iprot.readSetEnd();
- }
- struct.setPrivilegesIsSet(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, TAlterSentryRoleGrantPrivilegeResponse 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();
- }
- if (struct.privilege != null) {
- if (struct.isSetPrivilege()) {
- oprot.writeFieldBegin(PRIVILEGE_FIELD_DESC);
- struct.privilege.write(oprot);
- oprot.writeFieldEnd();
- }
- }
- if (struct.privileges != null) {
- if (struct.isSetPrivileges()) {
- oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.privileges.size()));
- for (TSentryPrivilege _iter43 : struct.privileges)
- {
- _iter43.write(oprot);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleGrantPrivilegeResponseTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleGrantPrivilegeResponseTupleScheme getScheme() {
- return new TAlterSentryRoleGrantPrivilegeResponseTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleGrantPrivilegeResponseTupleScheme extends TupleScheme<TAlterSentryRoleGrantPrivilegeResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- BitSet optionals = new BitSet();
- if (struct.isSetPrivilege()) {
- optionals.set(0);
- }
- if (struct.isSetPrivileges()) {
- optionals.set(1);
- }
- oprot.writeBitSet(optionals, 2);
- if (struct.isSetPrivilege()) {
- struct.privilege.write(oprot);
- }
- if (struct.isSetPrivileges()) {
- {
- oprot.writeI32(struct.privileges.size());
- for (TSentryPrivilege _iter44 : struct.privileges)
- {
- _iter44.write(oprot);
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeResponse 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);
- BitSet incoming = iprot.readBitSet(2);
- if (incoming.get(0)) {
- struct.privilege = new TSentryPrivilege();
- struct.privilege.read(iprot);
- struct.setPrivilegeIsSet(true);
- }
- if (incoming.get(1)) {
- {
- org.apache.thrift.protocol.TSet _set45 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.privileges = new HashSet<TSentryPrivilege>(2*_set45.size);
- TSentryPrivilege _elem46;
- for (int _i47 = 0; _i47 < _set45.size; ++_i47)
- {
- _elem46 = new TSentryPrivilege();
- _elem46.read(iprot);
- struct.privileges.add(_elem46);
- }
- }
- struct.setPrivilegesIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
deleted file mode 100644
index 1bc35fa..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
+++ /dev/null
@@ -1,866 +0,0 @@
-/**
- * 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.provider.db.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 TAlterSentryRoleRevokePrivilegeRequest implements org.apache.thrift.TBase<TAlterSentryRoleRevokePrivilegeRequest, TAlterSentryRoleRevokePrivilegeRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleRevokePrivilegeRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleRevokePrivilegeRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField PRIVILEGE_FIELD_DESC = new org.apache.thrift.protocol.TField("privilege", org.apache.thrift.protocol.TType.STRUCT, (short)5);
- private static final org.apache.thrift.protocol.TField PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)6);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleRevokePrivilegeRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleRevokePrivilegeRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private TSentryPrivilege privilege; // optional
- private Set<TSentryPrivilege> privileges; // optional
-
- /** 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName"),
- PRIVILEGE((short)5, "privilege"),
- PRIVILEGES((short)6, "privileges");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- case 5: // PRIVILEGE
- return PRIVILEGE;
- case 6: // PRIVILEGES
- return PRIVILEGES;
- 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 byte __isset_bitfield = 0;
- private static final _Fields optionals[] = {_Fields.PRIVILEGE,_Fields.PRIVILEGES};
- 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.PRIVILEGE, new org.apache.thrift.meta_data.FieldMetaData("privilege", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class)));
- tmpMap.put(_Fields.PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("privileges", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleRevokePrivilegeRequest.class, metaDataMap);
- }
-
- public TAlterSentryRoleRevokePrivilegeRequest() {
- this.protocol_version = 2;
-
- }
-
- public TAlterSentryRoleRevokePrivilegeRequest(
- int protocol_version,
- String requestorUserName,
- String roleName)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleRevokePrivilegeRequest(TAlterSentryRoleRevokePrivilegeRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetPrivilege()) {
- this.privilege = new TSentryPrivilege(other.privilege);
- }
- if (other.isSetPrivileges()) {
- Set<TSentryPrivilege> __this__privileges = new HashSet<TSentryPrivilege>(other.privileges.size());
- for (TSentryPrivilege other_element : other.privileges) {
- __this__privileges.add(new TSentryPrivilege(other_element));
- }
- this.privileges = __this__privileges;
- }
- }
-
- public TAlterSentryRoleRevokePrivilegeRequest deepCopy() {
- return new TAlterSentryRoleRevokePrivilegeRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.privilege = null;
- this.privileges = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public TSentryPrivilege getPrivilege() {
- return this.privilege;
- }
-
- public void setPrivilege(TSentryPrivilege privilege) {
- this.privilege = privilege;
- }
-
- public void unsetPrivilege() {
- this.privilege = null;
- }
-
- /** Returns true if field privilege is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivilege() {
- return this.privilege != null;
- }
-
- public void setPrivilegeIsSet(boolean value) {
- if (!value) {
- this.privilege = null;
- }
- }
-
- public int getPrivilegesSize() {
- return (this.privileges == null) ? 0 : this.privileges.size();
- }
-
- public java.util.Iterator<TSentryPrivilege> getPrivilegesIterator() {
- return (this.privileges == null) ? null : this.privileges.iterator();
- }
-
- public void addToPrivileges(TSentryPrivilege elem) {
- if (this.privileges == null) {
- this.privileges = new HashSet<TSentryPrivilege>();
- }
- this.privileges.add(elem);
- }
-
- public Set<TSentryPrivilege> getPrivileges() {
- return this.privileges;
- }
-
- public void setPrivileges(Set<TSentryPrivilege> privileges) {
- this.privileges = privileges;
- }
-
- public void unsetPrivileges() {
- this.privileges = null;
- }
-
- /** Returns true if field privileges is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivileges() {
- return this.privileges != null;
- }
-
- public void setPrivilegesIsSet(boolean value) {
- if (!value) {
- this.privileges = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case PRIVILEGE:
- if (value == null) {
- unsetPrivilege();
- } else {
- setPrivilege((TSentryPrivilege)value);
- }
- break;
-
- case PRIVILEGES:
- if (value == null) {
- unsetPrivileges();
- } else {
- setPrivileges((Set<TSentryPrivilege>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case PRIVILEGE:
- return getPrivilege();
-
- case PRIVILEGES:
- return getPrivileges();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case PRIVILEGE:
- return isSetPrivilege();
- case PRIVILEGES:
- return isSetPrivileges();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleRevokePrivilegeRequest)
- return this.equals((TAlterSentryRoleRevokePrivilegeRequest)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleRevokePrivilegeRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- boolean this_present_privilege = true && this.isSetPrivilege();
- boolean that_present_privilege = true && that.isSetPrivilege();
- if (this_present_privilege || that_present_privilege) {
- if (!(this_present_privilege && that_present_privilege))
- return false;
- if (!this.privilege.equals(that.privilege))
- return false;
- }
-
- boolean this_present_privileges = true && this.isSetPrivileges();
- boolean that_present_privileges = true && that.isSetPrivileges();
- if (this_present_privileges || that_present_privileges) {
- if (!(this_present_privileges && that_present_privileges))
- return false;
- if (!this.privileges.equals(that.privileges))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- boolean present_privilege = true && (isSetPrivilege());
- list.add(present_privilege);
- if (present_privilege)
- list.add(privilege);
-
- boolean present_privileges = true && (isSetPrivileges());
- list.add(present_privileges);
- if (present_privileges)
- list.add(privileges);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleRevokePrivilegeRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetPrivilege()).compareTo(other.isSetPrivilege());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivilege()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilege, other.privilege);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetPrivileges()).compareTo(other.isSetPrivileges());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivileges()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, other.privileges);
- 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("TAlterSentryRoleRevokePrivilegeRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (isSetPrivilege()) {
- if (!first) sb.append(", ");
- sb.append("privilege:");
- if (this.privilege == null) {
- sb.append("null");
- } else {
- sb.append(this.privilege);
- }
- first = false;
- }
- if (isSetPrivileges()) {
- if (!first) sb.append(", ");
- sb.append("privileges:");
- if (this.privileges == null) {
- sb.append("null");
- } else {
- sb.append(this.privileges);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (privilege != null) {
- privilege.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 TAlterSentryRoleRevokePrivilegeRequestStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleRevokePrivilegeRequestStandardScheme getScheme() {
- return new TAlterSentryRoleRevokePrivilegeRequestStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleRevokePrivilegeRequestStandardScheme extends StandardScheme<TAlterSentryRoleRevokePrivilegeRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleRevokePrivilegeRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // PRIVILEGE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.privilege = new TSentryPrivilege();
- struct.privilege.read(iprot);
- struct.setPrivilegeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 6: // PRIVILEGES
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set48 = iprot.readSetBegin();
- struct.privileges = new HashSet<TSentryPrivilege>(2*_set48.size);
- TSentryPrivilege _elem49;
- for (int _i50 = 0; _i50 < _set48.size; ++_i50)
- {
- _elem49 = new TSentryPrivilege();
- _elem49.read(iprot);
- struct.privileges.add(_elem49);
- }
- iprot.readSetEnd();
- }
- struct.setPrivilegesIsSet(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, TAlterSentryRoleRevokePrivilegeRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.privilege != null) {
- if (struct.isSetPrivilege()) {
- oprot.writeFieldBegin(PRIVILEGE_FIELD_DESC);
- struct.privilege.write(oprot);
- oprot.writeFieldEnd();
- }
- }
- if (struct.privileges != null) {
- if (struct.isSetPrivileges()) {
- oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.privileges.size()));
- for (TSentryPrivilege _iter51 : struct.privileges)
- {
- _iter51.write(oprot);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleRevokePrivilegeRequestTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleRevokePrivilegeRequestTupleScheme getScheme() {
- return new TAlterSentryRoleRevokePrivilegeRequestTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleRevokePrivilegeRequestTupleScheme extends TupleScheme<TAlterSentryRoleRevokePrivilegeRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- BitSet optionals = new BitSet();
- if (struct.isSetPrivilege()) {
- optionals.set(0);
- }
- if (struct.isSetPrivileges()) {
- optionals.set(1);
- }
- oprot.writeBitSet(optionals, 2);
- if (struct.isSetPrivilege()) {
- struct.privilege.write(oprot);
- }
- if (struct.isSetPrivileges()) {
- {
- oprot.writeI32(struct.privileges.size());
- for (TSentryPrivilege _iter52 : struct.privileges)
- {
- _iter52.write(oprot);
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- BitSet incoming = iprot.readBitSet(2);
- if (incoming.get(0)) {
- struct.privilege = new TSentryPrivilege();
- struct.privilege.read(iprot);
- struct.setPrivilegeIsSet(true);
- }
- if (incoming.get(1)) {
- {
- org.apache.thrift.protocol.TSet _set53 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.privileges = new HashSet<TSentryPrivilege>(2*_set53.size);
- TSentryPrivilege _elem54;
- for (int _i55 = 0; _i55 < _set53.size; ++_i55)
- {
- _elem54 = new TSentryPrivilege();
- _elem54.read(iprot);
- struct.privileges.add(_elem54);
- }
- }
- struct.setPrivilegesIsSet(true);
- }
- }
- }
-
-}
-
[18/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/TestSentryGenericPolicyProcessor.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/TestSentryGenericPolicyProcessor.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/TestSentryGenericPolicyProcessor.java
new file mode 100644
index 0000000..4c207e9
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/TestSentryGenericPolicyProcessor.java
@@ -0,0 +1,364 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.generic.thrift;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyListOf;
+import static org.mockito.Matchers.anySetOf;
+import static org.mockito.Matchers.anyString;
+
+import java.util.*;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.sentry.core.common.Authorizable;
+import org.apache.sentry.core.common.exception.SentrySiteConfigurationException;
+import org.apache.sentry.core.model.solr.Collection;
+import org.apache.sentry.core.model.solr.Field;
+import org.apache.sentry.core.model.solr.SolrConstants;
+import org.apache.sentry.core.common.exception.SentryAlreadyExistsException;
+import org.apache.sentry.core.common.exception.SentryGrantDeniedException;
+import org.apache.sentry.core.common.exception.SentryInvalidInputException;
+import org.apache.sentry.core.common.exception.SentryNoSuchObjectException;
+import org.apache.sentry.provider.common.GroupMappingService;
+import org.apache.sentry.provider.db.generic.service.persistent.PrivilegeObject;
+import org.apache.sentry.provider.db.generic.service.persistent.SentryStoreLayer;
+import org.apache.sentry.provider.db.generic.service.persistent.PrivilegeObject.Builder;
+import org.apache.sentry.provider.db.service.model.MSentryGMPrivilege;
+import org.apache.sentry.provider.db.service.model.MSentryRole;
+import org.apache.sentry.core.common.utils.PolicyStoreConstants;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
+import org.apache.sentry.api.common.Status;
+import org.apache.sentry.service.thrift.TSentryResponseStatus;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import com.google.common.collect.Sets;
+
+public class TestSentryGenericPolicyProcessor extends org.junit.Assert {
+ private static final String ADMIN_GROUP = "admin_group";
+ private static final String ADMIN_USER = "admin_user";
+ private static final String NOT_ADMIN_USER = "not_admin_user";
+ private static final String NOT_ADMIN_GROUP = "not_admin_group";
+ private static final String NO_GROUP_USER = "no_group_user";
+
+ private SentryStoreLayer mockStore = Mockito.mock(SentryStoreLayer.class);
+ private SentryGenericPolicyProcessor processor;
+
+ @Before
+ public void setup() throws Exception {
+ Configuration conf = new Configuration();
+ conf.set(ServerConfig.ADMIN_GROUPS, ADMIN_GROUP);
+ conf.set(ServerConfig.SENTRY_STORE_GROUP_MAPPING, MockGroupMapping.class.getName());
+ processor = new SentryGenericPolicyProcessor(conf, mockStore);
+ }
+
+ @Test
+ public void testNotAdminOperation() throws Exception {
+ String requestUser = NOT_ADMIN_USER;
+ Status validateStatus = Status.ACCESS_DENIED;
+ testOperation(requestUser, validateStatus);
+ }
+
+ private void testOperation(String requestUser, Status validateStatus) throws Exception {
+ TCreateSentryRoleRequest createrequest = new TCreateSentryRoleRequest();
+ createrequest.setRequestorUserName(requestUser);
+ createrequest.setRoleName("r1");
+ assertEquals(validateStatus, fromTSentryStatus(processor.create_sentry_role(createrequest).getStatus()));
+
+ TDropSentryRoleRequest dropRequest = new TDropSentryRoleRequest();
+ dropRequest.setRequestorUserName(requestUser);
+ dropRequest.setRoleName("r1");
+ assertEquals(validateStatus, fromTSentryStatus(processor.drop_sentry_role(dropRequest).getStatus()));
+
+ TAlterSentryRoleAddGroupsRequest addRequest = new TAlterSentryRoleAddGroupsRequest();
+ addRequest.setRequestorUserName(requestUser);
+ addRequest.setRoleName("r1");
+ addRequest.setGroups(Sets.newHashSet("g1"));
+ assertEquals(validateStatus, fromTSentryStatus(processor.alter_sentry_role_add_groups(addRequest).getStatus()));
+
+ TAlterSentryRoleDeleteGroupsRequest delRequest = new TAlterSentryRoleDeleteGroupsRequest();
+ delRequest.setRequestorUserName(requestUser);
+ delRequest.setRoleName("r1");
+ delRequest.setGroups(Sets.newHashSet("g1"));
+ assertEquals(validateStatus, fromTSentryStatus(processor.alter_sentry_role_delete_groups(delRequest).getStatus()));
+
+ TDropPrivilegesRequest dropPrivRequest = new TDropPrivilegesRequest();
+ dropPrivRequest.setRequestorUserName(requestUser);
+ dropPrivRequest.setPrivilege(new TSentryPrivilege("test", "test", new ArrayList<TAuthorizable>(), "test"));
+ assertEquals(validateStatus, fromTSentryStatus(processor.drop_sentry_privilege(dropPrivRequest).getStatus()));
+
+ TRenamePrivilegesRequest renameRequest = new TRenamePrivilegesRequest();
+ renameRequest.setRequestorUserName(requestUser);
+ assertEquals(validateStatus, fromTSentryStatus(processor.rename_sentry_privilege(renameRequest).getStatus()));
+ }
+
+ private Status fromTSentryStatus(TSentryResponseStatus status) {
+ return Status.fromCode(status.getValue());
+ }
+
+ @Test
+ public void testAdminOperation() throws Exception {
+ testOperation(ADMIN_USER, Status.OK);
+ }
+
+ @Test
+ public void testGrantAndRevokePrivilege() throws Exception {
+ setup();
+
+ TSentryPrivilege tprivilege = new TSentryPrivilege("test", "test", new ArrayList<TAuthorizable>(), "test");
+ tprivilege.setGrantOption(TSentryGrantOption.UNSET);
+
+ TAlterSentryRoleGrantPrivilegeRequest grantRequest = new TAlterSentryRoleGrantPrivilegeRequest();
+ grantRequest.setRequestorUserName(ADMIN_USER);
+ grantRequest.setRoleName("r1");
+ grantRequest.setPrivilege(tprivilege);
+ assertEquals(Status.OK, fromTSentryStatus(processor.alter_sentry_role_grant_privilege(grantRequest).getStatus()));
+
+ TAlterSentryRoleRevokePrivilegeRequest revokeRequest = new TAlterSentryRoleRevokePrivilegeRequest();
+ revokeRequest.setRequestorUserName(ADMIN_USER);
+ revokeRequest.setRoleName("r1");
+ revokeRequest.setPrivilege(tprivilege);
+ assertEquals(Status.OK, fromTSentryStatus(processor.alter_sentry_role_revoke_privilege(revokeRequest).getStatus()));
+ }
+
+ @Test
+ public void testOperationWithException() throws Exception {
+ String roleName = anyString();
+ Mockito.when(mockStore.createRole(anyString(), roleName, anyString()))
+ .thenThrow(new SentryAlreadyExistsException("Role: " + roleName));
+
+ roleName = anyString();
+ Mockito.when(mockStore.dropRole(anyString(), roleName, anyString()))
+ .thenThrow(new SentryNoSuchObjectException("Role: " + roleName ));
+
+ roleName = anyString();
+ Mockito.when(mockStore.alterRoleAddGroups(anyString(), roleName, anySetOf(String.class),anyString()))
+ .thenThrow(new SentryNoSuchObjectException("Role: " + roleName));
+
+ roleName = anyString();
+ Mockito.when(mockStore.alterRoleDeleteGroups(anyString(), roleName, anySetOf(String.class), anyString()))
+ .thenThrow(new SentryNoSuchObjectException("Role: " + roleName));
+
+ roleName = anyString();
+ Mockito.when(mockStore.alterRoleGrantPrivilege(anyString(), roleName, any(PrivilegeObject.class), anyString()))
+ .thenThrow(new SentryGrantDeniedException("Role: " + roleName + " is not allowed to do grant"));
+
+ roleName = anyString();
+ Mockito.when(mockStore.alterRoleRevokePrivilege(anyString(), roleName, any(PrivilegeObject.class), anyString()))
+ .thenThrow(new SentryGrantDeniedException("Role: " + roleName + " is not allowed to do grant"));
+
+ Mockito.when(mockStore.dropPrivilege(anyString(), any(PrivilegeObject.class), anyString()))
+ .thenThrow(new SentryInvalidInputException("Invalid input privilege object"));
+
+ Mockito.when(mockStore.renamePrivilege(anyString(), anyString(), anyListOf(Authorizable.class),
+ anyListOf(Authorizable.class), anyString()))
+ .thenThrow(new RuntimeException("Unknown error"));
+
+ setup();
+
+ TCreateSentryRoleRequest createrequest = new TCreateSentryRoleRequest();
+ createrequest.setRequestorUserName(ADMIN_USER);
+ createrequest.setRoleName("r1");
+ assertEquals(Status.ALREADY_EXISTS, fromTSentryStatus(processor.create_sentry_role(createrequest).getStatus()));
+
+ TDropSentryRoleRequest dropRequest = new TDropSentryRoleRequest();
+ dropRequest.setRequestorUserName(ADMIN_USER);
+ dropRequest.setRoleName("r1");
+ assertEquals(Status.NO_SUCH_OBJECT, fromTSentryStatus(processor.drop_sentry_role(dropRequest).getStatus()));
+
+ TAlterSentryRoleAddGroupsRequest addRequest = new TAlterSentryRoleAddGroupsRequest();
+ addRequest.setRequestorUserName(ADMIN_USER);
+ addRequest.setRoleName("r1");
+ addRequest.setGroups(Sets.newHashSet("g1"));
+ assertEquals(Status.NO_SUCH_OBJECT, fromTSentryStatus(processor.alter_sentry_role_add_groups(addRequest).getStatus()));
+
+ TAlterSentryRoleDeleteGroupsRequest delRequest = new TAlterSentryRoleDeleteGroupsRequest();
+ delRequest.setRequestorUserName(ADMIN_USER);
+ delRequest.setRoleName("r1");
+ delRequest.setGroups(Sets.newHashSet("g1"));
+ assertEquals(Status.NO_SUCH_OBJECT, fromTSentryStatus(processor.alter_sentry_role_delete_groups(delRequest).getStatus()));
+
+ TDropPrivilegesRequest dropPrivRequest = new TDropPrivilegesRequest();
+ dropPrivRequest.setRequestorUserName(ADMIN_USER);
+ dropPrivRequest.setPrivilege(new TSentryPrivilege("test", "test", new ArrayList<TAuthorizable>(), "test"));
+ assertEquals(Status.INVALID_INPUT, fromTSentryStatus(processor.drop_sentry_privilege(dropPrivRequest).getStatus()));
+
+ TRenamePrivilegesRequest renameRequest = new TRenamePrivilegesRequest();
+ renameRequest.setRequestorUserName(ADMIN_USER);
+ assertEquals(Status.RUNTIME_ERROR, fromTSentryStatus(processor.rename_sentry_privilege(renameRequest).getStatus()));
+
+ TSentryPrivilege tprivilege = new TSentryPrivilege("test", "test", new ArrayList<TAuthorizable>(), "test");
+ tprivilege.setGrantOption(TSentryGrantOption.UNSET);
+
+ TAlterSentryRoleGrantPrivilegeRequest grantRequest = new TAlterSentryRoleGrantPrivilegeRequest();
+ grantRequest.setRequestorUserName(ADMIN_USER);
+ grantRequest.setRoleName("r1");
+ grantRequest.setPrivilege(tprivilege);
+ assertEquals(Status.ACCESS_DENIED, fromTSentryStatus(processor.alter_sentry_role_grant_privilege(grantRequest).getStatus()));
+
+ TAlterSentryRoleRevokePrivilegeRequest revokeRequest = new TAlterSentryRoleRevokePrivilegeRequest();
+ revokeRequest.setRequestorUserName(ADMIN_USER);
+ revokeRequest.setRoleName("r1");
+ revokeRequest.setPrivilege(tprivilege);
+ assertEquals(Status.ACCESS_DENIED, fromTSentryStatus(processor.alter_sentry_role_revoke_privilege(revokeRequest).getStatus()));
+ }
+
+ @Test
+ public void testUserWithNoGroup() throws Exception {
+ setup();
+
+ TCreateSentryRoleRequest createrequest = new TCreateSentryRoleRequest();
+ createrequest.setRequestorUserName(NO_GROUP_USER);
+ createrequest.setRoleName("r1");
+ assertEquals(Status.ACCESS_DENIED, fromTSentryStatus(processor.create_sentry_role(createrequest).getStatus()));
+
+ TDropSentryRoleRequest dropRequest = new TDropSentryRoleRequest();
+ dropRequest.setRequestorUserName(NO_GROUP_USER);
+ dropRequest.setRoleName("r1");
+ assertEquals(Status.ACCESS_DENIED, fromTSentryStatus(processor.drop_sentry_role(dropRequest).getStatus()));
+
+ TAlterSentryRoleAddGroupsRequest addRequest = new TAlterSentryRoleAddGroupsRequest();
+ addRequest.setRequestorUserName(NO_GROUP_USER);
+ addRequest.setRoleName("r1");
+ addRequest.setGroups(Sets.newHashSet("g1"));
+ assertEquals(Status.ACCESS_DENIED, fromTSentryStatus(processor.alter_sentry_role_add_groups(addRequest).getStatus()));
+
+ TAlterSentryRoleDeleteGroupsRequest delRequest = new TAlterSentryRoleDeleteGroupsRequest();
+ delRequest.setRequestorUserName(NO_GROUP_USER);
+ delRequest.setRoleName("r1");
+ delRequest.setGroups(Sets.newHashSet("g1"));
+ assertEquals(Status.ACCESS_DENIED, fromTSentryStatus(processor.alter_sentry_role_delete_groups(delRequest).getStatus()));
+
+ TDropPrivilegesRequest dropPrivRequest = new TDropPrivilegesRequest();
+ dropPrivRequest.setRequestorUserName(NO_GROUP_USER);
+ dropPrivRequest.setPrivilege(new TSentryPrivilege("test", "test", new ArrayList<TAuthorizable>(), "test"));
+ assertEquals(Status.ACCESS_DENIED, fromTSentryStatus(processor.drop_sentry_privilege(dropPrivRequest).getStatus()));
+
+ TRenamePrivilegesRequest renameRequest = new TRenamePrivilegesRequest();
+ renameRequest.setRequestorUserName(NO_GROUP_USER);
+ assertEquals(Status.ACCESS_DENIED, fromTSentryStatus(processor.rename_sentry_privilege(renameRequest).getStatus()));
+
+ // Can't test GrantPrivilege / RevokePrivilege since the authorization happens
+ // in the persistence layer, which isn't setup in this test.
+ }
+
+ @Test
+ public void testGetRolesAndPrivileges() throws Exception {
+ String roleName = "r1";
+ String groupName = "g1";
+ PrivilegeObject queryPrivilege = new Builder()
+ .setComponent("SOLR")
+ .setAction(SolrConstants.QUERY)
+ .setService("service1")
+ .setAuthorizables(Arrays.asList(new Collection("c1"), new Field("f1")))
+ .build();
+ PrivilegeObject updatePrivilege = new Builder(queryPrivilege)
+ .setAction(SolrConstants.UPDATE)
+ .build();
+
+ MSentryGMPrivilege mSentryGMPrivilege = new MSentryGMPrivilege("SOLR", "service1",
+ Arrays.asList(new Collection("c1"), new Field("f1")),
+ SolrConstants.QUERY, true);
+
+ MSentryRole role = new MSentryRole("r1", 290);
+ mSentryGMPrivilege.setRoles(Sets.newHashSet(role));
+
+ Mockito.when(mockStore.getRolesByGroups(anyString(), anySetOf(String.class)))
+ .thenReturn(Sets.newHashSet(roleName));
+
+ Mockito.when(mockStore.getPrivilegesByProvider(anyString(), anyString(), anySetOf(String.class),
+ anySetOf(String.class), anyListOf(Authorizable.class)))
+ .thenReturn(Sets.newHashSet(queryPrivilege, updatePrivilege));
+
+ Mockito.when(mockStore.getGroupsByRoles(anyString(), anySetOf(String.class)))
+ .thenReturn(Sets.newHashSet(groupName));
+
+ Mockito.when(mockStore.getPrivilegesByAuthorizable(anyString(), anyString(), anySetOf(String.class), anyListOf(Authorizable.class)))
+ .thenReturn(Sets.newHashSet(mSentryGMPrivilege));
+
+ Mockito.when(mockStore.getAllRoleNames())
+ .thenReturn(Sets.newHashSet(roleName));
+
+ TListSentryPrivilegesRequest request1 = new TListSentryPrivilegesRequest();
+ request1.setRoleName(roleName);
+ request1.setRequestorUserName(ADMIN_USER);
+ TListSentryPrivilegesResponse response1 = processor.list_sentry_privileges_by_role(request1);
+ assertEquals(Status.OK, fromTSentryStatus(response1.getStatus()));
+ assertEquals(2, response1.getPrivileges().size());
+
+ TListSentryRolesRequest request2 = new TListSentryRolesRequest();
+ request2.setRequestorUserName(ADMIN_USER);
+ request2.setGroupName(groupName);
+ TListSentryRolesResponse response2 = processor.list_sentry_roles_by_group(request2);
+ assertEquals(Status.OK, fromTSentryStatus(response2.getStatus()));
+ assertEquals(1, response2.getRoles().size());
+
+ TListSentryPrivilegesForProviderRequest request3 = new TListSentryPrivilegesForProviderRequest();
+ request3.setGroups(Sets.newHashSet(groupName));
+ request3.setRoleSet(new TSentryActiveRoleSet(true, null));
+ TListSentryPrivilegesForProviderResponse response3 = processor.list_sentry_privileges_for_provider(request3);
+ assertEquals(Status.OK, fromTSentryStatus(response3.getStatus()));
+ assertEquals(2, response3.getPrivileges().size());
+
+ // Optional parameters activeRoleSet and requested group name are both provided.
+ TListSentryPrivilegesByAuthRequest request4 = new TListSentryPrivilegesByAuthRequest();
+ request4.setGroups(Sets.newHashSet(groupName));
+ request4.setRoleSet(new TSentryActiveRoleSet(true, null));
+ request4.setRequestorUserName(ADMIN_USER);
+ Set<String> authorizablesSet = Sets.newHashSet("Collection=c1->Field=f1");
+ request4.setAuthorizablesSet(authorizablesSet);
+
+ TListSentryPrivilegesByAuthResponse response4 = processor.list_sentry_privileges_by_authorizable(request4);
+ assertEquals(Status.OK, fromTSentryStatus(response4.getStatus()));
+ assertEquals(1, response4.getPrivilegesMapByAuth().size());
+
+ // Optional parameters activeRoleSet and requested group name are both not provided.
+ TListSentryPrivilegesByAuthRequest request5 = new TListSentryPrivilegesByAuthRequest();
+ request5.setRequestorUserName("not_" + ADMIN_USER);
+ authorizablesSet = Sets.newHashSet("Collection=c1->Field=f2");
+ request5.setAuthorizablesSet(authorizablesSet);
+
+ TListSentryPrivilegesByAuthResponse response5 = processor.list_sentry_privileges_by_authorizable(request5);
+ assertEquals(Status.OK, fromTSentryStatus(response5.getStatus()));
+ assertEquals(1, response5.getPrivilegesMapByAuth().size());
+ }
+
+ @Test(expected=SentrySiteConfigurationException.class)
+ public void testConfigCannotCreateNotificationHandler() throws Exception {
+ Configuration conf = new Configuration();
+ conf.set(PolicyStoreConstants.SENTRY_GENERIC_POLICY_NOTIFICATION,"junk");
+ SentryGenericPolicyProcessor.createHandlers(conf);
+ }
+
+ public static class MockGroupMapping implements GroupMappingService {
+ public MockGroupMapping(Configuration conf, String resource) { //NOPMD
+ }
+ @Override
+ public Set<String> getGroups(String user) {
+ if (user.equalsIgnoreCase(ADMIN_USER)) {
+ return Sets.newHashSet(ADMIN_GROUP);
+ } else if (user.equalsIgnoreCase(NOT_ADMIN_USER)){
+ return Sets.newHashSet(NOT_ADMIN_GROUP);
+ } else {
+ return Collections.emptySet();
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/TestSentryGenericServiceClient.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/TestSentryGenericServiceClient.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/TestSentryGenericServiceClient.java
new file mode 100644
index 0000000..2f72e88
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/TestSentryGenericServiceClient.java
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sentry.api.generic.thrift;
+
+import java.util.Set;
+
+import org.apache.sentry.service.thrift.SentryServiceFactory;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.google.common.collect.Sets;
+
+public class TestSentryGenericServiceClient extends SentryGenericServiceIntegrationBase {
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ beforeSetup();
+ setupConf();
+ startSentryService();
+ afterSetup();
+ kerberos = false;
+ }
+
+ @Test
+ public void testConnectionWhenReconnect() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ String roleName = "admin_r";
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName, "solr");
+ client.createRole(requestorUserName, roleName, "solr");
+ stopSentryService();
+ server = SentryServiceFactory.create(conf);
+ startSentryService();
+ client.dropRole(requestorUserName, roleName, "solr");
+ }
+ });
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/TestSentryGenericServiceIntegration.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/TestSentryGenericServiceIntegration.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/TestSentryGenericServiceIntegration.java
new file mode 100644
index 0000000..8a3ce02
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/generic/thrift/TestSentryGenericServiceIntegration.java
@@ -0,0 +1,503 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.generic.thrift;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.sentry.core.common.exception.SentryUserException;
+import org.apache.sentry.core.common.ActiveRoleSet;
+import org.apache.sentry.core.common.Authorizable;
+import org.apache.sentry.core.model.solr.Collection;
+import org.apache.sentry.core.model.solr.Field;
+import org.apache.sentry.core.model.solr.SolrConstants;
+import org.junit.Test;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+public class TestSentryGenericServiceIntegration extends SentryGenericServiceIntegrationBase {
+
+ @Test
+ public void testCreateDropShowRole() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ String roleName = "admin_r";
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName, SOLR);
+
+ client.createRole(requestorUserName, roleName, SOLR);
+
+ client.grantRoleToGroups(requestorUserName, roleName, SOLR, Sets.newHashSet(requestorUserGroupNames));
+
+ Set<TSentryRole> roles = client.listUserRoles(requestorUserName,SOLR);
+ assertEquals("Incorrect number of roles", 1, roles.size());
+ for (TSentryRole role:roles) {
+ assertTrue(role.getRoleName(), role.getRoleName().equalsIgnoreCase(roleName));
+ }
+ client.dropRole(requestorUserName, roleName, SOLR);
+ }});
+ }
+
+ @Test
+ public void testAddDeleteRoleToGroup() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ String testGroupName = "g1";
+ String roleName = "admin_r";
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ setLocalGroupMapping(requestorUserName, Sets.newHashSet(testGroupName));
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName, SOLR);
+
+ client.createRole(requestorUserName, roleName, SOLR);
+
+ client.grantRoleToGroups(requestorUserName, roleName, SOLR, Sets.newHashSet(testGroupName));
+
+ Set<TSentryRole> roles = client.listUserRoles(requestorUserName,SOLR);
+ assertEquals("Incorrect number of roles", 1, roles.size());
+ for (TSentryRole role:roles) {
+ assertTrue(role.getRoleName(), role.getRoleName().equalsIgnoreCase(roleName));
+ assertTrue(role.getGroups().size() == 1);
+ for (String group :role.getGroups()) {
+ assertEquals(testGroupName, group);
+ }
+ }
+
+ client.revokeRoleFromGroups(requestorUserName, roleName, SOLR, Sets.newHashSet(testGroupName));
+ roles = client.listUserRoles(requestorUserName,SOLR);
+ assertEquals("Incorrect number of roles", 0, roles.size());
+
+ client.dropRole(requestorUserName, roleName, SOLR);
+ }});
+ }
+
+ @Test
+ public void testGranRevokePrivilege() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+ String roleName1 = "admin_r1";
+ String roleName2 = "admin_r2";
+
+ client.dropRoleIfExists(requestorUserName, roleName1, SOLR);
+ client.createRole(requestorUserName, roleName1, SOLR);
+
+ client.dropRoleIfExists(requestorUserName, roleName2, SOLR);
+ client.createRole(requestorUserName, roleName2, SOLR);
+
+ TSentryPrivilege queryPrivilege = new TSentryPrivilege(SOLR, "service1",
+ fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
+ SolrConstants.QUERY);
+
+ TSentryPrivilege updatePrivilege = new TSentryPrivilege(SOLR, "service1",
+ fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
+ SolrConstants.UPDATE);
+
+ client.grantPrivilege(requestorUserName, roleName1, SOLR, queryPrivilege);
+ client.grantPrivilege(requestorUserName, roleName2, SOLR, updatePrivilege);
+
+ client.revokePrivilege(requestorUserName, roleName1, SOLR, queryPrivilege);
+ client.revokePrivilege(requestorUserName, roleName2, SOLR, updatePrivilege);
+ }});
+ }
+
+ @Test
+ public void testMultipleRolesSamePrivilege() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+ String roleName1 = "admin_r1";
+ String roleName2 = "admin_r2";
+
+ client.dropRoleIfExists(requestorUserName, roleName1, SOLR);
+ client.createRole(requestorUserName, roleName1, SOLR);
+
+ client.dropRoleIfExists(requestorUserName, roleName2, SOLR);
+ client.createRole(requestorUserName, roleName2, SOLR);
+
+ TSentryPrivilege queryPrivilege = new TSentryPrivilege(SOLR, "service1",
+ fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
+ SolrConstants.QUERY);
+
+ client.grantPrivilege(requestorUserName, roleName1, SOLR, queryPrivilege);
+ Set<TSentryPrivilege> listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1, SOLR, "service1");
+ assertTrue("Privilege not assigned to role1 !!", listPrivilegesByRoleName.size() == 1);
+
+ client.grantPrivilege(requestorUserName, roleName2, SOLR, queryPrivilege);
+ listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2, SOLR, "service1");
+ assertTrue("Privilege not assigned to role2 !!", listPrivilegesByRoleName.size() == 1);
+ }});
+ }
+
+ @Test
+ public void testShowRoleGrant() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ String roleName = "admin_r1";
+ String groupName = "group1";
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ setLocalGroupMapping(requestorUserName, Sets.newHashSet(groupName));
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName, SOLR);
+ client.createRole(requestorUserName, roleName, SOLR);
+ client.grantRoleToGroups(requestorUserName, roleName, SOLR, Sets.newHashSet(groupName));
+
+ Set<TSentryRole> groupRoles = client.listRolesByGroupName(requestorUserName, groupName,SOLR);
+ assertTrue(groupRoles.size() == 1);
+ for (TSentryRole role:groupRoles) {
+ assertTrue(role.getRoleName(), role.getRoleName().equalsIgnoreCase(roleName));
+ assertTrue(role.getGroups().size() == 1);
+ for (String group :role.getGroups()) {
+ assertEquals(groupName, group);
+ }
+ }
+
+ client.dropRole(requestorUserName, roleName, SOLR);
+ }});
+ }
+
+ @Test
+ public void testShowGrant() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ String roleName = "admin_r1";
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName, SOLR);
+ client.createRole(requestorUserName, roleName, SOLR);
+
+ TSentryPrivilege queryPrivilege = new TSentryPrivilege(SOLR, "service1",
+ fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
+ SolrConstants.QUERY);
+
+ TSentryPrivilege updatePrivilege = new TSentryPrivilege(SOLR, "service1",
+ fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
+ SolrConstants.UPDATE);
+
+ client.grantPrivilege(requestorUserName, roleName, SOLR, updatePrivilege);
+ client.grantPrivilege(requestorUserName, roleName, SOLR, queryPrivilege);
+ Set<TSentryPrivilege> privileges = client.listAllPrivilegesByRoleName(requestorUserName, roleName, SOLR, "service1");
+ assertTrue(privileges.size() == 2);
+
+ client.revokePrivilege(requestorUserName, roleName, SOLR, updatePrivilege);
+ privileges = client.listAllPrivilegesByRoleName(requestorUserName, roleName, SOLR, "service1");
+ assertTrue(privileges.size() == 1);
+ }});
+ }
+
+ @Test
+ public void testSameGrantTwice() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+ String roleName = "admin_r1";
+
+ client.createRole(requestorUserName, roleName, SOLR);
+
+ TSentryPrivilege queryPrivilege = new TSentryPrivilege(SOLR, "service1",
+ fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
+ SolrConstants.QUERY);
+
+ client.grantPrivilege(requestorUserName, roleName, SOLR, queryPrivilege);
+ assertEquals(1, client.listAllPrivilegesByRoleName(requestorUserName, roleName, SOLR, "service1").size());
+ }});
+ }
+
+ @Test
+ public void testGrantRevokeWithGrantOption() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String adminUser = ADMIN_USER;
+ Set<String> adminGroup = Sets.newHashSet(ADMIN_GROUP);
+ String grantOptionUser = "user1";
+ Set<String> grantOptionGroup = Sets.newHashSet("group1");
+ String noGrantOptionUser = "user2";
+ Set<String> noGrantOptionGroup = Sets.newHashSet("group2");
+
+ setLocalGroupMapping(adminUser, adminGroup);
+ setLocalGroupMapping(grantOptionUser, grantOptionGroup);
+ setLocalGroupMapping(noGrantOptionUser, noGrantOptionGroup);
+ writePolicyFile();
+
+ String grantRole = "grant_r";
+ String noGrantRole = "no_grant_r";
+ String testRole = "test_role";
+
+ client.createRole(adminUser, grantRole, SOLR);
+ client.createRole(adminUser, noGrantRole, SOLR);
+ client.createRole(adminUser, testRole, SOLR);
+
+ TSentryPrivilege grantPrivilege = new TSentryPrivilege(SOLR, "service1",
+ fromAuthorizable(Arrays.asList(new Collection("c1"))),
+ SolrConstants.QUERY);
+ grantPrivilege.setGrantOption(TSentryGrantOption.TRUE);
+
+ TSentryPrivilege noGrantPrivilege = new TSentryPrivilege(SOLR, "service1",
+ fromAuthorizable(Arrays.asList(new Collection("c1"))),
+ SolrConstants.QUERY);
+ noGrantPrivilege.setGrantOption(TSentryGrantOption.FALSE);
+
+ TSentryPrivilege testPrivilege = new TSentryPrivilege(SOLR, "service1",
+ fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
+ SolrConstants.QUERY);
+ testPrivilege.setGrantOption(TSentryGrantOption.FALSE);
+
+ client.grantPrivilege(adminUser, grantRole, SOLR, grantPrivilege);
+ client.grantPrivilege(adminUser, noGrantRole, SOLR, noGrantPrivilege);
+
+ client.grantRoleToGroups(adminUser, grantRole, SOLR, grantOptionGroup);
+ client.grantRoleToGroups(adminUser, noGrantRole, SOLR, noGrantOptionGroup);
+
+ try {
+ client.grantPrivilege(grantOptionUser,testRole,SOLR, testPrivilege);
+ } catch (SentryUserException e) {
+ fail("grantOptionUser failed grant privilege to user");
+ }
+
+ try {
+ client.grantPrivilege(noGrantOptionUser, testRole, SOLR, testPrivilege);
+ fail("noGrantOptionUser can't grant privilege to user");
+ } catch (SentryUserException e) {
+ }
+
+ try {
+ client.revokePrivilege(grantOptionUser, testRole, SOLR, testPrivilege);
+ } catch(SentryUserException e) {
+ fail("grantOptionUser failed revoke privilege to user");
+ }
+
+ try {
+ client.revokePrivilege(noGrantOptionUser, testRole, SOLR, testPrivilege);
+ fail("noGrantOptionUser can't revoke privilege to user");
+ } catch (SentryUserException e) {
+ }
+ }});
+ }
+
+ @Test
+ public void testGetPrivilegeByHierarchy() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String adminUser = ADMIN_USER;
+ Set<String> adminGroup = Sets.newHashSet(ADMIN_GROUP);
+ String testRole = "role1";
+ Set<String> testGroup = Sets.newHashSet("group1");
+ String testUser = "user1";
+ setLocalGroupMapping(adminUser, adminGroup);
+ setLocalGroupMapping(testUser, testGroup);
+ writePolicyFile();
+
+
+ client.createRole(adminUser, testRole, SOLR);
+ client.grantRoleToGroups(adminUser, testRole, SOLR, testGroup);
+
+ TSentryPrivilege queryPrivilege = new TSentryPrivilege(SOLR, "service1",
+ fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
+ SolrConstants.QUERY);
+
+ TSentryPrivilege updatePrivilege = new TSentryPrivilege(SOLR, "service1",
+ fromAuthorizable(Arrays.asList(new Collection("c2"), new Field("f2"))),
+ SolrConstants.UPDATE);
+
+ client.grantPrivilege(adminUser, testRole, SOLR, queryPrivilege);
+ client.grantPrivilege(adminUser, testRole, SOLR, updatePrivilege);
+
+ assertEquals(2, client.listAllPrivilegesByRoleName(testUser, testRole, SOLR, "service1").size());
+
+ assertEquals(1, client.listPrivilegesByRoleName(testUser, testRole,
+ SOLR, "service1", Arrays.asList(new Collection("c1"))).size());
+
+ assertEquals(1, client.listPrivilegesByRoleName(testUser, testRole,
+ SOLR, "service1", Arrays.asList(new Collection("c2"))).size());
+
+ assertEquals(1, client.listPrivilegesByRoleName(testUser, testRole,
+ SOLR, "service1", Arrays.asList(new Collection("c1"), new Field("f1"))).size());
+
+ assertEquals(1, client.listPrivilegesByRoleName(testUser, testRole,
+ SOLR, "service1", Arrays.asList(new Collection("c2"), new Field("f2"))).size());
+
+ //test listPrivilegesForProvider by group(testGroup)
+ ActiveRoleSet roleSet = ActiveRoleSet.ALL;
+
+ assertEquals(1, client.listPrivilegesForProvider(SOLR, "service1", roleSet,
+ testGroup, Arrays.asList(new Collection("c1"))).size());
+
+ assertEquals(1, client.listPrivilegesForProvider(SOLR, "service1", roleSet,
+ testGroup, Arrays.asList(new Collection("c2"))).size());
+
+ assertEquals(1, client.listPrivilegesForProvider(SOLR, "service1", roleSet,
+ testGroup, Arrays.asList(new Collection("c1"), new Field("f1"))).size());
+
+ assertEquals(1, client.listPrivilegesForProvider(SOLR, "service1", roleSet,
+ testGroup, Arrays.asList(new Collection("c2"), new Field("f2"))).size());
+ }});
+ }
+
+ @Test
+ public void testGetPrivilegeByAuthorizable() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String adminUser = ADMIN_USER;
+ Set<String> adminGroup = Sets.newHashSet(ADMIN_GROUP);
+ String testRole = "role1";
+ Set<String> testGroup = Sets.newHashSet("group1");
+ String testUser = "user1";
+ setLocalGroupMapping(adminUser, adminGroup);
+ setLocalGroupMapping(testUser, testGroup);
+ writePolicyFile();
+
+ client.createRole(adminUser, testRole, SOLR);
+ client.grantRoleToGroups(adminUser, testRole, SOLR, adminGroup);
+
+ TSentryPrivilege queryPrivilege = new TSentryPrivilege(SOLR, "service1",
+ fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
+ SolrConstants.QUERY);
+
+ TSentryPrivilege updatePrivilege = new TSentryPrivilege(SOLR, "service1",
+ fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f2"))),
+ SolrConstants.UPDATE);
+
+ client.grantPrivilege(adminUser, testRole, SOLR, queryPrivilege);
+ client.grantPrivilege(adminUser, testRole, SOLR, updatePrivilege);
+
+ //test listPrivilegesbyAuthorizable without requested group and active role set.
+ assertEquals(1, client.listPrivilegesbyAuthorizable(SOLR, "service1", adminUser,
+ Sets.newHashSet(new String("Collection=c1->Field=f1")), null, null).size());
+
+ //test listPrivilegesbyAuthorizable with requested group (testGroup)
+ Map<String, TSentryPrivilegeMap> privilegeMap = client.listPrivilegesbyAuthorizable(SOLR,
+ "service1", adminUser, Sets.newHashSet(new String("Collection=c1->Field=f1")), testGroup, null);
+ TSentryPrivilegeMap actualMap = privilegeMap.get(new String("Collection=c1->Field=f1"));
+ assertEquals(0, actualMap.getPrivilegeMap().size());
+
+ //test listPrivilegesbyAuthorizable with active role set.
+ ActiveRoleSet roleSet = ActiveRoleSet.ALL;
+ assertEquals(1, client.listPrivilegesbyAuthorizable(SOLR, "service1", adminUser,
+ Sets.newHashSet(new String("Collection=c1->Field=f1")), null, roleSet).size());
+ privilegeMap = client.listPrivilegesbyAuthorizable(SOLR,
+ "service1", adminUser, Sets.newHashSet(new String("Collection=c1->Field=f1")), null, roleSet);
+ actualMap = privilegeMap.get(new String("Collection=c1->Field=f1"));
+ assertEquals(1, actualMap.getPrivilegeMap().size());
+
+ privilegeMap = client.listPrivilegesbyAuthorizable(SOLR,
+ "service1", testUser, Sets.newHashSet(new String("Collection=c1->Field=f1")), null, roleSet);
+ actualMap = privilegeMap.get(new String("Collection=c1->Field=f1"));
+ assertEquals(0, actualMap.getPrivilegeMap().size());
+
+ // grant tesRole to testGroup.
+ client.grantRoleToGroups(adminUser, testRole, SOLR, testGroup);
+
+ privilegeMap = client.listPrivilegesbyAuthorizable(SOLR,
+ "service1", testUser, Sets.newHashSet(new String("Collection=c1")), null, roleSet);
+ actualMap = privilegeMap.get(new String("Collection=c1"));
+ assertEquals(1, actualMap.getPrivilegeMap().size());
+ assertEquals(2, actualMap.getPrivilegeMap().get(testRole).size());
+ }});
+ }
+
+ @Test
+ public void testDropAndRenamePrivilege() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+ String roleName = "admin_r1";
+
+ client.createRole(requestorUserName, roleName, SOLR);
+
+ TSentryPrivilege queryPrivilege = new TSentryPrivilege(SOLR, "service1",
+ fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
+ SolrConstants.QUERY);
+ client.grantPrivilege(requestorUserName, roleName, SOLR, queryPrivilege);
+
+ assertEquals(1, client.listPrivilegesByRoleName(requestorUserName, roleName,
+ SOLR, "service1", Arrays.asList(new Collection("c1"), new Field("f1"))).size());
+
+ assertEquals(0, client.listPrivilegesByRoleName(requestorUserName, roleName,
+ SOLR, "service1", Arrays.asList(new Collection("c2"), new Field("f2"))).size());
+
+ client.renamePrivilege(requestorUserName, SOLR, "service1", Arrays.asList(new Collection("c1"), new Field("f1")),
+ Arrays.asList(new Collection("c2"), new Field("f2")));
+
+ assertEquals(0, client.listPrivilegesByRoleName(requestorUserName, roleName,
+ SOLR, "service1", Arrays.asList(new Collection("c1"), new Field("f1"))).size());
+
+ assertEquals(1, client.listPrivilegesByRoleName(requestorUserName, roleName,
+ SOLR, "service1", Arrays.asList(new Collection("c2"), new Field("f2"))).size());
+
+ TSentryPrivilege dropPrivilege = new TSentryPrivilege(SOLR, "service1",
+ fromAuthorizable(Arrays.asList(new Collection("c2"), new Field("f2"))),
+ SolrConstants.QUERY);
+
+ client.dropPrivilege(requestorUserName, SOLR, dropPrivilege);
+
+ assertEquals(0, client.listPrivilegesByRoleName(requestorUserName, roleName,
+ SOLR, "service1", Arrays.asList(new Collection("c2"), new Field("f2"))).size());
+ }});
+ }
+
+ private List<TAuthorizable> fromAuthorizable(List<? extends Authorizable> authorizables) {
+ List<TAuthorizable> tAuthorizables = Lists.newArrayList();
+ for (Authorizable authorizable : authorizables) {
+ tAuthorizables.add(new TAuthorizable(authorizable.getTypeName(), authorizable.getName()));
+ }
+ return tAuthorizables;
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/SentryMiniKdcTestcase.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/SentryMiniKdcTestcase.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/SentryMiniKdcTestcase.java
new file mode 100644
index 0000000..fb5c9a0
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/SentryMiniKdcTestcase.java
@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sentry.api.service.thrift;
+
+import java.io.File;
+import java.util.Properties;
+
+import org.apache.hadoop.minikdc.MiniKdc;
+
+public class SentryMiniKdcTestcase {
+
+ private static File workDir;
+ private static Properties conf;
+ private static MiniKdc kdc;
+
+ public static void startMiniKdc(Properties confOverlay) throws Exception {
+ createTestDir();
+ createMiniKdcConf(confOverlay);
+ kdc = new MiniKdc(conf, workDir);
+ kdc.start();
+ }
+
+ private static void createMiniKdcConf(Properties confOverlay) {
+ conf = MiniKdc.createConf();
+ for ( Object property : confOverlay.keySet()) {
+ conf.put(property, confOverlay.get(property));
+ }
+ }
+
+ private static void createTestDir() {
+ workDir = new File(System.getProperty("test.dir", "target"));
+ }
+
+ public static void stopMiniKdc() {
+ if (kdc != null) {
+ kdc.stop();
+ }
+ }
+
+ public static MiniKdc getKdc() {
+ return kdc;
+ }
+
+ public static File getWorkDir() {
+ return workDir;
+ }
+
+ public Properties getConf() {
+ return conf;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestAuthorizingDDLAuditLogWithKerberos.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestAuthorizingDDLAuditLogWithKerberos.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestAuthorizingDDLAuditLogWithKerberos.java
new file mode 100644
index 0000000..fb41241
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestAuthorizingDDLAuditLogWithKerberos.java
@@ -0,0 +1,295 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sentry.api.service.thrift;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.sentry.provider.db.log.appender.AuditLoggerTestAppender;
+import org.apache.sentry.provider.db.log.util.CommandUtil;
+import org.apache.sentry.provider.db.log.util.Constants;
+import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+import org.codehaus.jettison.json.JSONObject;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.google.common.collect.Sets;
+
+public class TestAuthorizingDDLAuditLogWithKerberos extends SentryServiceIntegrationBase {
+
+ @BeforeClass
+ public static void setupLog4j() throws Exception {
+ Logger logger = Logger.getLogger("sentry.hive.authorization.ddl.logger");
+ AuditLoggerTestAppender testAppender = new AuditLoggerTestAppender();
+ logger.addAppender(testAppender);
+ logger.setLevel(Level.INFO);
+ }
+
+ @Test
+ public void testBasic() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ String roleName = "testRole";
+ String errorRoleName = "errorRole";
+ String serverName = "server1";
+ String groupName = "testGroup";
+ String dbName = "dbTest";
+ String tableName = "tableTest";
+ Map<String, String> fieldValueMap = new HashMap<String, String>();
+
+ // for successful audit log
+ client.createRole(requestorUserName, roleName);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_CREATE_ROLE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "CREATE ROLE " + roleName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
+ // for ip address, there is another logic to test the result
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+
+ client.grantRoleToGroup(requestorUserName, groupName, roleName);
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_ADD_ROLE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT ROLE " + roleName
+ + " TO GROUP " + groupName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+
+ client.grantDatabasePrivilege(requestorUserName, roleName, serverName, dbName, "ALL");
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_GRANT_PRIVILEGE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT ALL ON DATABASE " + dbName
+ + " TO ROLE " + roleName);
+ fieldValueMap.put(Constants.LOG_FIELD_DATABASE_NAME, dbName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+
+ client.grantTablePrivilege(requestorUserName, roleName, serverName, dbName, tableName,
+ "SELECT", true);
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_GRANT_PRIVILEGE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT SELECT ON TABLE " + tableName
+ + " TO ROLE " + roleName + " WITH GRANT OPTION");
+ fieldValueMap.put(Constants.LOG_FIELD_TABLE_NAME, tableName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+
+ // for error audit log
+ try {
+ client.createRole(requestorUserName, roleName);
+ fail("Exception should have been thrown");
+ } catch (Exception e) {
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_CREATE_ROLE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "CREATE ROLE " + roleName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ }
+ try {
+ client.grantRoleToGroup(requestorUserName, groupName, errorRoleName);
+ fail("Exception should have been thrown");
+ } catch (Exception e) {
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_ADD_ROLE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT ROLE " + errorRoleName
+ + " TO GROUP " + groupName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ }
+ try {
+ client
+ .grantDatabasePrivilege(requestorUserName, errorRoleName, serverName, dbName, "ALL");
+ fail("Exception should have been thrown");
+ } catch (Exception e) {
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_GRANT_PRIVILEGE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT ALL ON DATABASE " + dbName
+ + " TO ROLE " + errorRoleName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ }
+ try {
+ client.grantDatabasePrivilege(requestorUserName, errorRoleName, serverName, dbName,
+ "INSERT");
+ fail("Exception should have been thrown");
+ } catch (Exception e) {
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_GRANT_PRIVILEGE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT INSERT ON DATABASE "
+ + dbName + " TO ROLE " + errorRoleName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ }
+ try {
+ client.grantDatabasePrivilege(requestorUserName, errorRoleName, serverName, dbName,
+ "SELECT");
+ fail("Exception should have been thrown");
+ } catch (Exception e) {
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_GRANT_PRIVILEGE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT SELECT ON DATABASE "
+ + dbName + " TO ROLE " + errorRoleName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ }
+ try {
+ client.grantTablePrivilege(requestorUserName, errorRoleName, serverName, dbName,
+ tableName, "SELECT");
+ fail("Exception should have been thrown");
+ } catch (Exception e) {
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_GRANT_PRIVILEGE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT SELECT ON TABLE "
+ + tableName + " TO ROLE " + errorRoleName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ }
+
+ client.revokeTablePrivilege(requestorUserName, roleName, serverName, dbName, tableName,
+ "SELECT");
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_REVOKE_PRIVILEGE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "REVOKE SELECT ON TABLE " + tableName
+ + " FROM ROLE " + roleName);
+ fieldValueMap.put(Constants.LOG_FIELD_TABLE_NAME, tableName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+
+ client.revokeDatabasePrivilege(requestorUserName, roleName, serverName, dbName, "ALL");
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_REVOKE_PRIVILEGE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "REVOKE ALL ON DATABASE " + dbName
+ + " FROM ROLE " + roleName);
+ fieldValueMap.put(Constants.LOG_FIELD_DATABASE_NAME, dbName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+
+ client.revokeRoleFromGroup(requestorUserName, groupName, roleName);
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_DELETE_ROLE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "REVOKE ROLE " + roleName
+ + " FROM GROUP " + groupName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+
+ client.dropRole(requestorUserName, roleName);
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_DROP_ROLE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "DROP ROLE " + roleName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+
+ // for error audit log
+ try {
+ client.revokeTablePrivilege(requestorUserName, errorRoleName, serverName, dbName,
+ tableName, "SELECT");
+ fail("Exception should have been thrown");
+ } catch (Exception e) {
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_REVOKE_PRIVILEGE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "REVOKE SELECT ON TABLE "
+ + tableName + " FROM ROLE " + errorRoleName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ }
+
+ try {
+ client.revokeDatabasePrivilege(requestorUserName, errorRoleName, serverName, dbName,
+ "ALL");
+ fail("Exception should have been thrown");
+ } catch (Exception e) {
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_REVOKE_PRIVILEGE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "REVOKE ALL ON DATABASE " + dbName
+ + " FROM ROLE " + errorRoleName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ }
+
+ try {
+ client.revokeRoleFromGroup(requestorUserName, groupName, errorRoleName);
+ fail("Exception should have been thrown");
+ } catch (Exception e) {
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_DELETE_ROLE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "REVOKE ROLE " + errorRoleName
+ + " FROM GROUP " + groupName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ }
+
+ try {
+ client.dropRole(requestorUserName, errorRoleName);
+ fail("Exception should have been thrown");
+ } catch (Exception e) {
+ fieldValueMap.clear();
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_DROP_ROLE);
+ fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "DROP ROLE " + errorRoleName);
+ fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
+ fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
+ assertAuditLog(fieldValueMap);
+ }
+ }
+ });
+ }
+
+ private void assertAuditLog(Map<String, String> fieldValueMap) throws Exception {
+ assertThat(AuditLoggerTestAppender.getLastLogLevel(), is(Level.INFO));
+ JSONObject jsonObject = new JSONObject(AuditLoggerTestAppender.getLastLogEvent());
+ if (fieldValueMap != null) {
+ for (Map.Entry<String, String> entry : fieldValueMap.entrySet()) {
+ String entryKey = entry.getKey();
+ if (Constants.LOG_FIELD_IP_ADDRESS.equals(entryKey)) {
+ assertTrue(CommandUtil.assertIPInAuditLog(jsonObject.get(entryKey).toString()));
+ } else {
+ assertTrue(entry.getValue().equalsIgnoreCase(jsonObject.get(entryKey).toString()));
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestConnectionWithTicketTimeout.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestConnectionWithTicketTimeout.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestConnectionWithTicketTimeout.java
new file mode 100644
index 0000000..7d8c58d
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestConnectionWithTicketTimeout.java
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sentry.api.service.thrift;
+
+import org.apache.hadoop.minikdc.MiniKdc;
+import org.apache.sentry.service.common.ServiceConstants;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore("SENTRY-515: Not part of automated unit testing, as it takes too long. Fails until we move to a hadoop 2.6.1. See HADOOP-10786")
+public class TestConnectionWithTicketTimeout extends
+ org.apache.sentry.service.thrift.SentryServiceIntegrationBase {
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ kerberos = true;
+ beforeSetup();
+ setupConf();
+ startSentryService();
+ afterSetup();
+ }
+
+ public static void beforeSetup() throws Exception {
+ kdcConfOverlay.setProperty(MiniKdc.MAX_TICKET_LIFETIME, "360001");
+ //Only UGI based client connections renew their TGT, this is not a problem in the real world
+ // as this is not configurable and always true
+ conf.set(ServiceConstants.ServerConfig.SECURITY_USE_UGI_TRANSPORT, "true");
+ }
+
+ /***
+ * Test is run only when sentry.hive.test.ticket.timeout is set to "true"
+ * @throws Exception
+ */
+ @Test
+ public void testConnectionAfterTicketTimeout() throws Exception {
+ Thread.sleep(400000);
+ connectToSentryService();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestNotificationHandlerInvoker.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestNotificationHandlerInvoker.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestNotificationHandlerInvoker.java
new file mode 100644
index 0000000..92f3f8b
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestNotificationHandlerInvoker.java
@@ -0,0 +1,102 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sentry.api.service.thrift;
+
+import org.apache.hadoop.conf.Configuration;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import com.google.common.collect.Lists;
+
+public class TestNotificationHandlerInvoker {
+
+ private Configuration conf;
+ private NotificationHandler handler;
+ private NotificationHandlerInvoker invoker;
+
+ @Before
+ public void setup() throws Exception {
+ conf = new Configuration(false);
+ handler = Mockito.spy(new NotificationHandler(conf) {});
+ invoker = new NotificationHandlerInvoker(conf,
+ Lists.newArrayList(new ThrowingNotificationHandler(conf), handler));
+ }
+
+ @Test
+ public void testCreateSentryRole() throws Exception {
+ TCreateSentryRoleRequest request = new TCreateSentryRoleRequest();
+ TCreateSentryRoleResponse response = new TCreateSentryRoleResponse();
+ invoker.create_sentry_role(request, response);
+ Mockito.verify(handler).create_sentry_role(request, response);
+ }
+
+ @Test
+ public void testDropSentryRole() throws Exception {
+ TDropSentryRoleRequest request = new TDropSentryRoleRequest();
+ TDropSentryRoleResponse response = new TDropSentryRoleResponse();
+ invoker.drop_sentry_role(request, response);
+ Mockito.verify(handler).drop_sentry_role(request, response);
+ }
+
+
+
+ @Test
+ public void testAlterSentryRoleAddGroups() throws Exception {
+ TAlterSentryRoleAddGroupsRequest request = new TAlterSentryRoleAddGroupsRequest();
+ TAlterSentryRoleAddGroupsResponse response = new TAlterSentryRoleAddGroupsResponse();
+ invoker.alter_sentry_role_add_groups(request, response);
+ Mockito.verify(handler).alter_sentry_role_add_groups(request, response);
+ }
+
+ @Test
+ public void testAlterSentryRoleDeleteGroups() throws Exception {
+ TAlterSentryRoleDeleteGroupsRequest request = new TAlterSentryRoleDeleteGroupsRequest();
+ TAlterSentryRoleDeleteGroupsResponse response = new TAlterSentryRoleDeleteGroupsResponse();
+ invoker.alter_sentry_role_delete_groups(request, response);
+ Mockito.verify(handler).alter_sentry_role_delete_groups(request, response);
+ }
+
+ public static class ThrowingNotificationHandler extends NotificationHandler {
+ public ThrowingNotificationHandler(Configuration config) throws Exception {
+ super(config);
+ }
+ @Override
+ public void create_sentry_role(TCreateSentryRoleRequest request,
+ TCreateSentryRoleResponse response) {
+ throw new RuntimeException();
+ }
+ public void drop_sentry_role(TDropSentryRoleRequest request,
+ TDropSentryRoleResponse response) {
+ throw new RuntimeException();
+ }
+ @Override
+ public void alter_sentry_role_add_groups(
+ TAlterSentryRoleAddGroupsRequest request,
+ TAlterSentryRoleAddGroupsResponse response) {
+ throw new RuntimeException();
+ }
+ @Override
+ public void alter_sentry_role_delete_groups(
+ TAlterSentryRoleDeleteGroupsRequest request,
+ TAlterSentryRoleDeleteGroupsResponse response) {
+ throw new RuntimeException();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryPolicyServiceClient.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryPolicyServiceClient.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryPolicyServiceClient.java
new file mode 100644
index 0000000..e845936
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryPolicyServiceClient.java
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sentry.api.service.thrift;
+
+import java.util.Set;
+
+import org.apache.sentry.service.thrift.SentryServiceFactory;
+import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.google.common.collect.Sets;
+
+public class TestSentryPolicyServiceClient extends SentryServiceIntegrationBase {
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ beforeSetup();
+ setupConf();
+ startSentryService();
+ afterSetup();
+ kerberos = false;
+ }
+
+ @Test
+ public void testConnectionWhenReconnect() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ String roleName = "admin_r";
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName);
+ client.createRole(requestorUserName, roleName);
+ client.listAllRoles(requestorUserName);
+ stopSentryService();
+ server = SentryServiceFactory.create(conf);
+ startSentryService();
+ client.listAllRoles(requestorUserName);
+ client.dropRole(requestorUserName, roleName);
+ }
+ });
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryPolicyStoreProcessor.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryPolicyStoreProcessor.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryPolicyStoreProcessor.java
new file mode 100644
index 0000000..efacf19
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryPolicyStoreProcessor.java
@@ -0,0 +1,81 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.service.thrift;
+
+import org.apache.sentry.api.common.ThriftConstants;
+import org.apache.sentry.core.common.exception.SentrySiteConfigurationException;
+import org.junit.Assert;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.sentry.core.common.exception.SentryThriftAPIMismatchException;
+import org.apache.sentry.core.common.utils.PolicyStoreConstants.PolicyStoreServerConfig;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestSentryPolicyStoreProcessor {
+
+ private Configuration conf;
+
+ @Before
+ public void setup() {
+ conf = new Configuration(false);
+ }
+ @Test(expected=SentrySiteConfigurationException.class)
+ public void testConfigNotNotificationHandler() throws Exception {
+ conf.set(PolicyStoreServerConfig.NOTIFICATION_HANDLERS, Object.class.getName());
+ SentryPolicyStoreProcessor.createHandlers(conf);
+ }
+ @Test(expected=SentrySiteConfigurationException.class)
+ public void testConfigCannotCreateNotificationHandler() throws Exception {
+ conf.set(PolicyStoreServerConfig.NOTIFICATION_HANDLERS,
+ ExceptionInConstructorNotificationHandler.class.getName());
+ SentryPolicyStoreProcessor.createHandlers(conf);
+ }
+ @Test(expected=SentrySiteConfigurationException.class)
+ public void testConfigNotAClassNotificationHandler() throws Exception {
+ conf.set(PolicyStoreServerConfig.NOTIFICATION_HANDLERS, "junk");
+ SentryPolicyStoreProcessor.createHandlers(conf);
+ }
+ @Test
+ public void testConfigMultipleNotificationHandlers() throws Exception {
+ conf.set(PolicyStoreServerConfig.NOTIFICATION_HANDLERS,
+ NoopNotificationHandler.class.getName() + "," +
+ NoopNotificationHandler.class.getName() + " " +
+ NoopNotificationHandler.class.getName());
+ Assert.assertEquals(3, SentryPolicyStoreProcessor.createHandlers(conf).size());
+ }
+ public static class ExceptionInConstructorNotificationHandler extends NotificationHandler {
+ public ExceptionInConstructorNotificationHandler(Configuration config) throws Exception {
+ super(config);
+ throw new Exception();
+ }
+ }
+ public static class NoopNotificationHandler extends NotificationHandler {
+ public NoopNotificationHandler(Configuration config) throws Exception {
+ super(config);
+ }
+ }
+ @Test(expected=SentryThriftAPIMismatchException.class)
+ public void testSentryThriftAPIMismatch() throws Exception {
+ SentryPolicyStoreProcessor.validateClientVersion(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT -1);
+ }
+ @Test
+ public void testSentryThriftAPIMatchVersion() throws Exception {
+ SentryPolicyStoreProcessor.validateClientVersion(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT);
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServerForPoolWithoutKerberos.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServerForPoolWithoutKerberos.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServerForPoolWithoutKerberos.java
new file mode 100644
index 0000000..7330204
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServerForPoolWithoutKerberos.java
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless createRequired by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sentry.api.service.thrift;
+
+import org.junit.BeforeClass;
+
+public class TestSentryServerForPoolWithoutKerberos extends TestSentryServerWithoutKerberos {
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ kerberos = false;
+ pooled = true;
+ beforeSetup();
+ setupConf();
+ startSentryService();
+ afterSetup();
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServerLogLevel.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServerLogLevel.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServerLogLevel.java
new file mode 100644
index 0000000..6290fb7
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServerLogLevel.java
@@ -0,0 +1,100 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.service.thrift;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+import org.junit.*;
+
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+public class TestSentryServerLogLevel extends SentryServiceIntegrationBase {
+ private final String CLASS_NAME = "org.eclipse.jetty.server.handler.ContextHandler";
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ webServerEnabled = true;
+ webSecurity = false;
+ SentryServiceIntegrationBase.setup();
+ }
+
+ @Override
+ @Before
+ public void before() throws Exception {
+ }
+
+ @Override
+ @After
+ public void after() {
+ }
+
+ /**
+ * Get the log level for the specified class
+ * @param className: Name of class
+ * @return
+ * Log level of the class
+ */
+ private String getLogLevel(String className) {
+ Logger logInstance = LogManager.getLogger(className);
+ return logInstance.getEffectiveLevel().toString();
+ }
+
+ /**
+ * Send log level and class name via the HTTP interface and verify that it is set at the loogger.
+ * @throws Exception
+ */
+ @Test
+ public void testSetLogLevel() throws Exception {
+ final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/admin/logLevel?log="
+ + CLASS_NAME + "&level=INFO");
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
+ String response = IOUtils.toString(conn.getInputStream());
+ Assert.assertTrue(response.contains("INFO"));
+ Assert.assertEquals("INFO", getLogLevel(CLASS_NAME));
+ }
+
+ /**
+ * Send class name via the HTTP interface and verify that it is get at the loogger.
+ * @throws Exception
+ */
+ @Test
+ public void testGetLogLevel() throws Exception {
+ final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/admin/logLevel?log=" + CLASS_NAME);
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
+ String response = IOUtils.toString(conn.getInputStream());
+ Assert.assertTrue(response.contains("INFO"));
+ Assert.assertEquals("INFO", getLogLevel(CLASS_NAME));
+ }
+
+ /**
+ * Send class name and invalid log level via the HTTP interface and verify that it returns error response.
+ * @throws Exception
+ */
+ @Test
+ public void testInvalidLogLevel() throws Exception {
+ final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/admin/logLevel?log="
+ + CLASS_NAME + "&level=ABCD");
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ Assert.assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, conn.getResponseCode());
+ }
+}
[47/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
deleted file mode 100644
index 0a10883..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
+++ /dev/null
@@ -1,798 +0,0 @@
-/**
- * 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.provider.db.generic.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 TAlterSentryRoleGrantPrivilegeRequest implements org.apache.thrift.TBase<TAlterSentryRoleGrantPrivilegeRequest, TAlterSentryRoleGrantPrivilegeRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleGrantPrivilegeRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleGrantPrivilegeRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
- private static final org.apache.thrift.protocol.TField PRIVILEGE_FIELD_DESC = new org.apache.thrift.protocol.TField("privilege", org.apache.thrift.protocol.TType.STRUCT, (short)5);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleGrantPrivilegeRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleGrantPrivilegeRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private String component; // required
- private TSentryPrivilege privilege; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName"),
- COMPONENT((short)4, "component"),
- PRIVILEGE((short)5, "privilege");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- case 4: // COMPONENT
- return COMPONENT;
- case 5: // PRIVILEGE
- return PRIVILEGE;
- 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.PRIVILEGE, new org.apache.thrift.meta_data.FieldMetaData("privilege", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleGrantPrivilegeRequest.class, metaDataMap);
- }
-
- public TAlterSentryRoleGrantPrivilegeRequest() {
- this.protocol_version = 2;
-
- }
-
- public TAlterSentryRoleGrantPrivilegeRequest(
- int protocol_version,
- String requestorUserName,
- String roleName,
- String component,
- TSentryPrivilege privilege)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- this.component = component;
- this.privilege = privilege;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleGrantPrivilegeRequest(TAlterSentryRoleGrantPrivilegeRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetComponent()) {
- this.component = other.component;
- }
- if (other.isSetPrivilege()) {
- this.privilege = new TSentryPrivilege(other.privilege);
- }
- }
-
- public TAlterSentryRoleGrantPrivilegeRequest deepCopy() {
- return new TAlterSentryRoleGrantPrivilegeRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.component = null;
- this.privilege = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public String getComponent() {
- return this.component;
- }
-
- public void setComponent(String component) {
- this.component = component;
- }
-
- public void unsetComponent() {
- this.component = null;
- }
-
- /** Returns true if field component is set (has been assigned a value) and false otherwise */
- public boolean isSetComponent() {
- return this.component != null;
- }
-
- public void setComponentIsSet(boolean value) {
- if (!value) {
- this.component = null;
- }
- }
-
- public TSentryPrivilege getPrivilege() {
- return this.privilege;
- }
-
- public void setPrivilege(TSentryPrivilege privilege) {
- this.privilege = privilege;
- }
-
- public void unsetPrivilege() {
- this.privilege = null;
- }
-
- /** Returns true if field privilege is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivilege() {
- return this.privilege != null;
- }
-
- public void setPrivilegeIsSet(boolean value) {
- if (!value) {
- this.privilege = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case COMPONENT:
- if (value == null) {
- unsetComponent();
- } else {
- setComponent((String)value);
- }
- break;
-
- case PRIVILEGE:
- if (value == null) {
- unsetPrivilege();
- } else {
- setPrivilege((TSentryPrivilege)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case COMPONENT:
- return getComponent();
-
- case PRIVILEGE:
- return getPrivilege();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case COMPONENT:
- return isSetComponent();
- case PRIVILEGE:
- return isSetPrivilege();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleGrantPrivilegeRequest)
- return this.equals((TAlterSentryRoleGrantPrivilegeRequest)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleGrantPrivilegeRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- boolean this_present_component = true && this.isSetComponent();
- boolean that_present_component = true && that.isSetComponent();
- if (this_present_component || that_present_component) {
- if (!(this_present_component && that_present_component))
- return false;
- if (!this.component.equals(that.component))
- return false;
- }
-
- boolean this_present_privilege = true && this.isSetPrivilege();
- boolean that_present_privilege = true && that.isSetPrivilege();
- if (this_present_privilege || that_present_privilege) {
- if (!(this_present_privilege && that_present_privilege))
- return false;
- if (!this.privilege.equals(that.privilege))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- boolean present_component = true && (isSetComponent());
- list.add(present_component);
- if (present_component)
- list.add(component);
-
- boolean present_privilege = true && (isSetPrivilege());
- list.add(present_privilege);
- if (present_privilege)
- list.add(privilege);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleGrantPrivilegeRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetComponent()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetPrivilege()).compareTo(other.isSetPrivilege());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivilege()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilege, other.privilege);
- 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("TAlterSentryRoleGrantPrivilegeRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("component:");
- if (this.component == null) {
- sb.append("null");
- } else {
- sb.append(this.component);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("privilege:");
- if (this.privilege == null) {
- sb.append("null");
- } else {
- sb.append(this.privilege);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- if (!isSetComponent()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
- }
-
- if (!isSetPrivilege()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilege' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (privilege != null) {
- privilege.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 TAlterSentryRoleGrantPrivilegeRequestStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleGrantPrivilegeRequestStandardScheme getScheme() {
- return new TAlterSentryRoleGrantPrivilegeRequestStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleGrantPrivilegeRequestStandardScheme extends StandardScheme<TAlterSentryRoleGrantPrivilegeRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleGrantPrivilegeRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // COMPONENT
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // PRIVILEGE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.privilege = new TSentryPrivilege();
- struct.privilege.read(iprot);
- struct.setPrivilegeIsSet(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, TAlterSentryRoleGrantPrivilegeRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.component != null) {
- oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
- oprot.writeString(struct.component);
- oprot.writeFieldEnd();
- }
- if (struct.privilege != null) {
- oprot.writeFieldBegin(PRIVILEGE_FIELD_DESC);
- struct.privilege.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleGrantPrivilegeRequestTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleGrantPrivilegeRequestTupleScheme getScheme() {
- return new TAlterSentryRoleGrantPrivilegeRequestTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleGrantPrivilegeRequestTupleScheme extends TupleScheme<TAlterSentryRoleGrantPrivilegeRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- oprot.writeString(struct.component);
- struct.privilege.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- struct.privilege = new TSentryPrivilege();
- struct.privilege.read(iprot);
- struct.setPrivilegeIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleGrantPrivilegeResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleGrantPrivilegeResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleGrantPrivilegeResponse.java
deleted file mode 100644
index c380803..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleGrantPrivilegeResponse.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/**
- * 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.provider.db.generic.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 TAlterSentryRoleGrantPrivilegeResponse implements org.apache.thrift.TBase<TAlterSentryRoleGrantPrivilegeResponse, TAlterSentryRoleGrantPrivilegeResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleGrantPrivilegeResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleGrantPrivilegeResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleGrantPrivilegeResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleGrantPrivilegeResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleGrantPrivilegeResponse.class, metaDataMap);
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse() {
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleGrantPrivilegeResponse(TAlterSentryRoleGrantPrivilegeResponse other) {
- if (other.isSetStatus()) {
- this.status = other.status;
- }
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse deepCopy() {
- return new TAlterSentryRoleGrantPrivilegeResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleGrantPrivilegeResponse)
- return this.equals((TAlterSentryRoleGrantPrivilegeResponse)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleGrantPrivilegeResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleGrantPrivilegeResponse 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;
- }
- }
- 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("TAlterSentryRoleGrantPrivilegeResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // check for sub-struct validity
- }
-
- 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 TAlterSentryRoleGrantPrivilegeResponseStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleGrantPrivilegeResponseStandardScheme getScheme() {
- return new TAlterSentryRoleGrantPrivilegeResponseStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleGrantPrivilegeResponseStandardScheme extends StandardScheme<TAlterSentryRoleGrantPrivilegeResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleGrantPrivilegeResponse 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;
- 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, TAlterSentryRoleGrantPrivilegeResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleGrantPrivilegeResponseTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleGrantPrivilegeResponseTupleScheme getScheme() {
- return new TAlterSentryRoleGrantPrivilegeResponseTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleGrantPrivilegeResponseTupleScheme extends TupleScheme<TAlterSentryRoleGrantPrivilegeResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeResponse 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);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
deleted file mode 100644
index c051b09..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
+++ /dev/null
@@ -1,798 +0,0 @@
-/**
- * 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.provider.db.generic.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 TAlterSentryRoleRevokePrivilegeRequest implements org.apache.thrift.TBase<TAlterSentryRoleRevokePrivilegeRequest, TAlterSentryRoleRevokePrivilegeRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleRevokePrivilegeRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleRevokePrivilegeRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
- private static final org.apache.thrift.protocol.TField PRIVILEGE_FIELD_DESC = new org.apache.thrift.protocol.TField("privilege", org.apache.thrift.protocol.TType.STRUCT, (short)5);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleRevokePrivilegeRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleRevokePrivilegeRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private String component; // required
- private TSentryPrivilege privilege; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName"),
- COMPONENT((short)4, "component"),
- PRIVILEGE((short)5, "privilege");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- case 4: // COMPONENT
- return COMPONENT;
- case 5: // PRIVILEGE
- return PRIVILEGE;
- 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.PRIVILEGE, new org.apache.thrift.meta_data.FieldMetaData("privilege", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleRevokePrivilegeRequest.class, metaDataMap);
- }
-
- public TAlterSentryRoleRevokePrivilegeRequest() {
- this.protocol_version = 2;
-
- }
-
- public TAlterSentryRoleRevokePrivilegeRequest(
- int protocol_version,
- String requestorUserName,
- String roleName,
- String component,
- TSentryPrivilege privilege)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- this.component = component;
- this.privilege = privilege;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleRevokePrivilegeRequest(TAlterSentryRoleRevokePrivilegeRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetComponent()) {
- this.component = other.component;
- }
- if (other.isSetPrivilege()) {
- this.privilege = new TSentryPrivilege(other.privilege);
- }
- }
-
- public TAlterSentryRoleRevokePrivilegeRequest deepCopy() {
- return new TAlterSentryRoleRevokePrivilegeRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.component = null;
- this.privilege = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public String getComponent() {
- return this.component;
- }
-
- public void setComponent(String component) {
- this.component = component;
- }
-
- public void unsetComponent() {
- this.component = null;
- }
-
- /** Returns true if field component is set (has been assigned a value) and false otherwise */
- public boolean isSetComponent() {
- return this.component != null;
- }
-
- public void setComponentIsSet(boolean value) {
- if (!value) {
- this.component = null;
- }
- }
-
- public TSentryPrivilege getPrivilege() {
- return this.privilege;
- }
-
- public void setPrivilege(TSentryPrivilege privilege) {
- this.privilege = privilege;
- }
-
- public void unsetPrivilege() {
- this.privilege = null;
- }
-
- /** Returns true if field privilege is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivilege() {
- return this.privilege != null;
- }
-
- public void setPrivilegeIsSet(boolean value) {
- if (!value) {
- this.privilege = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case COMPONENT:
- if (value == null) {
- unsetComponent();
- } else {
- setComponent((String)value);
- }
- break;
-
- case PRIVILEGE:
- if (value == null) {
- unsetPrivilege();
- } else {
- setPrivilege((TSentryPrivilege)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case COMPONENT:
- return getComponent();
-
- case PRIVILEGE:
- return getPrivilege();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case COMPONENT:
- return isSetComponent();
- case PRIVILEGE:
- return isSetPrivilege();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleRevokePrivilegeRequest)
- return this.equals((TAlterSentryRoleRevokePrivilegeRequest)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleRevokePrivilegeRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- boolean this_present_component = true && this.isSetComponent();
- boolean that_present_component = true && that.isSetComponent();
- if (this_present_component || that_present_component) {
- if (!(this_present_component && that_present_component))
- return false;
- if (!this.component.equals(that.component))
- return false;
- }
-
- boolean this_present_privilege = true && this.isSetPrivilege();
- boolean that_present_privilege = true && that.isSetPrivilege();
- if (this_present_privilege || that_present_privilege) {
- if (!(this_present_privilege && that_present_privilege))
- return false;
- if (!this.privilege.equals(that.privilege))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- boolean present_component = true && (isSetComponent());
- list.add(present_component);
- if (present_component)
- list.add(component);
-
- boolean present_privilege = true && (isSetPrivilege());
- list.add(present_privilege);
- if (present_privilege)
- list.add(privilege);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleRevokePrivilegeRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetComponent()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetPrivilege()).compareTo(other.isSetPrivilege());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivilege()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilege, other.privilege);
- 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("TAlterSentryRoleRevokePrivilegeRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("component:");
- if (this.component == null) {
- sb.append("null");
- } else {
- sb.append(this.component);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("privilege:");
- if (this.privilege == null) {
- sb.append("null");
- } else {
- sb.append(this.privilege);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- if (!isSetComponent()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
- }
-
- if (!isSetPrivilege()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilege' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (privilege != null) {
- privilege.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 TAlterSentryRoleRevokePrivilegeRequestStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleRevokePrivilegeRequestStandardScheme getScheme() {
- return new TAlterSentryRoleRevokePrivilegeRequestStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleRevokePrivilegeRequestStandardScheme extends StandardScheme<TAlterSentryRoleRevokePrivilegeRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleRevokePrivilegeRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // COMPONENT
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // PRIVILEGE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.privilege = new TSentryPrivilege();
- struct.privilege.read(iprot);
- struct.setPrivilegeIsSet(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, TAlterSentryRoleRevokePrivilegeRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.component != null) {
- oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
- oprot.writeString(struct.component);
- oprot.writeFieldEnd();
- }
- if (struct.privilege != null) {
- oprot.writeFieldBegin(PRIVILEGE_FIELD_DESC);
- struct.privilege.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleRevokePrivilegeRequestTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleRevokePrivilegeRequestTupleScheme getScheme() {
- return new TAlterSentryRoleRevokePrivilegeRequestTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleRevokePrivilegeRequestTupleScheme extends TupleScheme<TAlterSentryRoleRevokePrivilegeRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- oprot.writeString(struct.component);
- struct.privilege.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- struct.privilege = new TSentryPrivilege();
- struct.privilege.read(iprot);
- struct.setPrivilegeIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleRevokePrivilegeResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleRevokePrivilegeResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleRevokePrivilegeResponse.java
deleted file mode 100644
index a232696..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAlterSentryRoleRevokePrivilegeResponse.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/**
- * 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.provider.db.generic.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 TAlterSentryRoleRevokePrivilegeResponse implements org.apache.thrift.TBase<TAlterSentryRoleRevokePrivilegeResponse, TAlterSentryRoleRevokePrivilegeResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleRevokePrivilegeResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleRevokePrivilegeResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleRevokePrivilegeResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleRevokePrivilegeResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleRevokePrivilegeResponse.class, metaDataMap);
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse() {
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleRevokePrivilegeResponse(TAlterSentryRoleRevokePrivilegeResponse other) {
- if (other.isSetStatus()) {
- this.status = other.status;
- }
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse deepCopy() {
- return new TAlterSentryRoleRevokePrivilegeResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleRevokePrivilegeResponse)
- return this.equals((TAlterSentryRoleRevokePrivilegeResponse)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleRevokePrivilegeResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAlterSentryRoleRevokePrivilegeResponse 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;
- }
- }
- 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("TAlterSentryRoleRevokePrivilegeResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // check for sub-struct validity
- }
-
- 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 TAlterSentryRoleRevokePrivilegeResponseStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleRevokePrivilegeResponseStandardScheme getScheme() {
- return new TAlterSentryRoleRevokePrivilegeResponseStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleRevokePrivilegeResponseStandardScheme extends StandardScheme<TAlterSentryRoleRevokePrivilegeResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleRevokePrivilegeResponse 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;
- 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, TAlterSentryRoleRevokePrivilegeResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleRevokePrivilegeResponseTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleRevokePrivilegeResponseTupleScheme getScheme() {
- return new TAlterSentryRoleRevokePrivilegeResponseTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleRevokePrivilegeResponseTupleScheme extends TupleScheme<TAlterSentryRoleRevokePrivilegeResponse> {
-
- @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 read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeResponse 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);
- }
- }
-
-}
-
[49/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericPolicyService.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericPolicyService.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericPolicyService.java
deleted file mode 100644
index bc8d7e3..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericPolicyService.java
+++ /dev/null
@@ -1,10416 +0,0 @@
-/**
- * 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.provider.db.generic.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 SentryGenericPolicyService {
-
- public interface Iface {
-
- public TCreateSentryRoleResponse create_sentry_role(TCreateSentryRoleRequest request) throws org.apache.thrift.TException;
-
- public TDropSentryRoleResponse drop_sentry_role(TDropSentryRoleRequest request) throws org.apache.thrift.TException;
-
- public TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request) throws org.apache.thrift.TException;
-
- public TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request) throws org.apache.thrift.TException;
-
- public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request) throws org.apache.thrift.TException;
-
- public TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request) throws org.apache.thrift.TException;
-
- public TListSentryRolesResponse list_sentry_roles_by_group(TListSentryRolesRequest request) throws org.apache.thrift.TException;
-
- public TListSentryPrivilegesResponse list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException;
-
- public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException;
-
- public TListSentryPrivilegesByAuthResponse list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request) throws org.apache.thrift.TException;
-
- public TDropPrivilegesResponse drop_sentry_privilege(TDropPrivilegesRequest request) throws org.apache.thrift.TException;
-
- public TRenamePrivilegesResponse rename_sentry_privilege(TRenamePrivilegesRequest request) throws org.apache.thrift.TException;
-
- }
-
- public interface AsyncIface {
-
- public void create_sentry_role(TCreateSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void drop_sentry_role(TDropSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void list_sentry_roles_by_group(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void list_sentry_privileges_by_role(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void drop_sentry_privilege(TDropPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- public void rename_sentry_privilege(TRenamePrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
- }
-
- public static class Client extends org.apache.thrift.TServiceClient implements Iface {
- public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
- public Factory() {}
- public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
- return new Client(prot);
- }
- public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
- return new Client(iprot, oprot);
- }
- }
-
- public Client(org.apache.thrift.protocol.TProtocol prot)
- {
- super(prot, prot);
- }
-
- public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
- super(iprot, oprot);
- }
-
- public TCreateSentryRoleResponse create_sentry_role(TCreateSentryRoleRequest request) throws org.apache.thrift.TException
- {
- send_create_sentry_role(request);
- return recv_create_sentry_role();
- }
-
- public void send_create_sentry_role(TCreateSentryRoleRequest request) throws org.apache.thrift.TException
- {
- create_sentry_role_args args = new create_sentry_role_args();
- args.setRequest(request);
- sendBase("create_sentry_role", args);
- }
-
- public TCreateSentryRoleResponse recv_create_sentry_role() throws org.apache.thrift.TException
- {
- create_sentry_role_result result = new create_sentry_role_result();
- receiveBase(result, "create_sentry_role");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "create_sentry_role failed: unknown result");
- }
-
- public TDropSentryRoleResponse drop_sentry_role(TDropSentryRoleRequest request) throws org.apache.thrift.TException
- {
- send_drop_sentry_role(request);
- return recv_drop_sentry_role();
- }
-
- public void send_drop_sentry_role(TDropSentryRoleRequest request) throws org.apache.thrift.TException
- {
- drop_sentry_role_args args = new drop_sentry_role_args();
- args.setRequest(request);
- sendBase("drop_sentry_role", args);
- }
-
- public TDropSentryRoleResponse recv_drop_sentry_role() throws org.apache.thrift.TException
- {
- drop_sentry_role_result result = new drop_sentry_role_result();
- receiveBase(result, "drop_sentry_role");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "drop_sentry_role failed: unknown result");
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request) throws org.apache.thrift.TException
- {
- send_alter_sentry_role_grant_privilege(request);
- return recv_alter_sentry_role_grant_privilege();
- }
-
- public void send_alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request) throws org.apache.thrift.TException
- {
- alter_sentry_role_grant_privilege_args args = new alter_sentry_role_grant_privilege_args();
- args.setRequest(request);
- sendBase("alter_sentry_role_grant_privilege", args);
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse recv_alter_sentry_role_grant_privilege() throws org.apache.thrift.TException
- {
- alter_sentry_role_grant_privilege_result result = new alter_sentry_role_grant_privilege_result();
- receiveBase(result, "alter_sentry_role_grant_privilege");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_grant_privilege failed: unknown result");
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request) throws org.apache.thrift.TException
- {
- send_alter_sentry_role_revoke_privilege(request);
- return recv_alter_sentry_role_revoke_privilege();
- }
-
- public void send_alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request) throws org.apache.thrift.TException
- {
- alter_sentry_role_revoke_privilege_args args = new alter_sentry_role_revoke_privilege_args();
- args.setRequest(request);
- sendBase("alter_sentry_role_revoke_privilege", args);
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse recv_alter_sentry_role_revoke_privilege() throws org.apache.thrift.TException
- {
- alter_sentry_role_revoke_privilege_result result = new alter_sentry_role_revoke_privilege_result();
- receiveBase(result, "alter_sentry_role_revoke_privilege");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_revoke_privilege failed: unknown result");
- }
-
- public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request) throws org.apache.thrift.TException
- {
- send_alter_sentry_role_add_groups(request);
- return recv_alter_sentry_role_add_groups();
- }
-
- public void send_alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request) throws org.apache.thrift.TException
- {
- alter_sentry_role_add_groups_args args = new alter_sentry_role_add_groups_args();
- args.setRequest(request);
- sendBase("alter_sentry_role_add_groups", args);
- }
-
- public TAlterSentryRoleAddGroupsResponse recv_alter_sentry_role_add_groups() throws org.apache.thrift.TException
- {
- alter_sentry_role_add_groups_result result = new alter_sentry_role_add_groups_result();
- receiveBase(result, "alter_sentry_role_add_groups");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_add_groups failed: unknown result");
- }
-
- public TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request) throws org.apache.thrift.TException
- {
- send_alter_sentry_role_delete_groups(request);
- return recv_alter_sentry_role_delete_groups();
- }
-
- public void send_alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request) throws org.apache.thrift.TException
- {
- alter_sentry_role_delete_groups_args args = new alter_sentry_role_delete_groups_args();
- args.setRequest(request);
- sendBase("alter_sentry_role_delete_groups", args);
- }
-
- public TAlterSentryRoleDeleteGroupsResponse recv_alter_sentry_role_delete_groups() throws org.apache.thrift.TException
- {
- alter_sentry_role_delete_groups_result result = new alter_sentry_role_delete_groups_result();
- receiveBase(result, "alter_sentry_role_delete_groups");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_delete_groups failed: unknown result");
- }
-
- public TListSentryRolesResponse list_sentry_roles_by_group(TListSentryRolesRequest request) throws org.apache.thrift.TException
- {
- send_list_sentry_roles_by_group(request);
- return recv_list_sentry_roles_by_group();
- }
-
- public void send_list_sentry_roles_by_group(TListSentryRolesRequest request) throws org.apache.thrift.TException
- {
- list_sentry_roles_by_group_args args = new list_sentry_roles_by_group_args();
- args.setRequest(request);
- sendBase("list_sentry_roles_by_group", args);
- }
-
- public TListSentryRolesResponse recv_list_sentry_roles_by_group() throws org.apache.thrift.TException
- {
- list_sentry_roles_by_group_result result = new list_sentry_roles_by_group_result();
- receiveBase(result, "list_sentry_roles_by_group");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_roles_by_group failed: unknown result");
- }
-
- public TListSentryPrivilegesResponse list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException
- {
- send_list_sentry_privileges_by_role(request);
- return recv_list_sentry_privileges_by_role();
- }
-
- public void send_list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException
- {
- list_sentry_privileges_by_role_args args = new list_sentry_privileges_by_role_args();
- args.setRequest(request);
- sendBase("list_sentry_privileges_by_role", args);
- }
-
- public TListSentryPrivilegesResponse recv_list_sentry_privileges_by_role() throws org.apache.thrift.TException
- {
- list_sentry_privileges_by_role_result result = new list_sentry_privileges_by_role_result();
- receiveBase(result, "list_sentry_privileges_by_role");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_privileges_by_role failed: unknown result");
- }
-
- public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException
- {
- send_list_sentry_privileges_for_provider(request);
- return recv_list_sentry_privileges_for_provider();
- }
-
- public void send_list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException
- {
- list_sentry_privileges_for_provider_args args = new list_sentry_privileges_for_provider_args();
- args.setRequest(request);
- sendBase("list_sentry_privileges_for_provider", args);
- }
-
- public TListSentryPrivilegesForProviderResponse recv_list_sentry_privileges_for_provider() throws org.apache.thrift.TException
- {
- list_sentry_privileges_for_provider_result result = new list_sentry_privileges_for_provider_result();
- receiveBase(result, "list_sentry_privileges_for_provider");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_privileges_for_provider failed: unknown result");
- }
-
- public TListSentryPrivilegesByAuthResponse list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request) throws org.apache.thrift.TException
- {
- send_list_sentry_privileges_by_authorizable(request);
- return recv_list_sentry_privileges_by_authorizable();
- }
-
- public void send_list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request) throws org.apache.thrift.TException
- {
- list_sentry_privileges_by_authorizable_args args = new list_sentry_privileges_by_authorizable_args();
- args.setRequest(request);
- sendBase("list_sentry_privileges_by_authorizable", args);
- }
-
- public TListSentryPrivilegesByAuthResponse recv_list_sentry_privileges_by_authorizable() throws org.apache.thrift.TException
- {
- list_sentry_privileges_by_authorizable_result result = new list_sentry_privileges_by_authorizable_result();
- receiveBase(result, "list_sentry_privileges_by_authorizable");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_privileges_by_authorizable failed: unknown result");
- }
-
- public TDropPrivilegesResponse drop_sentry_privilege(TDropPrivilegesRequest request) throws org.apache.thrift.TException
- {
- send_drop_sentry_privilege(request);
- return recv_drop_sentry_privilege();
- }
-
- public void send_drop_sentry_privilege(TDropPrivilegesRequest request) throws org.apache.thrift.TException
- {
- drop_sentry_privilege_args args = new drop_sentry_privilege_args();
- args.setRequest(request);
- sendBase("drop_sentry_privilege", args);
- }
-
- public TDropPrivilegesResponse recv_drop_sentry_privilege() throws org.apache.thrift.TException
- {
- drop_sentry_privilege_result result = new drop_sentry_privilege_result();
- receiveBase(result, "drop_sentry_privilege");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "drop_sentry_privilege failed: unknown result");
- }
-
- public TRenamePrivilegesResponse rename_sentry_privilege(TRenamePrivilegesRequest request) throws org.apache.thrift.TException
- {
- send_rename_sentry_privilege(request);
- return recv_rename_sentry_privilege();
- }
-
- public void send_rename_sentry_privilege(TRenamePrivilegesRequest request) throws org.apache.thrift.TException
- {
- rename_sentry_privilege_args args = new rename_sentry_privilege_args();
- args.setRequest(request);
- sendBase("rename_sentry_privilege", args);
- }
-
- public TRenamePrivilegesResponse recv_rename_sentry_privilege() throws org.apache.thrift.TException
- {
- rename_sentry_privilege_result result = new rename_sentry_privilege_result();
- receiveBase(result, "rename_sentry_privilege");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "rename_sentry_privilege 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> {
- private org.apache.thrift.async.TAsyncClientManager clientManager;
- private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
- public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
- this.clientManager = clientManager;
- this.protocolFactory = protocolFactory;
- }
- public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
- return new AsyncClient(protocolFactory, clientManager, transport);
- }
- }
-
- public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
- super(protocolFactory, clientManager, transport);
- }
-
- public void create_sentry_role(TCreateSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- create_sentry_role_call method_call = new create_sentry_role_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class create_sentry_role_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TCreateSentryRoleRequest request;
- public create_sentry_role_call(TCreateSentryRoleRequest 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("create_sentry_role", org.apache.thrift.protocol.TMessageType.CALL, 0));
- create_sentry_role_args args = new create_sentry_role_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TCreateSentryRoleResponse 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_create_sentry_role();
- }
- }
-
- public void drop_sentry_role(TDropSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- drop_sentry_role_call method_call = new drop_sentry_role_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class drop_sentry_role_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TDropSentryRoleRequest request;
- public drop_sentry_role_call(TDropSentryRoleRequest 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("drop_sentry_role", org.apache.thrift.protocol.TMessageType.CALL, 0));
- drop_sentry_role_args args = new drop_sentry_role_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TDropSentryRoleResponse 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_drop_sentry_role();
- }
- }
-
- public void alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- alter_sentry_role_grant_privilege_call method_call = new alter_sentry_role_grant_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class alter_sentry_role_grant_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TAlterSentryRoleGrantPrivilegeRequest request;
- public alter_sentry_role_grant_privilege_call(TAlterSentryRoleGrantPrivilegeRequest 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("alter_sentry_role_grant_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
- alter_sentry_role_grant_privilege_args args = new alter_sentry_role_grant_privilege_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse 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_alter_sentry_role_grant_privilege();
- }
- }
-
- public void alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- alter_sentry_role_revoke_privilege_call method_call = new alter_sentry_role_revoke_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class alter_sentry_role_revoke_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TAlterSentryRoleRevokePrivilegeRequest request;
- public alter_sentry_role_revoke_privilege_call(TAlterSentryRoleRevokePrivilegeRequest 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("alter_sentry_role_revoke_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
- alter_sentry_role_revoke_privilege_args args = new alter_sentry_role_revoke_privilege_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse 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_alter_sentry_role_revoke_privilege();
- }
- }
-
- public void alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- alter_sentry_role_add_groups_call method_call = new alter_sentry_role_add_groups_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class alter_sentry_role_add_groups_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TAlterSentryRoleAddGroupsRequest request;
- public alter_sentry_role_add_groups_call(TAlterSentryRoleAddGroupsRequest 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("alter_sentry_role_add_groups", org.apache.thrift.protocol.TMessageType.CALL, 0));
- alter_sentry_role_add_groups_args args = new alter_sentry_role_add_groups_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TAlterSentryRoleAddGroupsResponse 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_alter_sentry_role_add_groups();
- }
- }
-
- public void alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- alter_sentry_role_delete_groups_call method_call = new alter_sentry_role_delete_groups_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class alter_sentry_role_delete_groups_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TAlterSentryRoleDeleteGroupsRequest request;
- public alter_sentry_role_delete_groups_call(TAlterSentryRoleDeleteGroupsRequest 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("alter_sentry_role_delete_groups", org.apache.thrift.protocol.TMessageType.CALL, 0));
- alter_sentry_role_delete_groups_args args = new alter_sentry_role_delete_groups_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TAlterSentryRoleDeleteGroupsResponse 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_alter_sentry_role_delete_groups();
- }
- }
-
- public void list_sentry_roles_by_group(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- list_sentry_roles_by_group_call method_call = new list_sentry_roles_by_group_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class list_sentry_roles_by_group_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TListSentryRolesRequest request;
- public list_sentry_roles_by_group_call(TListSentryRolesRequest 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("list_sentry_roles_by_group", org.apache.thrift.protocol.TMessageType.CALL, 0));
- list_sentry_roles_by_group_args args = new list_sentry_roles_by_group_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TListSentryRolesResponse 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_list_sentry_roles_by_group();
- }
- }
-
- public void list_sentry_privileges_by_role(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- list_sentry_privileges_by_role_call method_call = new list_sentry_privileges_by_role_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class list_sentry_privileges_by_role_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TListSentryPrivilegesRequest request;
- public list_sentry_privileges_by_role_call(TListSentryPrivilegesRequest 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("list_sentry_privileges_by_role", org.apache.thrift.protocol.TMessageType.CALL, 0));
- list_sentry_privileges_by_role_args args = new list_sentry_privileges_by_role_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TListSentryPrivilegesResponse 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_list_sentry_privileges_by_role();
- }
- }
-
- public void list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- list_sentry_privileges_for_provider_call method_call = new list_sentry_privileges_for_provider_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class list_sentry_privileges_for_provider_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TListSentryPrivilegesForProviderRequest request;
- public list_sentry_privileges_for_provider_call(TListSentryPrivilegesForProviderRequest 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("list_sentry_privileges_for_provider", org.apache.thrift.protocol.TMessageType.CALL, 0));
- list_sentry_privileges_for_provider_args args = new list_sentry_privileges_for_provider_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TListSentryPrivilegesForProviderResponse 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_list_sentry_privileges_for_provider();
- }
- }
-
- public void list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- list_sentry_privileges_by_authorizable_call method_call = new list_sentry_privileges_by_authorizable_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class list_sentry_privileges_by_authorizable_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TListSentryPrivilegesByAuthRequest request;
- public list_sentry_privileges_by_authorizable_call(TListSentryPrivilegesByAuthRequest 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("list_sentry_privileges_by_authorizable", org.apache.thrift.protocol.TMessageType.CALL, 0));
- list_sentry_privileges_by_authorizable_args args = new list_sentry_privileges_by_authorizable_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TListSentryPrivilegesByAuthResponse 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_list_sentry_privileges_by_authorizable();
- }
- }
-
- public void drop_sentry_privilege(TDropPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- drop_sentry_privilege_call method_call = new drop_sentry_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class drop_sentry_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TDropPrivilegesRequest request;
- public drop_sentry_privilege_call(TDropPrivilegesRequest 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("drop_sentry_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
- drop_sentry_privilege_args args = new drop_sentry_privilege_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TDropPrivilegesResponse 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_drop_sentry_privilege();
- }
- }
-
- public void rename_sentry_privilege(TRenamePrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
- checkReady();
- rename_sentry_privilege_call method_call = new rename_sentry_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class rename_sentry_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TRenamePrivilegesRequest request;
- public rename_sentry_privilege_call(TRenamePrivilegesRequest 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("rename_sentry_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
- rename_sentry_privilege_args args = new rename_sentry_privilege_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TRenamePrivilegesResponse 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_rename_sentry_privilege();
- }
- }
-
- }
-
- public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
- private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
- public Processor(I iface) {
- super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
- }
-
- protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
- super(iface, getProcessMap(processMap));
- }
-
- private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
- processMap.put("create_sentry_role", new create_sentry_role());
- processMap.put("drop_sentry_role", new drop_sentry_role());
- processMap.put("alter_sentry_role_grant_privilege", new alter_sentry_role_grant_privilege());
- processMap.put("alter_sentry_role_revoke_privilege", new alter_sentry_role_revoke_privilege());
- processMap.put("alter_sentry_role_add_groups", new alter_sentry_role_add_groups());
- processMap.put("alter_sentry_role_delete_groups", new alter_sentry_role_delete_groups());
- processMap.put("list_sentry_roles_by_group", new list_sentry_roles_by_group());
- processMap.put("list_sentry_privileges_by_role", new list_sentry_privileges_by_role());
- processMap.put("list_sentry_privileges_for_provider", new list_sentry_privileges_for_provider());
- processMap.put("list_sentry_privileges_by_authorizable", new list_sentry_privileges_by_authorizable());
- processMap.put("drop_sentry_privilege", new drop_sentry_privilege());
- processMap.put("rename_sentry_privilege", new rename_sentry_privilege());
- return processMap;
- }
-
- public static class create_sentry_role<I extends Iface> extends org.apache.thrift.ProcessFunction<I, create_sentry_role_args> {
- public create_sentry_role() {
- super("create_sentry_role");
- }
-
- public create_sentry_role_args getEmptyArgsInstance() {
- return new create_sentry_role_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public create_sentry_role_result getResult(I iface, create_sentry_role_args args) throws org.apache.thrift.TException {
- create_sentry_role_result result = new create_sentry_role_result();
- result.success = iface.create_sentry_role(args.request);
- return result;
- }
- }
-
- public static class drop_sentry_role<I extends Iface> extends org.apache.thrift.ProcessFunction<I, drop_sentry_role_args> {
- public drop_sentry_role() {
- super("drop_sentry_role");
- }
-
- public drop_sentry_role_args getEmptyArgsInstance() {
- return new drop_sentry_role_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public drop_sentry_role_result getResult(I iface, drop_sentry_role_args args) throws org.apache.thrift.TException {
- drop_sentry_role_result result = new drop_sentry_role_result();
- result.success = iface.drop_sentry_role(args.request);
- return result;
- }
- }
-
- public static class alter_sentry_role_grant_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_grant_privilege_args> {
- public alter_sentry_role_grant_privilege() {
- super("alter_sentry_role_grant_privilege");
- }
-
- public alter_sentry_role_grant_privilege_args getEmptyArgsInstance() {
- return new alter_sentry_role_grant_privilege_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public alter_sentry_role_grant_privilege_result getResult(I iface, alter_sentry_role_grant_privilege_args args) throws org.apache.thrift.TException {
- alter_sentry_role_grant_privilege_result result = new alter_sentry_role_grant_privilege_result();
- result.success = iface.alter_sentry_role_grant_privilege(args.request);
- return result;
- }
- }
-
- public static class alter_sentry_role_revoke_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_revoke_privilege_args> {
- public alter_sentry_role_revoke_privilege() {
- super("alter_sentry_role_revoke_privilege");
- }
-
- public alter_sentry_role_revoke_privilege_args getEmptyArgsInstance() {
- return new alter_sentry_role_revoke_privilege_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public alter_sentry_role_revoke_privilege_result getResult(I iface, alter_sentry_role_revoke_privilege_args args) throws org.apache.thrift.TException {
- alter_sentry_role_revoke_privilege_result result = new alter_sentry_role_revoke_privilege_result();
- result.success = iface.alter_sentry_role_revoke_privilege(args.request);
- return result;
- }
- }
-
- public static class alter_sentry_role_add_groups<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_add_groups_args> {
- public alter_sentry_role_add_groups() {
- super("alter_sentry_role_add_groups");
- }
-
- public alter_sentry_role_add_groups_args getEmptyArgsInstance() {
- return new alter_sentry_role_add_groups_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public alter_sentry_role_add_groups_result getResult(I iface, alter_sentry_role_add_groups_args args) throws org.apache.thrift.TException {
- alter_sentry_role_add_groups_result result = new alter_sentry_role_add_groups_result();
- result.success = iface.alter_sentry_role_add_groups(args.request);
- return result;
- }
- }
-
- public static class alter_sentry_role_delete_groups<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_delete_groups_args> {
- public alter_sentry_role_delete_groups() {
- super("alter_sentry_role_delete_groups");
- }
-
- public alter_sentry_role_delete_groups_args getEmptyArgsInstance() {
- return new alter_sentry_role_delete_groups_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public alter_sentry_role_delete_groups_result getResult(I iface, alter_sentry_role_delete_groups_args args) throws org.apache.thrift.TException {
- alter_sentry_role_delete_groups_result result = new alter_sentry_role_delete_groups_result();
- result.success = iface.alter_sentry_role_delete_groups(args.request);
- return result;
- }
- }
-
- public static class list_sentry_roles_by_group<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_roles_by_group_args> {
- public list_sentry_roles_by_group() {
- super("list_sentry_roles_by_group");
- }
-
- public list_sentry_roles_by_group_args getEmptyArgsInstance() {
- return new list_sentry_roles_by_group_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public list_sentry_roles_by_group_result getResult(I iface, list_sentry_roles_by_group_args args) throws org.apache.thrift.TException {
- list_sentry_roles_by_group_result result = new list_sentry_roles_by_group_result();
- result.success = iface.list_sentry_roles_by_group(args.request);
- return result;
- }
- }
-
- public static class list_sentry_privileges_by_role<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_privileges_by_role_args> {
- public list_sentry_privileges_by_role() {
- super("list_sentry_privileges_by_role");
- }
-
- public list_sentry_privileges_by_role_args getEmptyArgsInstance() {
- return new list_sentry_privileges_by_role_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public list_sentry_privileges_by_role_result getResult(I iface, list_sentry_privileges_by_role_args args) throws org.apache.thrift.TException {
- list_sentry_privileges_by_role_result result = new list_sentry_privileges_by_role_result();
- result.success = iface.list_sentry_privileges_by_role(args.request);
- return result;
- }
- }
-
- public static class list_sentry_privileges_for_provider<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_privileges_for_provider_args> {
- public list_sentry_privileges_for_provider() {
- super("list_sentry_privileges_for_provider");
- }
-
- public list_sentry_privileges_for_provider_args getEmptyArgsInstance() {
- return new list_sentry_privileges_for_provider_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public list_sentry_privileges_for_provider_result getResult(I iface, list_sentry_privileges_for_provider_args args) throws org.apache.thrift.TException {
- list_sentry_privileges_for_provider_result result = new list_sentry_privileges_for_provider_result();
- result.success = iface.list_sentry_privileges_for_provider(args.request);
- return result;
- }
- }
-
- public static class list_sentry_privileges_by_authorizable<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_privileges_by_authorizable_args> {
- public list_sentry_privileges_by_authorizable() {
- super("list_sentry_privileges_by_authorizable");
- }
-
- public list_sentry_privileges_by_authorizable_args getEmptyArgsInstance() {
- return new list_sentry_privileges_by_authorizable_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public list_sentry_privileges_by_authorizable_result getResult(I iface, list_sentry_privileges_by_authorizable_args args) throws org.apache.thrift.TException {
- list_sentry_privileges_by_authorizable_result result = new list_sentry_privileges_by_authorizable_result();
- result.success = iface.list_sentry_privileges_by_authorizable(args.request);
- return result;
- }
- }
-
- public static class drop_sentry_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, drop_sentry_privilege_args> {
- public drop_sentry_privilege() {
- super("drop_sentry_privilege");
- }
-
- public drop_sentry_privilege_args getEmptyArgsInstance() {
- return new drop_sentry_privilege_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public drop_sentry_privilege_result getResult(I iface, drop_sentry_privilege_args args) throws org.apache.thrift.TException {
- drop_sentry_privilege_result result = new drop_sentry_privilege_result();
- result.success = iface.drop_sentry_privilege(args.request);
- return result;
- }
- }
-
- public static class rename_sentry_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, rename_sentry_privilege_args> {
- public rename_sentry_privilege() {
- super("rename_sentry_privilege");
- }
-
- public rename_sentry_privilege_args getEmptyArgsInstance() {
- return new rename_sentry_privilege_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public rename_sentry_privilege_result getResult(I iface, rename_sentry_privilege_args args) throws org.apache.thrift.TException {
- rename_sentry_privilege_result result = new rename_sentry_privilege_result();
- result.success = iface.rename_sentry_privilege(args.request);
- return result;
- }
- }
-
- }
-
- public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
- private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
- public AsyncProcessor(I iface) {
- super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
- }
-
- protected AsyncProcessor(I iface, Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
- super(iface, getProcessMap(processMap));
- }
-
- private static <I extends AsyncIface> Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase,?>> getProcessMap(Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
- processMap.put("create_sentry_role", new create_sentry_role());
- processMap.put("drop_sentry_role", new drop_sentry_role());
- processMap.put("alter_sentry_role_grant_privilege", new alter_sentry_role_grant_privilege());
- processMap.put("alter_sentry_role_revoke_privilege", new alter_sentry_role_revoke_privilege());
- processMap.put("alter_sentry_role_add_groups", new alter_sentry_role_add_groups());
- processMap.put("alter_sentry_role_delete_groups", new alter_sentry_role_delete_groups());
- processMap.put("list_sentry_roles_by_group", new list_sentry_roles_by_group());
- processMap.put("list_sentry_privileges_by_role", new list_sentry_privileges_by_role());
- processMap.put("list_sentry_privileges_for_provider", new list_sentry_privileges_for_provider());
- processMap.put("list_sentry_privileges_by_authorizable", new list_sentry_privileges_by_authorizable());
- processMap.put("drop_sentry_privilege", new drop_sentry_privilege());
- processMap.put("rename_sentry_privilege", new rename_sentry_privilege());
- return processMap;
- }
-
- public static class create_sentry_role<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, create_sentry_role_args, TCreateSentryRoleResponse> {
- public create_sentry_role() {
- super("create_sentry_role");
- }
-
- public create_sentry_role_args getEmptyArgsInstance() {
- return new create_sentry_role_args();
- }
-
- public AsyncMethodCallback<TCreateSentryRoleResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback<TCreateSentryRoleResponse>() {
- public void onComplete(TCreateSentryRoleResponse o) {
- create_sentry_role_result result = new create_sentry_role_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;
- create_sentry_role_result result = new create_sentry_role_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, create_sentry_role_args args, org.apache.thrift.async.AsyncMethodCallback<TCreateSentryRoleResponse> resultHandler) throws TException {
- iface.create_sentry_role(args.request,resultHandler);
- }
- }
-
- public static class drop_sentry_role<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, drop_sentry_role_args, TDropSentryRoleResponse> {
- public drop_sentry_role() {
- super("drop_sentry_role");
- }
-
- public drop_sentry_role_args getEmptyArgsInstance() {
- return new drop_sentry_role_args();
- }
-
- public AsyncMethodCallback<TDropSentryRoleResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback<TDropSentryRoleResponse>() {
- public void onComplete(TDropSentryRoleResponse o) {
- drop_sentry_role_result result = new drop_sentry_role_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;
- drop_sentry_role_result result = new drop_sentry_role_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, drop_sentry_role_args args, org.apache.thrift.async.AsyncMethodCallback<TDropSentryRoleResponse> resultHandler) throws TException {
- iface.drop_sentry_role(args.request,resultHandler);
- }
- }
-
- public static class alter_sentry_role_grant_privilege<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, alter_sentry_role_grant_privilege_args, TAlterSentryRoleGrantPrivilegeResponse> {
- public alter_sentry_role_grant_privilege() {
- super("alter_sentry_role_grant_privilege");
- }
-
- public alter_sentry_role_grant_privilege_args getEmptyArgsInstance() {
- return new alter_sentry_role_grant_privilege_args();
- }
-
- public AsyncMethodCallback<TAlterSentryRoleGrantPrivilegeResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback<TAlterSentryRoleGrantPrivilegeResponse>() {
- public void onComplete(TAlterSentryRoleGrantPrivilegeResponse o) {
- alter_sentry_role_grant_privilege_result result = new alter_sentry_role_grant_privilege_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;
- alter_sentry_role_grant_privilege_result result = new alter_sentry_role_grant_privilege_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, alter_sentry_role_grant_privilege_args args, org.apache.thrift.async.AsyncMethodCallback<TAlterSentryRoleGrantPrivilegeResponse> resultHandler) throws TException {
- iface.alter_sentry_role_grant_privilege(args.request,resultHandler);
- }
- }
-
- public static class alter_sentry_role_revoke_privilege<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, alter_sentry_role_revoke_privilege_args, TAlterSentryRoleRevokePrivilegeResponse> {
- public alter_sentry_role_revoke_privilege() {
- super("alter_sentry_role_revoke_privilege");
- }
-
- public alter_sentry_role_revoke_privilege_args getEmptyArgsInstance() {
- return new alter_sentry_role_revoke_privilege_args();
- }
-
- public AsyncMethodCallback<TAlterSentryRoleRevokePrivilegeResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback<TAlterSentryRoleRevokePrivilegeResponse>() {
- public void onComplete(TAlterSentryRoleRevokePrivilegeResponse o) {
- alter_sentry_role_revoke_privilege_result result = new alter_sentry_role_revoke_privilege_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;
- alter_sentry_role_revoke_privilege_result result = new alter_sentry_role_revoke_privilege_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, alter_sentry_role_revoke_privilege_args args, org.apache.thrift.async.AsyncMethodCallback<TAlterSentryRoleRevokePrivilegeResponse> resultHandler) throws TException {
- iface.alter_sentry_role_revoke_privilege(args.request,resultHandler);
- }
- }
-
- public static class alter_sentry_role_add_groups<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, alter_sentry_role_add_groups_args, TAlterSentryRoleAddGroupsResponse> {
- public alter_sentry_role_add_groups() {
- super("alter_sentry_role_add_groups");
- }
-
- public alter_sentry_role_add_groups_args getEmptyArgsInstance() {
- return new alter_sentry_role_add_groups_args();
- }
-
- public AsyncMethodCallback<TAlterSentryRoleAddGroupsResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback<TAlterSentryRoleAddGroupsResponse>() {
- public void onComplete(TAlterSentryRoleAddGroupsResponse o) {
- alter_sentry_role_add_groups_result result = new alter_sentry_role_add_groups_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;
- alter_sentry_role_add_groups_result result = new alter_sentry_role_add_groups_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, alter_sentry_role_add_groups_args args, org.apache.thrift.async.AsyncMethodCallback<TAlterSentryRoleAddGroupsResponse> resultHandler) throws TException {
- iface.alter_sentry_role_add_groups(args.request,resultHandler);
- }
- }
-
- public static class alter_sentry_role_delete_groups<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, alter_sentry_role_delete_groups_args, TAlterSentryRoleDeleteGroupsResponse> {
- public alter_sentry_role_delete_groups() {
- super("alter_sentry_role_delete_groups");
- }
-
- public alter_sentry_role_delete_groups_args getEmptyArgsInstance() {
- return new alter_sentry_role_delete_groups_args();
- }
-
- public AsyncMethodCallback<TAlterSentryRoleDeleteGroupsResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback<TAlterSentryRoleDeleteGroupsResponse>() {
- public void onComplete(TAlterSentryRoleDeleteGroupsResponse o) {
- alter_sentry_role_delete_groups_result result = new alter_sentry_role_delete_groups_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;
- alter_sentry_role_delete_groups_result result = new alter_sentry_role_delete_groups_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, alter_sentry_role_delete_groups_args args, org.apache.thrift.async.AsyncMethodCallback<TAlterSentryRoleDeleteGroupsResponse> resultHandler) throws TException {
- iface.alter_sentry_role_delete_groups(args.request,resultHandler);
- }
- }
-
- public static class list_sentry_roles_by_group<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, list_sentry_roles_by_group_args, TListSentryRolesResponse> {
- public list_sentry_roles_by_group() {
- super("list_sentry_roles_by_group");
- }
-
- public list_sentry_roles_by_group_args getEmptyArgsInstance() {
- return new list_sentry_roles_by_group_args();
- }
-
- public AsyncMethodCallback<TListSentryRolesResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback<TListSentryRolesResponse>() {
- public void onComplete(TListSentryRolesResponse o) {
- list_sentry_roles_by_group_result result = new list_sentry_roles_by_group_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;
- list_sentry_roles_by_group_result result = new list_sentry_roles_by_group_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, list_sentry_roles_by_group_args args, org.apache.thrift.async.AsyncMethodCallback<TListSentryRolesResponse> resultHandler) throws TException {
- iface.list_sentry_roles_by_group(args.request,resultHandler);
- }
- }
-
- public static class list_sentry_privileges_by_role<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, list_sentry_privileges_by_role_args, TListSentryPrivilegesResponse> {
- public list_sentry_privileges_by_role() {
- super("list_sentry_privileges_by_role");
- }
-
- public list_sentry_privileges_by_role_args getEmptyArgsInstance() {
- return new list_sentry_privileges_by_role_args();
- }
-
- public AsyncMethodCallback<TListSentryPrivilegesResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback<TListSentryPrivilegesResponse>() {
- public void onComplete(TListSentryPrivilegesResponse o) {
- list_sentry_privileges_by_role_result result = new list_sentry_privileges_by_role_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;
- list_sentry_privileges_by_role_result result = new list_sentry_privileges_by_role_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, list_sentry_privileges_by_role_args args, org.apache.thrift.async.AsyncMethodCallback<TListSentryPrivilegesResponse> resultHandler) throws TException {
- iface.list_sentry_privileges_by_role(args.request,resultHandler);
- }
- }
-
- public static class list_sentry_privileges_for_provider<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, list_sentry_privileges_for_provider_args, TListSentryPrivilegesForProviderResponse> {
- public list_sentry_privileges_for_provider() {
- super("list_sentry_privileges_for_provider");
- }
-
- public list_sentry_privileges_for_provider_args getEmptyArgsInstance() {
- return new list_sentry_privileges_for_provider_args();
- }
-
- public AsyncMethodCallback<TListSentryPrivilegesForProviderResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback<TListSentryPrivilegesForProviderResponse>() {
- public void onComplete(TListSentryPrivilegesForProviderResponse o) {
- list_sentry_privileges_for_provider_result result = new list_sentry_privileges_for_provider_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;
- list_sentry_privileges_for_provider_result result = new list_sentry_privileges_for_provider_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, list_sentry_privileges_for_provider_args args, org.apache.thrift.async.AsyncMethodCallback<TListSentryPrivilegesForProviderResponse> resultHandler) throws TException {
- iface.list_sentry_privileges_for_provider(args.request,resultHandler);
- }
- }
-
- public static class list_sentry_privileges_by_authorizable<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, list_sentry_privileges_by_authorizable_args, TListSentryPrivilegesByAuthResponse> {
- public list_sentry_privileges_by_authorizable() {
- super("list_sentry_privileges_by_authorizable");
- }
-
- public list_sentry_privileges_by_authorizable_args getEmptyArgsInstance() {
- return new list_sentry_privileges_by_authorizable_args();
- }
-
- public AsyncMethodCallback<TListSentryPrivilegesByAuthResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback<TListSentryPrivilegesByAuthResponse>() {
- public void onComplete(TListSentryPrivilegesByAuthResponse o) {
- list_sentry_privileges_by_authorizable_result result = new list_sentry_privileges_by_authorizable_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;
- list_sentry_privileges_by_authorizable_result result = new list_sentry_privileges_by_authorizable_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, list_sentry_privileges_by_authorizable_args args, org.apache.thrift.async.AsyncMethodCallback<TListSentryPrivilegesByAuthResponse> resultHandler) throws TException {
- iface.list_sentry_privileges_by_authorizable(args.request,resultHandler);
- }
- }
-
- public static class drop_sentry_privilege<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, drop_sentry_privilege_args, TDropPrivilegesResponse> {
- public drop_sentry_privilege() {
- super("drop_sentry_privilege");
- }
-
- public drop_sentry_privilege_args getEmptyArgsInstance() {
- return new drop_sentry_privilege_args();
- }
-
- public AsyncMethodCallback<TDropPrivilegesResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback<TDropPrivilegesResponse>() {
- public void onComplete(TDropPrivilegesResponse o) {
- drop_sentry_privilege_result result = new drop_sentry_privilege_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;
- drop_sentry_privilege_result result = new drop_sentry_privilege_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, drop_sentry_privilege_args args, org.apache.thrift.async.AsyncMethodCallback<TDropPrivilegesResponse> resultHandler) throws TException {
- iface.drop_sentry_privilege(args.request,resultHandler);
- }
- }
-
- public static class rename_sentry_privilege<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, rename_sentry_privilege_args, TRenamePrivilegesResponse> {
- public rename_sentry_privilege() {
- super("rename_sentry_privilege");
- }
-
- public rename_sentry_privilege_args getEmptyArgsInstance() {
- return new rename_sentry_privilege_args();
- }
-
- public AsyncMethodCallback<TRenamePrivilegesResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback<TRenamePrivilegesResponse>() {
- public void onComplete(TRenamePrivilegesResponse o) {
- rename_sentry_privilege_result result = new rename_sentry_privilege_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;
- rename_sentry_privilege_result result = new rename_sentry_privilege_result();
- {
- msgType = org
<TRUNCATED>
[14/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryVersion.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryVersion.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryVersion.java
index 2b7dcde..21aa7f9 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryVersion.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryVersion.java
@@ -24,8 +24,8 @@ import java.io.File;
import org.apache.hadoop.conf.Configuration;
import org.apache.sentry.core.common.exception.SentryNoSuchObjectException;
-import org.apache.sentry.service.thrift.SentryServiceUtil;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
+import org.apache.sentry.api.common.SentryServiceUtil;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/SentryMiniKdcTestcase.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/SentryMiniKdcTestcase.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/SentryMiniKdcTestcase.java
deleted file mode 100644
index 1114194..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/SentryMiniKdcTestcase.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import java.io.File;
-import java.util.Properties;
-
-import org.apache.hadoop.minikdc.MiniKdc;
-
-public class SentryMiniKdcTestcase {
-
- private static File workDir;
- private static Properties conf;
- private static MiniKdc kdc;
-
- public static void startMiniKdc(Properties confOverlay) throws Exception {
- createTestDir();
- createMiniKdcConf(confOverlay);
- kdc = new MiniKdc(conf, workDir);
- kdc.start();
- }
-
- private static void createMiniKdcConf(Properties confOverlay) {
- conf = MiniKdc.createConf();
- for ( Object property : confOverlay.keySet()) {
- conf.put(property, confOverlay.get(property));
- }
- }
-
- private static void createTestDir() {
- workDir = new File(System.getProperty("test.dir", "target"));
- }
-
- public static void stopMiniKdc() {
- if (kdc != null) {
- kdc.stop();
- }
- }
-
- public static MiniKdc getKdc() {
- return kdc;
- }
-
- public static File getWorkDir() {
- return workDir;
- }
-
- public Properties getConf() {
- return conf;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestAuthorizingDDLAuditLogWithKerberos.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestAuthorizingDDLAuditLogWithKerberos.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestAuthorizingDDLAuditLogWithKerberos.java
deleted file mode 100644
index 426b2f7..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestAuthorizingDDLAuditLogWithKerberos.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.sentry.provider.db.log.appender.AuditLoggerTestAppender;
-import org.apache.sentry.provider.db.log.util.CommandUtil;
-import org.apache.sentry.provider.db.log.util.Constants;
-import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.codehaus.jettison.json.JSONObject;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.google.common.collect.Sets;
-
-public class TestAuthorizingDDLAuditLogWithKerberos extends SentryServiceIntegrationBase {
-
- @BeforeClass
- public static void setupLog4j() throws Exception {
- Logger logger = Logger.getLogger("sentry.hive.authorization.ddl.logger");
- AuditLoggerTestAppender testAppender = new AuditLoggerTestAppender();
- logger.addAppender(testAppender);
- logger.setLevel(Level.INFO);
- }
-
- @Test
- public void testBasic() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- String roleName = "testRole";
- String errorRoleName = "errorRole";
- String serverName = "server1";
- String groupName = "testGroup";
- String dbName = "dbTest";
- String tableName = "tableTest";
- Map<String, String> fieldValueMap = new HashMap<String, String>();
-
- // for successful audit log
- client.createRole(requestorUserName, roleName);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_CREATE_ROLE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "CREATE ROLE " + roleName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
- // for ip address, there is another logic to test the result
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
-
- client.grantRoleToGroup(requestorUserName, groupName, roleName);
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_ADD_ROLE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT ROLE " + roleName
- + " TO GROUP " + groupName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
-
- client.grantDatabasePrivilege(requestorUserName, roleName, serverName, dbName, "ALL");
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_GRANT_PRIVILEGE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT ALL ON DATABASE " + dbName
- + " TO ROLE " + roleName);
- fieldValueMap.put(Constants.LOG_FIELD_DATABASE_NAME, dbName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
-
- client.grantTablePrivilege(requestorUserName, roleName, serverName, dbName, tableName,
- "SELECT", true);
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_GRANT_PRIVILEGE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT SELECT ON TABLE " + tableName
- + " TO ROLE " + roleName + " WITH GRANT OPTION");
- fieldValueMap.put(Constants.LOG_FIELD_TABLE_NAME, tableName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
-
- // for error audit log
- try {
- client.createRole(requestorUserName, roleName);
- fail("Exception should have been thrown");
- } catch (Exception e) {
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_CREATE_ROLE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "CREATE ROLE " + roleName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- }
- try {
- client.grantRoleToGroup(requestorUserName, groupName, errorRoleName);
- fail("Exception should have been thrown");
- } catch (Exception e) {
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_ADD_ROLE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT ROLE " + errorRoleName
- + " TO GROUP " + groupName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- }
- try {
- client
- .grantDatabasePrivilege(requestorUserName, errorRoleName, serverName, dbName, "ALL");
- fail("Exception should have been thrown");
- } catch (Exception e) {
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_GRANT_PRIVILEGE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT ALL ON DATABASE " + dbName
- + " TO ROLE " + errorRoleName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- }
- try {
- client.grantDatabasePrivilege(requestorUserName, errorRoleName, serverName, dbName,
- "INSERT");
- fail("Exception should have been thrown");
- } catch (Exception e) {
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_GRANT_PRIVILEGE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT INSERT ON DATABASE "
- + dbName + " TO ROLE " + errorRoleName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- }
- try {
- client.grantDatabasePrivilege(requestorUserName, errorRoleName, serverName, dbName,
- "SELECT");
- fail("Exception should have been thrown");
- } catch (Exception e) {
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_GRANT_PRIVILEGE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT SELECT ON DATABASE "
- + dbName + " TO ROLE " + errorRoleName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- }
- try {
- client.grantTablePrivilege(requestorUserName, errorRoleName, serverName, dbName,
- tableName, "SELECT");
- fail("Exception should have been thrown");
- } catch (Exception e) {
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_GRANT_PRIVILEGE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT SELECT ON TABLE "
- + tableName + " TO ROLE " + errorRoleName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- }
-
- client.revokeTablePrivilege(requestorUserName, roleName, serverName, dbName, tableName,
- "SELECT");
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_REVOKE_PRIVILEGE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "REVOKE SELECT ON TABLE " + tableName
- + " FROM ROLE " + roleName);
- fieldValueMap.put(Constants.LOG_FIELD_TABLE_NAME, tableName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
-
- client.revokeDatabasePrivilege(requestorUserName, roleName, serverName, dbName, "ALL");
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_REVOKE_PRIVILEGE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "REVOKE ALL ON DATABASE " + dbName
- + " FROM ROLE " + roleName);
- fieldValueMap.put(Constants.LOG_FIELD_DATABASE_NAME, dbName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
-
- client.revokeRoleFromGroup(requestorUserName, groupName, roleName);
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_DELETE_ROLE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "REVOKE ROLE " + roleName
- + " FROM GROUP " + groupName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
-
- client.dropRole(requestorUserName, roleName);
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_DROP_ROLE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "DROP ROLE " + roleName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
-
- // for error audit log
- try {
- client.revokeTablePrivilege(requestorUserName, errorRoleName, serverName, dbName,
- tableName, "SELECT");
- fail("Exception should have been thrown");
- } catch (Exception e) {
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_REVOKE_PRIVILEGE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "REVOKE SELECT ON TABLE "
- + tableName + " FROM ROLE " + errorRoleName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- }
-
- try {
- client.revokeDatabasePrivilege(requestorUserName, errorRoleName, serverName, dbName,
- "ALL");
- fail("Exception should have been thrown");
- } catch (Exception e) {
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_REVOKE_PRIVILEGE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "REVOKE ALL ON DATABASE " + dbName
- + " FROM ROLE " + errorRoleName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- }
-
- try {
- client.revokeRoleFromGroup(requestorUserName, groupName, errorRoleName);
- fail("Exception should have been thrown");
- } catch (Exception e) {
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_DELETE_ROLE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "REVOKE ROLE " + errorRoleName
- + " FROM GROUP " + groupName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- }
-
- try {
- client.dropRole(requestorUserName, errorRoleName);
- fail("Exception should have been thrown");
- } catch (Exception e) {
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_DROP_ROLE);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "DROP ROLE " + errorRoleName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- }
- }
- });
- }
-
- private void assertAuditLog(Map<String, String> fieldValueMap) throws Exception {
- assertThat(AuditLoggerTestAppender.getLastLogLevel(), is(Level.INFO));
- JSONObject jsonObject = new JSONObject(AuditLoggerTestAppender.getLastLogEvent());
- if (fieldValueMap != null) {
- for (Map.Entry<String, String> entry : fieldValueMap.entrySet()) {
- String entryKey = entry.getKey();
- if (Constants.LOG_FIELD_IP_ADDRESS.equals(entryKey)) {
- assertTrue(CommandUtil.assertIPInAuditLog(jsonObject.get(entryKey).toString()));
- } else {
- assertTrue(entry.getValue().equalsIgnoreCase(jsonObject.get(entryKey).toString()));
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestConnectionWithTicketTimeout.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestConnectionWithTicketTimeout.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestConnectionWithTicketTimeout.java
deleted file mode 100644
index 36fa4b5..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestConnectionWithTicketTimeout.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.hadoop.minikdc.MiniKdc;
-import org.apache.sentry.service.thrift.ServiceConstants;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-@Ignore("SENTRY-515: Not part of automated unit testing, as it takes too long. Fails until we move to a hadoop 2.6.1. See HADOOP-10786")
-public class TestConnectionWithTicketTimeout extends
- org.apache.sentry.service.thrift.SentryServiceIntegrationBase {
-
- @BeforeClass
- public static void setup() throws Exception {
- kerberos = true;
- beforeSetup();
- setupConf();
- startSentryService();
- afterSetup();
- }
-
- public static void beforeSetup() throws Exception {
- kdcConfOverlay.setProperty(MiniKdc.MAX_TICKET_LIFETIME, "360001");
- //Only UGI based client connections renew their TGT, this is not a problem in the real world
- // as this is not configurable and always true
- conf.set(ServiceConstants.ServerConfig.SECURITY_USE_UGI_TRANSPORT, "true");
- }
-
- /***
- * Test is run only when sentry.hive.test.ticket.timeout is set to "true"
- * @throws Exception
- */
- @Test
- public void testConnectionAfterTicketTimeout() throws Exception {
- Thread.sleep(400000);
- connectToSentryService();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestNotificationHandlerInvoker.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestNotificationHandlerInvoker.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestNotificationHandlerInvoker.java
deleted file mode 100644
index 54215ff..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestNotificationHandlerInvoker.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.hadoop.conf.Configuration;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import com.google.common.collect.Lists;
-
-public class TestNotificationHandlerInvoker {
-
- private Configuration conf;
- private NotificationHandler handler;
- private NotificationHandlerInvoker invoker;
-
- @Before
- public void setup() throws Exception {
- conf = new Configuration(false);
- handler = Mockito.spy(new NotificationHandler(conf) {});
- invoker = new NotificationHandlerInvoker(conf,
- Lists.newArrayList(new ThrowingNotificationHandler(conf), handler));
- }
-
- @Test
- public void testCreateSentryRole() throws Exception {
- TCreateSentryRoleRequest request = new TCreateSentryRoleRequest();
- TCreateSentryRoleResponse response = new TCreateSentryRoleResponse();
- invoker.create_sentry_role(request, response);
- Mockito.verify(handler).create_sentry_role(request, response);
- }
-
- @Test
- public void testDropSentryRole() throws Exception {
- TDropSentryRoleRequest request = new TDropSentryRoleRequest();
- TDropSentryRoleResponse response = new TDropSentryRoleResponse();
- invoker.drop_sentry_role(request, response);
- Mockito.verify(handler).drop_sentry_role(request, response);
- }
-
-
-
- @Test
- public void testAlterSentryRoleAddGroups() throws Exception {
- TAlterSentryRoleAddGroupsRequest request = new TAlterSentryRoleAddGroupsRequest();
- TAlterSentryRoleAddGroupsResponse response = new TAlterSentryRoleAddGroupsResponse();
- invoker.alter_sentry_role_add_groups(request, response);
- Mockito.verify(handler).alter_sentry_role_add_groups(request, response);
- }
-
- @Test
- public void testAlterSentryRoleDeleteGroups() throws Exception {
- TAlterSentryRoleDeleteGroupsRequest request = new TAlterSentryRoleDeleteGroupsRequest();
- TAlterSentryRoleDeleteGroupsResponse response = new TAlterSentryRoleDeleteGroupsResponse();
- invoker.alter_sentry_role_delete_groups(request, response);
- Mockito.verify(handler).alter_sentry_role_delete_groups(request, response);
- }
-
- public static class ThrowingNotificationHandler extends NotificationHandler {
- public ThrowingNotificationHandler(Configuration config) throws Exception {
- super(config);
- }
- @Override
- public void create_sentry_role(TCreateSentryRoleRequest request,
- TCreateSentryRoleResponse response) {
- throw new RuntimeException();
- }
- public void drop_sentry_role(TDropSentryRoleRequest request,
- TDropSentryRoleResponse response) {
- throw new RuntimeException();
- }
- @Override
- public void alter_sentry_role_add_groups(
- TAlterSentryRoleAddGroupsRequest request,
- TAlterSentryRoleAddGroupsResponse response) {
- throw new RuntimeException();
- }
- @Override
- public void alter_sentry_role_delete_groups(
- TAlterSentryRoleDeleteGroupsRequest request,
- TAlterSentryRoleDeleteGroupsResponse response) {
- throw new RuntimeException();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryPolicyServiceClient.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryPolicyServiceClient.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryPolicyServiceClient.java
deleted file mode 100644
index 6b1e5df..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryPolicyServiceClient.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import java.util.Set;
-
-import org.apache.sentry.service.thrift.SentryServiceFactory;
-import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.google.common.collect.Sets;
-
-public class TestSentryPolicyServiceClient extends SentryServiceIntegrationBase {
-
- @BeforeClass
- public static void setup() throws Exception {
- beforeSetup();
- setupConf();
- startSentryService();
- afterSetup();
- kerberos = false;
- }
-
- @Test
- public void testConnectionWhenReconnect() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- String roleName = "admin_r";
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName);
- client.createRole(requestorUserName, roleName);
- client.listAllRoles(requestorUserName);
- stopSentryService();
- server = SentryServiceFactory.create(conf);
- startSentryService();
- client.listAllRoles(requestorUserName);
- client.dropRole(requestorUserName, roleName);
- }
- });
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryPolicyStoreProcessor.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryPolicyStoreProcessor.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryPolicyStoreProcessor.java
deleted file mode 100644
index 58e2618..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryPolicyStoreProcessor.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.sentry.core.common.exception.SentrySiteConfigurationException;
-import org.junit.Assert;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.sentry.core.common.exception.SentryThriftAPIMismatchException;
-import org.apache.sentry.core.common.utils.PolicyStoreConstants.PolicyStoreServerConfig;
-import org.apache.sentry.service.thrift.ServiceConstants;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestSentryPolicyStoreProcessor {
-
- private Configuration conf;
-
- @Before
- public void setup() {
- conf = new Configuration(false);
- }
- @Test(expected=SentrySiteConfigurationException.class)
- public void testConfigNotNotificationHandler() throws Exception {
- conf.set(PolicyStoreServerConfig.NOTIFICATION_HANDLERS, Object.class.getName());
- SentryPolicyStoreProcessor.createHandlers(conf);
- }
- @Test(expected=SentrySiteConfigurationException.class)
- public void testConfigCannotCreateNotificationHandler() throws Exception {
- conf.set(PolicyStoreServerConfig.NOTIFICATION_HANDLERS,
- ExceptionInConstructorNotificationHandler.class.getName());
- SentryPolicyStoreProcessor.createHandlers(conf);
- }
- @Test(expected=SentrySiteConfigurationException.class)
- public void testConfigNotAClassNotificationHandler() throws Exception {
- conf.set(PolicyStoreServerConfig.NOTIFICATION_HANDLERS, "junk");
- SentryPolicyStoreProcessor.createHandlers(conf);
- }
- @Test
- public void testConfigMultipleNotificationHandlers() throws Exception {
- conf.set(PolicyStoreServerConfig.NOTIFICATION_HANDLERS,
- NoopNotificationHandler.class.getName() + "," +
- NoopNotificationHandler.class.getName() + " " +
- NoopNotificationHandler.class.getName());
- Assert.assertEquals(3, SentryPolicyStoreProcessor.createHandlers(conf).size());
- }
- public static class ExceptionInConstructorNotificationHandler extends NotificationHandler {
- public ExceptionInConstructorNotificationHandler(Configuration config) throws Exception {
- super(config);
- throw new Exception();
- }
- }
- public static class NoopNotificationHandler extends NotificationHandler {
- public NoopNotificationHandler(Configuration config) throws Exception {
- super(config);
- }
- }
- @Test(expected=SentryThriftAPIMismatchException.class)
- public void testSentryThriftAPIMismatch() throws Exception {
- SentryPolicyStoreProcessor.validateClientVersion(ServiceConstants.ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT -1);
- }
- @Test
- public void testSentryThriftAPIMatchVersion() throws Exception {
- SentryPolicyStoreProcessor.validateClientVersion(ServiceConstants.ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT);
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerForPoolWithoutKerberos.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerForPoolWithoutKerberos.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerForPoolWithoutKerberos.java
deleted file mode 100644
index ac8cd71..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerForPoolWithoutKerberos.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless createRequired by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.junit.BeforeClass;
-
-public class TestSentryServerForPoolWithoutKerberos extends TestSentryServerWithoutKerberos {
-
- @BeforeClass
- public static void setup() throws Exception {
- kerberos = false;
- pooled = true;
- beforeSetup();
- setupConf();
- startSentryService();
- afterSetup();
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerLogLevel.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerLogLevel.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerLogLevel.java
deleted file mode 100644
index 9e4e0a9..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerLogLevel.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
-import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.junit.*;
-
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-public class TestSentryServerLogLevel extends SentryServiceIntegrationBase {
- private final String CLASS_NAME = "org.eclipse.jetty.server.handler.ContextHandler";
-
- @BeforeClass
- public static void setup() throws Exception {
- webServerEnabled = true;
- webSecurity = false;
- SentryServiceIntegrationBase.setup();
- }
-
- @Override
- @Before
- public void before() throws Exception {
- }
-
- @Override
- @After
- public void after() {
- }
-
- /**
- * Get the log level for the specified class
- * @param className: Name of class
- * @return
- * Log level of the class
- */
- private String getLogLevel(String className) {
- Logger logInstance = LogManager.getLogger(className);
- return logInstance.getEffectiveLevel().toString();
- }
-
- /**
- * Send log level and class name via the HTTP interface and verify that it is set at the loogger.
- * @throws Exception
- */
- @Test
- public void testSetLogLevel() throws Exception {
- final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/admin/logLevel?log="
- + CLASS_NAME + "&level=INFO");
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
- String response = IOUtils.toString(conn.getInputStream());
- Assert.assertTrue(response.contains("INFO"));
- Assert.assertEquals("INFO", getLogLevel(CLASS_NAME));
- }
-
- /**
- * Send class name via the HTTP interface and verify that it is get at the loogger.
- * @throws Exception
- */
- @Test
- public void testGetLogLevel() throws Exception {
- final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/admin/logLevel?log=" + CLASS_NAME);
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
- String response = IOUtils.toString(conn.getInputStream());
- Assert.assertTrue(response.contains("INFO"));
- Assert.assertEquals("INFO", getLogLevel(CLASS_NAME));
- }
-
- /**
- * Send class name and invalid log level via the HTTP interface and verify that it returns error response.
- * @throws Exception
- */
- @Test
- public void testInvalidLogLevel() throws Exception {
- final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/admin/logLevel?log="
- + CLASS_NAME + "&level=ABCD");
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- Assert.assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, conn.getResponseCode());
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerPubSub.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerPubSub.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerPubSub.java
deleted file mode 100644
index 451d7a1..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerPubSub.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.sentry.core.common.utils.PubSub;
-import org.apache.sentry.core.common.utils.PubSub.Topic;
-import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-
-import org.junit.*;
-
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-public class TestSentryServerPubSub extends SentryServiceIntegrationBase {
-
- private static final Topic[] topics = Topic.values();
- private static final String[] messages = { "message1", "message2", "message3", "" };
-
- private static volatile String REQUEST_URL;
-
- private final TestSubscriber testSubscriber = new TestSubscriber();
-
- private static final class TestSubscriber implements PubSub.Subscriber {
- private volatile Topic topic;
- private volatile String message;
- private volatile int count;
- @Override
- public void onMessage(Topic topic, String message) {
- this.topic = topic;
- this.message = message;
- this.count++;
- }
- }
-
- @BeforeClass
- public static void setup() throws Exception {
- webServerEnabled = true;
- webSecurity = false;
- SentryServiceIntegrationBase.setup();
- REQUEST_URL= "http://" + SERVER_HOST + ":" + webServerPort + "/admin/publishMessage?topic=%s&message=%s";
- }
-
- @Override
- @Before
- public void before() throws Exception {
-
- // Subscribe to all defined topics.
- // After each successfull HTTP-GET, testSubscriber.onMessage()
- // will be called and "topic" and "message" fields will be
- // set according to HTTP-GET parameters.
- testSubscriber.count = 0;
- for (Topic topic : topics) {
- PubSub.getInstance().subscribe(topic, testSubscriber);
- }
- Assert.assertEquals("Unexpected number of registered topics", topics.length, PubSub.getInstance().getTopics().size());
- }
-
- @Override
- @After
- public void after() {
- // unsubscribe
- for (Topic topic : topics) {
- PubSub.getInstance().unsubscribe(topic, testSubscriber);
- }
- testSubscriber.count = 0;
- Assert.assertTrue("Topics should have been removed after unsubscribe()", PubSub.getInstance().getTopics().isEmpty());
- }
-
- /**
- * Successfully publish notifications
- * @throws Exception
- */
- @Test
- public void testPubSub() throws Exception {
- int count = 0;
- for (Topic topic : topics) {
- for (String message : messages) {
- URL url = new URL(String.format(REQUEST_URL, topic.getName(), message));
- HttpURLConnection conn = null;
- try {
- conn = (HttpURLConnection) url.openConnection();
- Assert.assertEquals("Unexpected response code", HttpURLConnection.HTTP_OK, conn.getResponseCode());
- } finally {
- safeClose(conn);
- }
- Assert.assertEquals("Unexpected topic", topic, testSubscriber.topic);
- if (message.isEmpty()) {
- Assert.assertEquals("Unexpected message", null, testSubscriber.message);
- } else {
- Assert.assertEquals("Unexpected message", message, testSubscriber.message);
- }
- Assert.assertEquals("Unexpected number of PubSub.onMessage() callbacks", ++count, testSubscriber.count);
- }
- }
- }
-
- /**
- * Submit empty topic. It's ok, generates form page.
- * @throws Exception
- */
- @Test
- public void testPubSubEmptyTopic() throws Exception {
- URL url = new URL(String.format(REQUEST_URL, "", "message"));
- HttpURLConnection conn = null;
- try {
- conn = (HttpURLConnection) url.openConnection();
- Assert.assertEquals("Unexpected response code", HttpURLConnection.HTTP_OK, conn.getResponseCode());
- } finally {
- safeClose(conn);
- }
- Assert.assertEquals("Unexpected number of PubSub.onMessage() callbacks", 0, testSubscriber.count);
- }
-
- /**
- * Submit invalid topic
- * @throws Exception
- */
- @Test
- public void testPubSubInvalidTopic() throws Exception {
- String[] invalid_topics = { "invalid_topic_1", "invalid_topic_2", "invalid_topic_3" };
- for (String topic : invalid_topics) {
- URL url = new URL(String.format(REQUEST_URL, topic, "message"));
- HttpURLConnection conn = null;
- try {
- conn = (HttpURLConnection) url.openConnection();
- Assert.assertEquals("Unexpected response code", HttpURLConnection.HTTP_BAD_REQUEST, conn.getResponseCode());
- } finally {
- safeClose(conn);
- }
- Assert.assertEquals("Unexpected number of PubSub.onMessage() callbacks", 0, testSubscriber.count);
- }
- }
-
- /**
- * Submit topic that has no subscribers.
- * @throws Exception
- */
- @Test
- public void testPubSubNonSubscribedTopic() throws Exception {
- // At this point all valid Topic values have been subscribed to
- // in before() method.
- // Unsubscribe from one topic and then try publishing to it.
- PubSub.getInstance().unsubscribe(Topic.HDFS_SYNC_HMS, testSubscriber);
- Assert.assertEquals("Unexpected number of registered topics", topics.length-1, PubSub.getInstance().getTopics().size());
-
- URL url = new URL(String.format(REQUEST_URL, Topic.HDFS_SYNC_HMS.getName(), "message"));
- HttpURLConnection conn = null;
- try {
- conn = (HttpURLConnection) url.openConnection();
- Assert.assertEquals("Unexpected response code", HttpURLConnection.HTTP_BAD_REQUEST, conn.getResponseCode());
- } finally {
- safeClose(conn);
- }
- // re-subscribe, not to upset after() method which expects all topics to be subscribed to
- PubSub.getInstance().subscribe(Topic.HDFS_SYNC_HMS, testSubscriber);
- }
-
- private static void safeClose(HttpURLConnection conn) {
- if (conn != null) {
- try {
- conn.disconnect();
- } catch (Exception ignore) {
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerWithoutKerberos.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerWithoutKerberos.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerWithoutKerberos.java
deleted file mode 100644
index b37f057..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerWithoutKerberos.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless createRequired by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.sentry.core.common.ActiveRoleSet;
-import org.apache.sentry.core.common.Authorizable;
-import org.apache.sentry.core.model.db.AccessConstants;
-import org.apache.sentry.core.model.db.Database;
-import org.apache.sentry.core.model.db.Server;
-import org.apache.sentry.core.model.db.Table;
-import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-public class TestSentryServerWithoutKerberos extends SentryServiceIntegrationBase {
-
- @BeforeClass
- public static void setup() throws Exception {
- kerberos = false;
- beforeSetup();
- setupConf();
- startSentryService();
- afterSetup();
- }
-
- @Test
- public void testCreateRole() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
- String roleName = "admin_r";
- client.dropRoleIfExists(requestorUserName, roleName);
- client.createRole(requestorUserName, roleName);
- client.dropRole(requestorUserName, roleName);
- }
-
- @Test
- public void testQueryPushDown() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- String roleName1 = "admin_r1";
- String roleName2 = "admin_r2";
-
- String group1 = "g1";
- String group2 = "g2";
-
- client.dropRoleIfExists(requestorUserName, roleName1);
- client.createRole(requestorUserName, roleName1);
- client.grantRoleToGroup(requestorUserName, group1, roleName1);
-
- client.grantTablePrivilege(requestorUserName, roleName1, "server", "db1", "table1", "ALL");
- client.grantTablePrivilege(requestorUserName, roleName1, "server", "db1", "table2", "ALL");
- client.grantTablePrivilege(requestorUserName, roleName1, "server", "db2", "table3", "ALL");
- client.grantTablePrivilege(requestorUserName, roleName1, "server", "db2", "table4", "ALL");
-
- client.dropRoleIfExists(requestorUserName, roleName2);
- client.createRole(requestorUserName, roleName2);
- client.grantRoleToGroup(requestorUserName, group1, roleName2);
- client.grantRoleToGroup(requestorUserName, group2, roleName2);
-
- client.grantTablePrivilege(requestorUserName, roleName2, "server", "db1", "table1", "ALL");
- client.grantTablePrivilege(requestorUserName, roleName2, "server", "db1", "table2", "ALL");
- client.grantTablePrivilege(requestorUserName, roleName2, "server", "db2", "table3", "ALL");
- client.grantTablePrivilege(requestorUserName, roleName2, "server", "db2", "table4", "ALL");
- client.grantTablePrivilege(requestorUserName, roleName2, "server", "db3", "table5", "ALL");
-
- Set<TSentryPrivilege> listPrivilegesByRoleName = client.listPrivilegesByRoleName(requestorUserName, roleName2, null);
- assertEquals("Privilege not assigned to role2 !!", 5, listPrivilegesByRoleName.size());
-
- listPrivilegesByRoleName = client.listPrivilegesByRoleName(requestorUserName, roleName2, new ArrayList<Authorizable>());
- assertEquals("Privilege not assigned to role2 !!", 5, listPrivilegesByRoleName.size());
-
- listPrivilegesByRoleName = client.listPrivilegesByRoleName(requestorUserName, roleName2, Lists.newArrayList(new Server("server"), new Database("db1")));
- assertEquals("Privilege not assigned to role2 !!", 2, listPrivilegesByRoleName.size());
-
- listPrivilegesByRoleName = client.listPrivilegesByRoleName(requestorUserName, roleName2, Lists.newArrayList(new Server("server"), new Database("db2"), new Table("table1")));
- assertEquals("Privilege not assigned to role2 !!", 0, listPrivilegesByRoleName.size());
-
- listPrivilegesByRoleName = client.listPrivilegesByRoleName(requestorUserName, roleName2, Lists.newArrayList(new Server("server"), new Database("db1"), new Table("table1")));
- assertEquals("Privilege not assigned to role2 !!", 1, listPrivilegesByRoleName.size());
-
- listPrivilegesByRoleName = client.listPrivilegesByRoleName(requestorUserName, roleName2, Lists.newArrayList(new Server("server"), new Database("db3")));
- assertEquals("Privilege not assigned to role2 !!", 1, listPrivilegesByRoleName.size());
-
- Set<String> listPrivilegesForProvider = client.listPrivilegesForProvider(Sets.newHashSet(group1, group2), null, ActiveRoleSet.ALL, new Server("server"), new Database("db2"));
- assertEquals("Privilege not correctly assigned to roles !!",
- Sets.newHashSet("server=server->db=db2->table=table4->action=all", "server=server->db=db2->table=table3->action=all"),
- listPrivilegesForProvider);
-
- listPrivilegesForProvider = client.listPrivilegesForProvider(Sets.newHashSet(group1, group2), null, ActiveRoleSet.ALL, new Server("server"), new Database("db3"));
- assertEquals("Privilege not correctly assigned to roles !!", Sets.newHashSet("server=server->db=db3->table=table5->action=all"), listPrivilegesForProvider);
-
- listPrivilegesForProvider = client.listPrivilegesForProvider(Sets.newHashSet(group1, group2), null, new ActiveRoleSet(Sets.newHashSet(roleName1)), new Server("server"), new Database("db3"));
- assertEquals("Privilege not correctly assigned to roles !!", Sets.newHashSet("server=+"), listPrivilegesForProvider);
-
- listPrivilegesForProvider = client.listPrivilegesForProvider(Sets.newHashSet(group1, group2), null, new ActiveRoleSet(Sets.newHashSet(roleName1)), new Server("server1"));
- assertEquals("Privilege not correctly assigned to roles !!", new HashSet<String>(), listPrivilegesForProvider);
- }
-
-
-
- /**
- * Create role, add privileges and grant it to a group drop the role and
- * verify the privileges are no longer visible recreate the role with same
- * name and verify the privileges again.
- * @throws Exception
- */
- @Test
- public void testDropRole() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
- String roleName = "admin_r";
-
- // create role and add privileges
- client.dropRoleIfExists(requestorUserName, roleName);
- client.createRole(requestorUserName, roleName);
- client.grantRoleToGroup(requestorUserName, ADMIN_GROUP, roleName);
- client.grantDatabasePrivilege(requestorUserName, roleName, "server1", "db2", AccessConstants.ALL);
- client.grantTablePrivilege(requestorUserName, roleName, "server1", "db3", "tab3", "ALL");
- assertEquals(2, client.listPrivilegesForProvider(requestorUserGroupNames, null,
- ActiveRoleSet.ALL).size());
-
- // drop role and verify privileges
- client.dropRole(requestorUserName, roleName);
- assertEquals(0, client.listPrivilegesForProvider(requestorUserGroupNames, null,
- ActiveRoleSet.ALL).size());
-
- // recreate the role
- client.createRole(requestorUserName, roleName);
- client.grantRoleToGroup(requestorUserName, ADMIN_GROUP, roleName);
- assertEquals(0, client.listPrivilegesForProvider(requestorUserGroupNames, null,
- ActiveRoleSet.ALL).size());
-
- // grant different privileges and verify
- client.grantDatabasePrivilege(requestorUserName, roleName, "server1", "db2", AccessConstants.ALL);
- assertEquals(1, client.listPrivilegesForProvider(requestorUserGroupNames, null,
- ActiveRoleSet.ALL).size());
- client.dropRole(requestorUserName, roleName);
- assertEquals(0, client.listPrivilegesForProvider(requestorUserGroupNames, null,
- ActiveRoleSet.ALL).size());
- assertEquals(0, client.listPrivilegesForProvider(requestorUserGroupNames, null,
- ActiveRoleSet.ALL).size());
- }
-
- @Test
- public void testDropRoleOnUser() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- Set<String> requestorUserNames = Sets.newHashSet(ADMIN_USER);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
- String roleName = "admin_r";
-
- // create role and add privileges
- client.dropRoleIfExists(requestorUserName, roleName);
- client.createRole(requestorUserName, roleName);
- client.grantRoleToUser(requestorUserName, ADMIN_USER, roleName);
- client.grantDatabasePrivilege(requestorUserName, roleName, "server1", "db2", AccessConstants.ALL);
- client.grantTablePrivilege(requestorUserName, roleName, "server1", "db3", "tab3", "ALL");
- assertEquals(2, client.listPrivilegesForProvider(requestorUserGroupNames, requestorUserNames,
- ActiveRoleSet.ALL).size());
-
- // drop role and verify privileges
- client.dropRole(requestorUserName, roleName);
- assertEquals(0, client.listPrivilegesForProvider(requestorUserGroupNames, requestorUserNames,
- ActiveRoleSet.ALL).size());
-
- // recreate the role
- client.createRole(requestorUserName, roleName);
- client.grantRoleToGroup(requestorUserName, ADMIN_GROUP, roleName);
- assertEquals(0, client.listPrivilegesForProvider(requestorUserGroupNames, requestorUserNames,
- ActiveRoleSet.ALL).size());
-
- // grant different privileges and verify
- client.grantDatabasePrivilege(requestorUserName, roleName, "server1", "db2", AccessConstants.ALL);
- assertEquals(1, client.listPrivilegesForProvider(requestorUserGroupNames, requestorUserNames,
- ActiveRoleSet.ALL).size());
- client.dropRole(requestorUserName, roleName);
- assertEquals(0, client.listPrivilegesForProvider(requestorUserGroupNames, requestorUserNames,
- ActiveRoleSet.ALL).size());
- assertEquals(0, client.listPrivilegesForProvider(requestorUserGroupNames, requestorUserNames,
- ActiveRoleSet.ALL).size());
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceClientPool.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceClientPool.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceClientPool.java
deleted file mode 100644
index 3e9e2cd..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceClientPool.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import static org.junit.Assert.assertTrue;
-
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.FutureTask;
-
-import org.apache.sentry.core.common.exception.SentryUserException;
-import org.apache.sentry.service.thrift.SentryServiceFactory;
-import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.junit.Test;
-
-import com.google.common.collect.Sets;
-
-public class TestSentryServiceClientPool extends SentryServiceIntegrationBase {
-
- @Test
- public void testConnectionWhenReconnect() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- String roleName = "admin_r";
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName);
- client.createRole(requestorUserName, roleName);
- client.listAllRoles(requestorUserName);
- stopSentryService();
- server = SentryServiceFactory.create(conf);
- startSentryService();
- client.listAllRoles(requestorUserName);
- client.dropRole(requestorUserName, roleName);
- }
- });
- }
-
- @Test
- public void testConnectionWithMultipleRetries() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- List<Future<Boolean>> tasks = new ArrayList<Future<Boolean>>();
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- String roleName = "admin_r";
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName);
- client.createRole(requestorUserName, roleName);
-
- ExecutorService executorService = Executors.newFixedThreadPool(20);
-
- Callable<Boolean> func = new Callable<Boolean>() {
- public Boolean call() throws Exception {
- return clientUgi.doAs(new PrivilegedExceptionAction<Boolean>() {
- @Override
- public Boolean run() throws Exception {
- try {
- client.listAllRoles(ADMIN_USER);
- return true;
- } catch (SentryUserException sue) {
- return false;
- }
- }
- });
- }
- };
-
- for (int i = 0; i < 30; i++) {
- FutureTask<Boolean> task = new FutureTask<Boolean>(func);
- tasks.add(task);
- executorService.submit(task);
- }
-
- for (Future<Boolean> task : tasks) {
- Boolean result = task.get();
- assertTrue("Some tasks are failed.", result);
- }
- }
- });
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceFailureCase.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceFailureCase.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceFailureCase.java
deleted file mode 100644
index fc65382..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceFailureCase.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Strings;
-
-public class TestSentryServiceFailureCase extends SentryServiceIntegrationBase {
- private static final Logger LOGGER = LoggerFactory.getLogger(TestSentryServiceFailureCase.class);
- private static final String PEER_CALLBACK_FAILURE = "Peer indicated failure: Problem with callback handler";
-
- @BeforeClass
- public static void setup() throws Exception {
- kerberos = true;
- beforeSetup();
- setupConf();
- conf.set(ServerConfig.ALLOW_CONNECT, "");
- startSentryService();
- afterSetup();
- }
-
- @Override
- @Before
- public void before() throws Exception {
- }
-
- @Override
- @After
- public void after() {
- }
-
- @Test
- public void testClientServerConnectionFailure() throws Exception {
- try {
- connectToSentryService();
- String requestorUserName = ADMIN_USER;
- client.listAllRoles(requestorUserName);
- Assert.fail("Failed to receive Exception");
- } catch(Exception e) {
- LOGGER.info("Excepted exception", e);
- Throwable cause = e.getCause();
- if (cause == null) {
- throw e;
- }
- String msg = "Exception message: " + cause.getMessage();
- Assert.assertTrue(msg, Strings.nullToEmpty(cause.getMessage())
- .contains(PEER_CALLBACK_FAILURE));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceForPoolWithKerberos.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceForPoolWithKerberos.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceForPoolWithKerberos.java
deleted file mode 100644
index bac1c15..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceForPoolWithKerberos.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless createRequired by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.junit.BeforeClass;
-
-public class TestSentryServiceForPoolWithKerberos extends TestSentryServiceWithKerberos {
-
- @BeforeClass
- public static void setup() throws Exception {
- kerberos = true;
- pooled = true;
- beforeSetup();
- setupConf();
- startSentryService();
- afterSetup();
- }
-
-}
\ No newline at end of file
[08/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleGrantPrivilegeRequest.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
new file mode 100644
index 0000000..fe04dc5
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
@@ -0,0 +1,798 @@
+/**
+ * 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.generic.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 TAlterSentryRoleGrantPrivilegeRequest implements org.apache.thrift.TBase<TAlterSentryRoleGrantPrivilegeRequest, TAlterSentryRoleGrantPrivilegeRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleGrantPrivilegeRequest> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleGrantPrivilegeRequest");
+
+ 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
+ private static final org.apache.thrift.protocol.TField PRIVILEGE_FIELD_DESC = new org.apache.thrift.protocol.TField("privilege", org.apache.thrift.protocol.TType.STRUCT, (short)5);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAlterSentryRoleGrantPrivilegeRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAlterSentryRoleGrantPrivilegeRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String roleName; // required
+ private String component; // required
+ private TSentryPrivilege privilege; // 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"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ ROLE_NAME((short)3, "roleName"),
+ COMPONENT((short)4, "component"),
+ PRIVILEGE((short)5, "privilege");
+
+ 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: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // ROLE_NAME
+ return ROLE_NAME;
+ case 4: // COMPONENT
+ return COMPONENT;
+ case 5: // PRIVILEGE
+ return PRIVILEGE;
+ 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.PRIVILEGE, new org.apache.thrift.meta_data.FieldMetaData("privilege", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleGrantPrivilegeRequest.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleGrantPrivilegeRequest() {
+ this.protocol_version = 2;
+
+ }
+
+ public TAlterSentryRoleGrantPrivilegeRequest(
+ int protocol_version,
+ String requestorUserName,
+ String roleName,
+ String component,
+ TSentryPrivilege privilege)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.roleName = roleName;
+ this.component = component;
+ this.privilege = privilege;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleGrantPrivilegeRequest(TAlterSentryRoleGrantPrivilegeRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetRoleName()) {
+ this.roleName = other.roleName;
+ }
+ if (other.isSetComponent()) {
+ this.component = other.component;
+ }
+ if (other.isSetPrivilege()) {
+ this.privilege = new TSentryPrivilege(other.privilege);
+ }
+ }
+
+ public TAlterSentryRoleGrantPrivilegeRequest deepCopy() {
+ return new TAlterSentryRoleGrantPrivilegeRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 2;
+
+ this.requestorUserName = null;
+ this.roleName = null;
+ this.component = null;
+ this.privilege = 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 String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public String getRoleName() {
+ return this.roleName;
+ }
+
+ public void setRoleName(String roleName) {
+ this.roleName = roleName;
+ }
+
+ public void unsetRoleName() {
+ this.roleName = null;
+ }
+
+ /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRoleName() {
+ return this.roleName != null;
+ }
+
+ public void setRoleNameIsSet(boolean value) {
+ if (!value) {
+ this.roleName = null;
+ }
+ }
+
+ public String getComponent() {
+ return this.component;
+ }
+
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ public void unsetComponent() {
+ this.component = null;
+ }
+
+ /** Returns true if field component is set (has been assigned a value) and false otherwise */
+ public boolean isSetComponent() {
+ return this.component != null;
+ }
+
+ public void setComponentIsSet(boolean value) {
+ if (!value) {
+ this.component = null;
+ }
+ }
+
+ public TSentryPrivilege getPrivilege() {
+ return this.privilege;
+ }
+
+ public void setPrivilege(TSentryPrivilege privilege) {
+ this.privilege = privilege;
+ }
+
+ public void unsetPrivilege() {
+ this.privilege = null;
+ }
+
+ /** Returns true if field privilege is set (has been assigned a value) and false otherwise */
+ public boolean isSetPrivilege() {
+ return this.privilege != null;
+ }
+
+ public void setPrivilegeIsSet(boolean value) {
+ if (!value) {
+ this.privilege = 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 REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case ROLE_NAME:
+ if (value == null) {
+ unsetRoleName();
+ } else {
+ setRoleName((String)value);
+ }
+ break;
+
+ case COMPONENT:
+ if (value == null) {
+ unsetComponent();
+ } else {
+ setComponent((String)value);
+ }
+ break;
+
+ case PRIVILEGE:
+ if (value == null) {
+ unsetPrivilege();
+ } else {
+ setPrivilege((TSentryPrivilege)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return getProtocol_version();
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case ROLE_NAME:
+ return getRoleName();
+
+ case COMPONENT:
+ return getComponent();
+
+ case PRIVILEGE:
+ return getPrivilege();
+
+ }
+ 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 REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case ROLE_NAME:
+ return isSetRoleName();
+ case COMPONENT:
+ return isSetComponent();
+ case PRIVILEGE:
+ return isSetPrivilege();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleGrantPrivilegeRequest)
+ return this.equals((TAlterSentryRoleGrantPrivilegeRequest)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleGrantPrivilegeRequest 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_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_roleName = true && this.isSetRoleName();
+ boolean that_present_roleName = true && that.isSetRoleName();
+ if (this_present_roleName || that_present_roleName) {
+ if (!(this_present_roleName && that_present_roleName))
+ return false;
+ if (!this.roleName.equals(that.roleName))
+ return false;
+ }
+
+ boolean this_present_component = true && this.isSetComponent();
+ boolean that_present_component = true && that.isSetComponent();
+ if (this_present_component || that_present_component) {
+ if (!(this_present_component && that_present_component))
+ return false;
+ if (!this.component.equals(that.component))
+ return false;
+ }
+
+ boolean this_present_privilege = true && this.isSetPrivilege();
+ boolean that_present_privilege = true && that.isSetPrivilege();
+ if (this_present_privilege || that_present_privilege) {
+ if (!(this_present_privilege && that_present_privilege))
+ return false;
+ if (!this.privilege.equals(that.privilege))
+ 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_requestorUserName = true && (isSetRequestorUserName());
+ list.add(present_requestorUserName);
+ if (present_requestorUserName)
+ list.add(requestorUserName);
+
+ boolean present_roleName = true && (isSetRoleName());
+ list.add(present_roleName);
+ if (present_roleName)
+ list.add(roleName);
+
+ boolean present_component = true && (isSetComponent());
+ list.add(present_component);
+ if (present_component)
+ list.add(component);
+
+ boolean present_privilege = true && (isSetPrivilege());
+ list.add(present_privilege);
+ if (present_privilege)
+ list.add(privilege);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TAlterSentryRoleGrantPrivilegeRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetComponent()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetPrivilege()).compareTo(other.isSetPrivilege());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPrivilege()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilege, other.privilege);
+ 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("TAlterSentryRoleGrantPrivilegeRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("roleName:");
+ if (this.roleName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roleName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("component:");
+ if (this.component == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.component);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("privilege:");
+ if (this.privilege == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.privilege);
+ }
+ 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 (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRoleName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetComponent()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
+ }
+
+ if (!isSetPrivilege()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilege' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (privilege != null) {
+ privilege.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 TAlterSentryRoleGrantPrivilegeRequestStandardSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleGrantPrivilegeRequestStandardScheme getScheme() {
+ return new TAlterSentryRoleGrantPrivilegeRequestStandardScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleGrantPrivilegeRequestStandardScheme extends StandardScheme<TAlterSentryRoleGrantPrivilegeRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleGrantPrivilegeRequest 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: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // ROLE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // COMPONENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 5: // PRIVILEGE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.privilege = new TSentryPrivilege();
+ struct.privilege.read(iprot);
+ struct.setPrivilegeIsSet(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, TAlterSentryRoleGrantPrivilegeRequest 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();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.roleName != null) {
+ oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
+ oprot.writeString(struct.roleName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.component != null) {
+ oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
+ oprot.writeString(struct.component);
+ oprot.writeFieldEnd();
+ }
+ if (struct.privilege != null) {
+ oprot.writeFieldBegin(PRIVILEGE_FIELD_DESC);
+ struct.privilege.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAlterSentryRoleGrantPrivilegeRequestTupleSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleGrantPrivilegeRequestTupleScheme getScheme() {
+ return new TAlterSentryRoleGrantPrivilegeRequestTupleScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleGrantPrivilegeRequestTupleScheme extends TupleScheme<TAlterSentryRoleGrantPrivilegeRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeString(struct.roleName);
+ oprot.writeString(struct.component);
+ struct.privilege.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ struct.privilege = new TSentryPrivilege();
+ struct.privilege.read(iprot);
+ struct.setPrivilegeIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleGrantPrivilegeResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleGrantPrivilegeResponse.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleGrantPrivilegeResponse.java
new file mode 100644
index 0000000..99f1f43
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleGrantPrivilegeResponse.java
@@ -0,0 +1,391 @@
+/**
+ * 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.generic.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 TAlterSentryRoleGrantPrivilegeResponse implements org.apache.thrift.TBase<TAlterSentryRoleGrantPrivilegeResponse, TAlterSentryRoleGrantPrivilegeResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleGrantPrivilegeResponse> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleGrantPrivilegeResponse");
+
+ 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAlterSentryRoleGrantPrivilegeResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAlterSentryRoleGrantPrivilegeResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
+
+ 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;
+ 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleGrantPrivilegeResponse.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleGrantPrivilegeResponse() {
+ }
+
+ public TAlterSentryRoleGrantPrivilegeResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleGrantPrivilegeResponse(TAlterSentryRoleGrantPrivilegeResponse other) {
+ if (other.isSetStatus()) {
+ this.status = other.status;
+ }
+ }
+
+ public TAlterSentryRoleGrantPrivilegeResponse deepCopy() {
+ return new TAlterSentryRoleGrantPrivilegeResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ }
+
+ 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 void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ }
+ 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();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleGrantPrivilegeResponse)
+ return this.equals((TAlterSentryRoleGrantPrivilegeResponse)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleGrantPrivilegeResponse 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;
+ }
+
+ 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);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TAlterSentryRoleGrantPrivilegeResponse 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;
+ }
+ }
+ 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("TAlterSentryRoleGrantPrivilegeResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ 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());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TAlterSentryRoleGrantPrivilegeResponseStandardSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleGrantPrivilegeResponseStandardScheme getScheme() {
+ return new TAlterSentryRoleGrantPrivilegeResponseStandardScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleGrantPrivilegeResponseStandardScheme extends StandardScheme<TAlterSentryRoleGrantPrivilegeResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleGrantPrivilegeResponse 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;
+ 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, TAlterSentryRoleGrantPrivilegeResponse 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.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAlterSentryRoleGrantPrivilegeResponseTupleSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleGrantPrivilegeResponseTupleScheme getScheme() {
+ return new TAlterSentryRoleGrantPrivilegeResponseTupleScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleGrantPrivilegeResponseTupleScheme extends TupleScheme<TAlterSentryRoleGrantPrivilegeResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ struct.status.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeResponse 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);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleRevokePrivilegeRequest.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
new file mode 100644
index 0000000..9cae5cd
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
@@ -0,0 +1,798 @@
+/**
+ * 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.generic.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 TAlterSentryRoleRevokePrivilegeRequest implements org.apache.thrift.TBase<TAlterSentryRoleRevokePrivilegeRequest, TAlterSentryRoleRevokePrivilegeRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleRevokePrivilegeRequest> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleRevokePrivilegeRequest");
+
+ 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
+ private static final org.apache.thrift.protocol.TField PRIVILEGE_FIELD_DESC = new org.apache.thrift.protocol.TField("privilege", org.apache.thrift.protocol.TType.STRUCT, (short)5);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAlterSentryRoleRevokePrivilegeRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAlterSentryRoleRevokePrivilegeRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String roleName; // required
+ private String component; // required
+ private TSentryPrivilege privilege; // 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"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ ROLE_NAME((short)3, "roleName"),
+ COMPONENT((short)4, "component"),
+ PRIVILEGE((short)5, "privilege");
+
+ 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: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // ROLE_NAME
+ return ROLE_NAME;
+ case 4: // COMPONENT
+ return COMPONENT;
+ case 5: // PRIVILEGE
+ return PRIVILEGE;
+ 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.PRIVILEGE, new org.apache.thrift.meta_data.FieldMetaData("privilege", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleRevokePrivilegeRequest.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleRevokePrivilegeRequest() {
+ this.protocol_version = 2;
+
+ }
+
+ public TAlterSentryRoleRevokePrivilegeRequest(
+ int protocol_version,
+ String requestorUserName,
+ String roleName,
+ String component,
+ TSentryPrivilege privilege)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.roleName = roleName;
+ this.component = component;
+ this.privilege = privilege;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleRevokePrivilegeRequest(TAlterSentryRoleRevokePrivilegeRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetRoleName()) {
+ this.roleName = other.roleName;
+ }
+ if (other.isSetComponent()) {
+ this.component = other.component;
+ }
+ if (other.isSetPrivilege()) {
+ this.privilege = new TSentryPrivilege(other.privilege);
+ }
+ }
+
+ public TAlterSentryRoleRevokePrivilegeRequest deepCopy() {
+ return new TAlterSentryRoleRevokePrivilegeRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 2;
+
+ this.requestorUserName = null;
+ this.roleName = null;
+ this.component = null;
+ this.privilege = 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 String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public String getRoleName() {
+ return this.roleName;
+ }
+
+ public void setRoleName(String roleName) {
+ this.roleName = roleName;
+ }
+
+ public void unsetRoleName() {
+ this.roleName = null;
+ }
+
+ /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRoleName() {
+ return this.roleName != null;
+ }
+
+ public void setRoleNameIsSet(boolean value) {
+ if (!value) {
+ this.roleName = null;
+ }
+ }
+
+ public String getComponent() {
+ return this.component;
+ }
+
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ public void unsetComponent() {
+ this.component = null;
+ }
+
+ /** Returns true if field component is set (has been assigned a value) and false otherwise */
+ public boolean isSetComponent() {
+ return this.component != null;
+ }
+
+ public void setComponentIsSet(boolean value) {
+ if (!value) {
+ this.component = null;
+ }
+ }
+
+ public TSentryPrivilege getPrivilege() {
+ return this.privilege;
+ }
+
+ public void setPrivilege(TSentryPrivilege privilege) {
+ this.privilege = privilege;
+ }
+
+ public void unsetPrivilege() {
+ this.privilege = null;
+ }
+
+ /** Returns true if field privilege is set (has been assigned a value) and false otherwise */
+ public boolean isSetPrivilege() {
+ return this.privilege != null;
+ }
+
+ public void setPrivilegeIsSet(boolean value) {
+ if (!value) {
+ this.privilege = 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 REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case ROLE_NAME:
+ if (value == null) {
+ unsetRoleName();
+ } else {
+ setRoleName((String)value);
+ }
+ break;
+
+ case COMPONENT:
+ if (value == null) {
+ unsetComponent();
+ } else {
+ setComponent((String)value);
+ }
+ break;
+
+ case PRIVILEGE:
+ if (value == null) {
+ unsetPrivilege();
+ } else {
+ setPrivilege((TSentryPrivilege)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return getProtocol_version();
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case ROLE_NAME:
+ return getRoleName();
+
+ case COMPONENT:
+ return getComponent();
+
+ case PRIVILEGE:
+ return getPrivilege();
+
+ }
+ 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 REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case ROLE_NAME:
+ return isSetRoleName();
+ case COMPONENT:
+ return isSetComponent();
+ case PRIVILEGE:
+ return isSetPrivilege();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleRevokePrivilegeRequest)
+ return this.equals((TAlterSentryRoleRevokePrivilegeRequest)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleRevokePrivilegeRequest 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_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_roleName = true && this.isSetRoleName();
+ boolean that_present_roleName = true && that.isSetRoleName();
+ if (this_present_roleName || that_present_roleName) {
+ if (!(this_present_roleName && that_present_roleName))
+ return false;
+ if (!this.roleName.equals(that.roleName))
+ return false;
+ }
+
+ boolean this_present_component = true && this.isSetComponent();
+ boolean that_present_component = true && that.isSetComponent();
+ if (this_present_component || that_present_component) {
+ if (!(this_present_component && that_present_component))
+ return false;
+ if (!this.component.equals(that.component))
+ return false;
+ }
+
+ boolean this_present_privilege = true && this.isSetPrivilege();
+ boolean that_present_privilege = true && that.isSetPrivilege();
+ if (this_present_privilege || that_present_privilege) {
+ if (!(this_present_privilege && that_present_privilege))
+ return false;
+ if (!this.privilege.equals(that.privilege))
+ 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_requestorUserName = true && (isSetRequestorUserName());
+ list.add(present_requestorUserName);
+ if (present_requestorUserName)
+ list.add(requestorUserName);
+
+ boolean present_roleName = true && (isSetRoleName());
+ list.add(present_roleName);
+ if (present_roleName)
+ list.add(roleName);
+
+ boolean present_component = true && (isSetComponent());
+ list.add(present_component);
+ if (present_component)
+ list.add(component);
+
+ boolean present_privilege = true && (isSetPrivilege());
+ list.add(present_privilege);
+ if (present_privilege)
+ list.add(privilege);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TAlterSentryRoleRevokePrivilegeRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetComponent()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetPrivilege()).compareTo(other.isSetPrivilege());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPrivilege()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilege, other.privilege);
+ 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("TAlterSentryRoleRevokePrivilegeRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("roleName:");
+ if (this.roleName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roleName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("component:");
+ if (this.component == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.component);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("privilege:");
+ if (this.privilege == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.privilege);
+ }
+ 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 (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRoleName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetComponent()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
+ }
+
+ if (!isSetPrivilege()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilege' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (privilege != null) {
+ privilege.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 TAlterSentryRoleRevokePrivilegeRequestStandardSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleRevokePrivilegeRequestStandardScheme getScheme() {
+ return new TAlterSentryRoleRevokePrivilegeRequestStandardScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleRevokePrivilegeRequestStandardScheme extends StandardScheme<TAlterSentryRoleRevokePrivilegeRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleRevokePrivilegeRequest 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: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // ROLE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // COMPONENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 5: // PRIVILEGE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.privilege = new TSentryPrivilege();
+ struct.privilege.read(iprot);
+ struct.setPrivilegeIsSet(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, TAlterSentryRoleRevokePrivilegeRequest 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();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.roleName != null) {
+ oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
+ oprot.writeString(struct.roleName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.component != null) {
+ oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
+ oprot.writeString(struct.component);
+ oprot.writeFieldEnd();
+ }
+ if (struct.privilege != null) {
+ oprot.writeFieldBegin(PRIVILEGE_FIELD_DESC);
+ struct.privilege.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAlterSentryRoleRevokePrivilegeRequestTupleSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleRevokePrivilegeRequestTupleScheme getScheme() {
+ return new TAlterSentryRoleRevokePrivilegeRequestTupleScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleRevokePrivilegeRequestTupleScheme extends TupleScheme<TAlterSentryRoleRevokePrivilegeRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeString(struct.roleName);
+ oprot.writeString(struct.component);
+ struct.privilege.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ struct.privilege = new TSentryPrivilege();
+ struct.privilege.read(iprot);
+ struct.setPrivilegeIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleRevokePrivilegeResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleRevokePrivilegeResponse.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleRevokePrivilegeResponse.java
new file mode 100644
index 0000000..4d1929b
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TAlterSentryRoleRevokePrivilegeResponse.java
@@ -0,0 +1,391 @@
+/**
+ * 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.generic.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 TAlterSentryRoleRevokePrivilegeResponse implements org.apache.thrift.TBase<TAlterSentryRoleRevokePrivilegeResponse, TAlterSentryRoleRevokePrivilegeResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleRevokePrivilegeResponse> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleRevokePrivilegeResponse");
+
+ 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAlterSentryRoleRevokePrivilegeResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAlterSentryRoleRevokePrivilegeResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
+
+ 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;
+ 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleRevokePrivilegeResponse.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleRevokePrivilegeResponse() {
+ }
+
+ public TAlterSentryRoleRevokePrivilegeResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleRevokePrivilegeResponse(TAlterSentryRoleRevokePrivilegeResponse other) {
+ if (other.isSetStatus()) {
+ this.status = other.status;
+ }
+ }
+
+ public TAlterSentryRoleRevokePrivilegeResponse deepCopy() {
+ return new TAlterSentryRoleRevokePrivilegeResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ }
+
+ 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 void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ }
+ 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();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleRevokePrivilegeResponse)
+ return this.equals((TAlterSentryRoleRevokePrivilegeResponse)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleRevokePrivilegeResponse 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;
+ }
+
+ 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);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TAlterSentryRoleRevokePrivilegeResponse 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;
+ }
+ }
+ 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("TAlterSentryRoleRevokePrivilegeResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ 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());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TAlterSentryRoleRevokePrivilegeResponseStandardSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleRevokePrivilegeResponseStandardScheme getScheme() {
+ return new TAlterSentryRoleRevokePrivilegeResponseStandardScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleRevokePrivilegeResponseStandardScheme extends StandardScheme<TAlterSentryRoleRevokePrivilegeResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleRevokePrivilegeResponse 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;
+ 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, TAlterSentryRoleRevokePrivilegeResponse 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.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAlterSentryRoleRevokePrivilegeResponseTupleSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleRevokePrivilegeResponseTupleScheme getScheme() {
+ return new TAlterSentryRoleRevokePrivilegeResponseTupleScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleRevokePrivilegeResponseTupleScheme extends TupleScheme<TAlterSentryRoleRevokePrivilegeResponse> {
+
+ @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 read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeResponse 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);
+ }
+ }
+
+}
+
[45/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TDropPrivilegesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TDropPrivilegesResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TDropPrivilegesResponse.java
deleted file mode 100644
index 350ba58..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TDropPrivilegesResponse.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/**
- * 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.provider.db.generic.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 TDropPrivilegesResponse implements org.apache.thrift.TBase<TDropPrivilegesResponse, TDropPrivilegesResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TDropPrivilegesResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropPrivilegesResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TDropPrivilegesResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TDropPrivilegesResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropPrivilegesResponse.class, metaDataMap);
- }
-
- public TDropPrivilegesResponse() {
- }
-
- public TDropPrivilegesResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TDropPrivilegesResponse(TDropPrivilegesResponse other) {
- if (other.isSetStatus()) {
- this.status = other.status;
- }
- }
-
- public TDropPrivilegesResponse deepCopy() {
- return new TDropPrivilegesResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TDropPrivilegesResponse)
- return this.equals((TDropPrivilegesResponse)that);
- return false;
- }
-
- public boolean equals(TDropPrivilegesResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TDropPrivilegesResponse 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;
- }
- }
- 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("TDropPrivilegesResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // check for sub-struct validity
- }
-
- 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 TDropPrivilegesResponseStandardSchemeFactory implements SchemeFactory {
- public TDropPrivilegesResponseStandardScheme getScheme() {
- return new TDropPrivilegesResponseStandardScheme();
- }
- }
-
- private static class TDropPrivilegesResponseStandardScheme extends StandardScheme<TDropPrivilegesResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TDropPrivilegesResponse 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;
- 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, TDropPrivilegesResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TDropPrivilegesResponseTupleSchemeFactory implements SchemeFactory {
- public TDropPrivilegesResponseTupleScheme getScheme() {
- return new TDropPrivilegesResponseTupleScheme();
- }
- }
-
- private static class TDropPrivilegesResponseTupleScheme extends TupleScheme<TDropPrivilegesResponse> {
-
- @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 read(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesResponse 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);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TDropSentryRoleRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TDropSentryRoleRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TDropSentryRoleRequest.java
deleted file mode 100644
index 5f34620..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TDropSentryRoleRequest.java
+++ /dev/null
@@ -1,692 +0,0 @@
-/**
- * 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.provider.db.generic.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 TDropSentryRoleRequest implements org.apache.thrift.TBase<TDropSentryRoleRequest, TDropSentryRoleRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TDropSentryRoleRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropSentryRoleRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TDropSentryRoleRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TDropSentryRoleRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private String component; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName"),
- COMPONENT((short)4, "component");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- case 4: // COMPONENT
- return COMPONENT;
- 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropSentryRoleRequest.class, metaDataMap);
- }
-
- public TDropSentryRoleRequest() {
- this.protocol_version = 2;
-
- }
-
- public TDropSentryRoleRequest(
- int protocol_version,
- String requestorUserName,
- String roleName,
- String component)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- this.component = component;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TDropSentryRoleRequest(TDropSentryRoleRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetComponent()) {
- this.component = other.component;
- }
- }
-
- public TDropSentryRoleRequest deepCopy() {
- return new TDropSentryRoleRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.component = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public String getComponent() {
- return this.component;
- }
-
- public void setComponent(String component) {
- this.component = component;
- }
-
- public void unsetComponent() {
- this.component = null;
- }
-
- /** Returns true if field component is set (has been assigned a value) and false otherwise */
- public boolean isSetComponent() {
- return this.component != null;
- }
-
- public void setComponentIsSet(boolean value) {
- if (!value) {
- this.component = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case COMPONENT:
- if (value == null) {
- unsetComponent();
- } else {
- setComponent((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case COMPONENT:
- return getComponent();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case COMPONENT:
- return isSetComponent();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TDropSentryRoleRequest)
- return this.equals((TDropSentryRoleRequest)that);
- return false;
- }
-
- public boolean equals(TDropSentryRoleRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- boolean this_present_component = true && this.isSetComponent();
- boolean that_present_component = true && that.isSetComponent();
- if (this_present_component || that_present_component) {
- if (!(this_present_component && that_present_component))
- return false;
- if (!this.component.equals(that.component))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- boolean present_component = true && (isSetComponent());
- list.add(present_component);
- if (present_component)
- list.add(component);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TDropSentryRoleRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetComponent()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
- 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("TDropSentryRoleRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("component:");
- if (this.component == null) {
- sb.append("null");
- } else {
- sb.append(this.component);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- if (!isSetComponent()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TDropSentryRoleRequestStandardSchemeFactory implements SchemeFactory {
- public TDropSentryRoleRequestStandardScheme getScheme() {
- return new TDropSentryRoleRequestStandardScheme();
- }
- }
-
- private static class TDropSentryRoleRequestStandardScheme extends StandardScheme<TDropSentryRoleRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TDropSentryRoleRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // COMPONENT
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.component = iprot.readString();
- struct.setComponentIsSet(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, TDropSentryRoleRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.component != null) {
- oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
- oprot.writeString(struct.component);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TDropSentryRoleRequestTupleSchemeFactory implements SchemeFactory {
- public TDropSentryRoleRequestTupleScheme getScheme() {
- return new TDropSentryRoleRequestTupleScheme();
- }
- }
-
- private static class TDropSentryRoleRequestTupleScheme extends TupleScheme<TDropSentryRoleRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- oprot.writeString(struct.component);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TDropSentryRoleResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TDropSentryRoleResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TDropSentryRoleResponse.java
deleted file mode 100644
index 97ca47c..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TDropSentryRoleResponse.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/**
- * 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.provider.db.generic.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 TDropSentryRoleResponse implements org.apache.thrift.TBase<TDropSentryRoleResponse, TDropSentryRoleResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TDropSentryRoleResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropSentryRoleResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TDropSentryRoleResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TDropSentryRoleResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropSentryRoleResponse.class, metaDataMap);
- }
-
- public TDropSentryRoleResponse() {
- }
-
- public TDropSentryRoleResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TDropSentryRoleResponse(TDropSentryRoleResponse other) {
- if (other.isSetStatus()) {
- this.status = other.status;
- }
- }
-
- public TDropSentryRoleResponse deepCopy() {
- return new TDropSentryRoleResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TDropSentryRoleResponse)
- return this.equals((TDropSentryRoleResponse)that);
- return false;
- }
-
- public boolean equals(TDropSentryRoleResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TDropSentryRoleResponse 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;
- }
- }
- 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("TDropSentryRoleResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // check for sub-struct validity
- }
-
- 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 TDropSentryRoleResponseStandardSchemeFactory implements SchemeFactory {
- public TDropSentryRoleResponseStandardScheme getScheme() {
- return new TDropSentryRoleResponseStandardScheme();
- }
- }
-
- private static class TDropSentryRoleResponseStandardScheme extends StandardScheme<TDropSentryRoleResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TDropSentryRoleResponse 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;
- 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, TDropSentryRoleResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TDropSentryRoleResponseTupleSchemeFactory implements SchemeFactory {
- public TDropSentryRoleResponseTupleScheme getScheme() {
- return new TDropSentryRoleResponseTupleScheme();
- }
- }
-
- private static class TDropSentryRoleResponseTupleScheme extends TupleScheme<TDropSentryRoleResponse> {
-
- @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 read(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleResponse 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);
- }
- }
-
-}
-
[16/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceIntegration.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceIntegration.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceIntegration.java
new file mode 100644
index 0000000..73fca84
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceIntegration.java
@@ -0,0 +1,1102 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless createRequired by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sentry.api.service.thrift;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import org.apache.sentry.core.common.ActiveRoleSet;
+import org.apache.sentry.core.common.Authorizable;
+import org.apache.sentry.core.model.db.AccessConstants;
+import org.apache.sentry.core.model.db.AccessURI;
+import org.apache.sentry.core.model.db.Database;
+import org.apache.sentry.core.model.db.Server;
+import org.apache.sentry.core.model.db.Table;
+import org.apache.sentry.core.common.exception.SentryAccessDeniedException;
+import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+import org.junit.Test;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+
+
+public class TestSentryServiceIntegration extends SentryServiceIntegrationBase {
+
+ @Test
+ public void testCreateDropShowRole() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ String roleName = "admin_r";
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName);
+
+ client.createRole(requestorUserName, roleName);
+
+ Set<TSentryRole> roles = client.listAllRoles(requestorUserName);
+ assertEquals("Incorrect number of roles", 1, roles.size());
+
+ for (TSentryRole role:roles) {
+ assertTrue(role.getRoleName(), role.getRoleName().equalsIgnoreCase(roleName));
+ }
+ client.dropRole(requestorUserName, roleName);
+ }});
+ }
+
+ @Test
+ public void testGranRevokePrivilegeOnTableForRole() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+ String roleName1 = "admin_r1";
+ String roleName2 = "admin_r2";
+
+ client.dropRoleIfExists(requestorUserName, roleName1);
+ client.createRole(requestorUserName, roleName1);
+
+ client.grantTablePrivilege(requestorUserName, roleName1, "server", "db1", "table1", "ALL");
+ client.grantTablePrivilege(requestorUserName, roleName1, "server", "db1", "table2", "ALL");
+ client.grantTablePrivilege(requestorUserName, roleName1, "server", "db2", "table3", "ALL");
+ client.grantTablePrivilege(requestorUserName, roleName1, "server", "db2", "table4", "ALL");
+
+
+ client.dropRoleIfExists(requestorUserName, roleName2);
+ client.createRole(requestorUserName, roleName2);
+
+ client.grantTablePrivilege(requestorUserName, roleName2, "server", "db1", "table1", "ALL");
+ client.grantTablePrivilege(requestorUserName, roleName2, "server", "db1", "table2", "ALL");
+ client.grantTablePrivilege(requestorUserName, roleName2, "server", "db2", "table3", "ALL");
+ client.grantTablePrivilege(requestorUserName, roleName2, "server", "db2", "table4", "ALL");
+
+ Set<TSentryPrivilege> listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
+ assertEquals("Privilege not assigned to role1 !!", 4, listPrivilegesByRoleName.size());
+
+ listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
+ assertEquals("Privilege not assigned to role2 !!", 4, listPrivilegesByRoleName.size());
+
+
+ client.revokeTablePrivilege(requestorUserName, roleName1, "server", "db1", "table1", "ALL");
+ listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
+ assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 3);
+ listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
+ assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 4);
+
+ client.revokeTablePrivilege(requestorUserName, roleName2, "server", "db1", "table1", "ALL");
+ listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
+ assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 3);
+ listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
+ assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 3);
+
+ client.revokeTablePrivilege(requestorUserName, roleName1, "server", "db1", "table2", "ALL");
+ client.revokeTablePrivilege(requestorUserName, roleName1, "server", "db2", "table3", "ALL");
+ client.revokeTablePrivilege(requestorUserName, roleName1, "server", "db2", "table4", "ALL");
+ listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
+ assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 0);
+
+ client.revokeTablePrivilege(requestorUserName, roleName2, "server", "db1", "table2", "ALL");
+ client.revokeTablePrivilege(requestorUserName, roleName2, "server", "db2", "table3", "ALL");
+ client.revokeTablePrivilege(requestorUserName, roleName2, "server", "db2", "table4", "ALL");
+ listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
+ assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 0);
+ }});
+ }
+
+ @Test
+ public void testAddDeleteRolesForUser() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+
+ // user1->group1
+ // user2->group1
+ // user3->group1, group2
+ // user4->group2, group3
+ // group1->r1
+ // group2->r2
+ // group3->r2
+ // user2->r3
+ // user4->r3
+ String roleName1 = "r1";
+ String roleName2 = "r2";
+ String roleName3 = "r3";
+ String user1 = "u1";
+ String user2 = "u2";
+ String user3 = "u3";
+ String user4 = "u4";
+ String group1 = "g1";
+ String group2 = "g2";
+ String group3 = "g3";
+ Map<String, Set<String>> userToGroups = Maps.newHashMap();
+ userToGroups.put(user1, Sets.newHashSet(group1));
+ userToGroups.put(user2, Sets.newHashSet(group1));
+ userToGroups.put(user3, Sets.newHashSet(group1, group2));
+ userToGroups.put(user4, Sets.newHashSet(group2, group3));
+
+ setLocalGroupMapping(user1, Sets.newHashSet(group1));
+ setLocalGroupMapping(user2, Sets.newHashSet(group1));
+ setLocalGroupMapping(user3, Sets.newHashSet(group1, group2));
+ setLocalGroupMapping(user4, Sets.newHashSet(group2, group3));
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName1);
+ client.dropRoleIfExists(requestorUserName, roleName2);
+ client.dropRoleIfExists(requestorUserName, roleName3);
+ client.createRole(requestorUserName, roleName1);
+ client.createRole(requestorUserName, roleName2);
+ client.createRole(requestorUserName, roleName3);
+
+ client.grantRoleToGroup(requestorUserName, group1, roleName1);
+ client.grantRoleToUser(requestorUserName, user2, roleName2);
+ client.grantRoleToUser(requestorUserName, user3, roleName2);
+ client.grantRoleToUser(requestorUserName, user2, roleName3);
+ client.grantRoleToUsers(requestorUserName, roleName3, Sets.newHashSet(user4));
+ // following test cases also test the grantRoleToUser() and grantRoleToUsers() implicity
+ // admin always can get the role list
+ Set<TSentryRole> roles = client.listRolesByUserName(requestorUserName, user1);
+ assertEquals(0, roles.size());
+ // the role list includes the role for user and the role for user's group
+ roles = client.listRolesByUserName(requestorUserName, user2);
+ assertEquals(2, roles.size());
+ for (TSentryRole role : roles) {
+ assertTrue(roleName2.equals(role.getRoleName()) || roleName3.equals(role.getRoleName()));
+ }
+ // user has 2 groups whose role list are different
+ roles = client.listRolesByUserName(requestorUserName, user3);
+ assertEquals(1, roles.size());
+ for (TSentryRole role : roles) {
+ assertTrue(roleName2.equals(role.getRoleName()));
+ }
+ // user has 2 groups whose role list are the same
+ roles = client.listRolesByUserName(requestorUserName, user4);
+ assertEquals(1, roles.size());
+ for (TSentryRole role : roles) {
+ assertTrue(roleName3.equals(role.getRoleName()));
+ }
+ // user can get his own role list if he isn't an admin
+ roles = client.listRolesByUserName(user3, user3);
+ assertEquals(1, roles.size());
+ // user can't get other's role list if he isn't an admin
+ try {
+ client.listRolesByUserName(user3, user2);
+ fail("SentryAccessDeniedException should be caught.");
+ } catch (SentryAccessDeniedException e) {
+ // excepted exception
+ }
+ // the user's name can't be empty
+ try {
+ client.listRolesByUserName(user3, "");
+ fail("SentryAccessDeniedException should be caught.");
+ } catch (SentryAccessDeniedException e) {
+ // excepted exception
+ }
+ client.revokeRoleFromUser(requestorUserName, user2, roleName3);
+ client.revokeRoleFromUsers(requestorUserName, roleName3, Sets.newHashSet(user4));
+ // test the result of revokeRoleFromUser() and revokeRoleFromUsers()
+ roles = client.listRolesByUserName(requestorUserName, user2);
+ assertEquals(1, roles.size());
+ for (TSentryRole role : roles) {
+ assertTrue(roleName2.equals(role.getRoleName()));
+ }
+ roles = client.listRolesByUserName(requestorUserName, user4);
+ assertEquals(0, roles.size());
+ }
+ });
+ }
+
+ @Test
+ public void testGranRevokePrivilegeForRoleWithUG() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+
+ // user1_1->group1
+ // user1_2->group1
+ // user2_1->group2
+ // user2_2->group2
+ // group1->r1
+ // group2->r2
+ // user1_1->r3
+ // user2_1->r4
+ String roleName1 = "r1";
+ String roleName2 = "r2";
+ String roleName3 = "r3";
+ String roleName4 = "r4";
+ String user1_1 = "u1_1";
+ String user1_2 = "u1_2";
+ String user2_1 = "u2_1";
+ String user2_2 = "u2_2";
+ String group1 = "g1";
+ String group2 = "g2";
+ Map<String, String> userToGroup = Maps.newHashMap();
+ userToGroup.put(user1_1, group1);
+ userToGroup.put(user1_2, group1);
+ userToGroup.put(user2_1, group2);
+ userToGroup.put(user2_2, user2_1);
+
+ Set<String> groupSet = Sets.newHashSet(group1);
+ setLocalGroupMapping(user1_1, groupSet);
+ setLocalGroupMapping(user1_2, groupSet);
+ groupSet = Sets.newHashSet(group2);
+ setLocalGroupMapping(user2_1, groupSet);
+ setLocalGroupMapping(user2_2, groupSet);
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName1);
+ client.dropRoleIfExists(requestorUserName, roleName2);
+ client.dropRoleIfExists(requestorUserName, roleName3);
+ client.dropRoleIfExists(requestorUserName, roleName4);
+ client.createRole(requestorUserName, roleName1);
+ client.createRole(requestorUserName, roleName2);
+ client.createRole(requestorUserName, roleName3);
+ client.createRole(requestorUserName, roleName4);
+
+ client.grantRoleToGroup(requestorUserName, group1, roleName1);
+ client.grantRoleToGroup(requestorUserName, group2, roleName2);
+ client.grantRoleToUser(requestorUserName, user1_1, roleName3);
+ client.grantRoleToUsers(requestorUserName, roleName4, Sets.newHashSet(user2_1));
+
+ client
+ .grantTablePrivilege(requestorUserName, roleName1, "server", "db1", "table1_1", "ALL");
+ client
+ .grantTablePrivilege(requestorUserName, roleName1, "server", "db1", "table1_2", "ALL");
+ client
+ .grantTablePrivilege(requestorUserName, roleName2, "server", "db1", "table2_1", "ALL");
+ client
+ .grantTablePrivilege(requestorUserName, roleName2, "server", "db1", "table2_2", "ALL");
+ client
+ .grantTablePrivilege(requestorUserName, roleName3, "server", "db1", "table3_1", "ALL");
+ client
+ .grantTablePrivilege(requestorUserName, roleName3, "server", "db1", "table3_2", "ALL");
+ client
+ .grantTablePrivilege(requestorUserName, roleName4, "server", "db1", "table4_1", "ALL");
+ client
+ .grantTablePrivilege(requestorUserName, roleName4, "server", "db1", "table4_2", "ALL");
+
+ Set<String> listPrivilegesForProvider = client.listPrivilegesForProvider(
+ Sets.newHashSet(group1), Sets.newHashSet(""), ActiveRoleSet.ALL, (Authorizable[]) null);
+ assertEquals("Privilege not correctly assigned to roles !!", Sets.newHashSet(
+ "server=server->db=db1->table=table1_1->action=all",
+ "server=server->db=db1->table=table1_2->action=all"), listPrivilegesForProvider);
+
+ listPrivilegesForProvider = client.listPrivilegesForProvider(
+ Sets.newHashSet(userToGroup.get(user1_2)),
+ Sets.newHashSet(user1_2), ActiveRoleSet.ALL, (Authorizable[]) null);
+ assertEquals("Privilege not correctly assigned to roles !!", Sets.newHashSet(
+ "server=server->db=db1->table=table1_1->action=all",
+ "server=server->db=db1->table=table1_2->action=all"), listPrivilegesForProvider);
+
+ listPrivilegesForProvider = client.listPrivilegesForProvider(
+ Sets.newHashSet(userToGroup.get(user1_1)),
+ Sets.newHashSet(user1_1), ActiveRoleSet.ALL, (Authorizable[]) null);
+ assertEquals("Privilege not correctly assigned to roles !!", Sets.newHashSet(
+ "server=server->db=db1->table=table1_1->action=all",
+ "server=server->db=db1->table=table1_2->action=all",
+ "server=server->db=db1->table=table3_1->action=all",
+ "server=server->db=db1->table=table3_2->action=all"), listPrivilegesForProvider);
+
+ listPrivilegesForProvider = client.listPrivilegesForProvider(Sets.newHashSet(group1),
+ Sets.newHashSet(user1_1, user1_2), ActiveRoleSet.ALL, (Authorizable[]) null);
+ assertEquals("Privilege not correctly assigned to roles !!", Sets.newHashSet(
+ "server=server->db=db1->table=table1_1->action=all",
+ "server=server->db=db1->table=table1_2->action=all",
+ "server=server->db=db1->table=table3_1->action=all",
+ "server=server->db=db1->table=table3_2->action=all"), listPrivilegesForProvider);
+
+ listPrivilegesForProvider = client.listPrivilegesForProvider(
+ Sets.newHashSet(group1, group2), Sets.newHashSet(user1_1, user1_2, user2_1, user2_2),
+ ActiveRoleSet.ALL, (Authorizable[]) null);
+ assertEquals("Privilege not correctly assigned to roles !!", Sets.newHashSet(
+ "server=server->db=db1->table=table1_1->action=all",
+ "server=server->db=db1->table=table1_2->action=all",
+ "server=server->db=db1->table=table2_1->action=all",
+ "server=server->db=db1->table=table2_2->action=all",
+ "server=server->db=db1->table=table3_1->action=all",
+ "server=server->db=db1->table=table3_2->action=all",
+ "server=server->db=db1->table=table4_1->action=all",
+ "server=server->db=db1->table=table4_2->action=all"), listPrivilegesForProvider);
+
+ client.revokeRoleFromUser(requestorUserName, user1_1, roleName3);
+ client.revokeRoleFromUsers(requestorUserName, roleName4, Sets.newHashSet(user2_1));
+ }
+ });
+ }
+
+ @Test
+ public void testMultipleRolesSamePrivilege() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+ String roleName1 = "admin_r1";
+ String roleName2 = "admin_r2";
+
+ client.dropRoleIfExists(requestorUserName, roleName1);
+ client.createRole(requestorUserName, roleName1);
+
+ client.dropRoleIfExists(requestorUserName, roleName2);
+ client.createRole(requestorUserName, roleName2);
+
+ client.grantTablePrivilege(requestorUserName, roleName1, "server", "db", "table", "ALL");
+ Set<TSentryPrivilege> listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
+ assertTrue("Privilege not assigned to role1 !!", listPrivilegesByRoleName.size() == 1);
+
+ client.grantTablePrivilege(requestorUserName, roleName2, "server", "db", "table", "ALL");
+ listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
+ assertTrue("Privilege not assigned to role2 !!", listPrivilegesByRoleName.size() == 1);
+ }});
+ }
+
+ @Test
+ public void testShowRoleGrant() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ String roleName = "admin_testdb";
+ String groupName = "group1";
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName);
+ client.createRole(requestorUserName, roleName);
+
+ Set<TSentryRole> roles = client.listAllRoles(requestorUserName);
+ assertEquals("Incorrect number of roles", 1, roles.size());
+
+ client.grantRoleToGroup(requestorUserName, groupName, roleName);
+ Set<TSentryRole> groupRoles = client.listRolesByGroupName(requestorUserName, groupName);
+ assertTrue(groupRoles.size() == 1);
+ for (TSentryRole role:groupRoles) {
+ assertTrue(role.getRoleName(), role.getRoleName().equalsIgnoreCase(roleName));
+ assertTrue(role.getGroups().size() == 1);
+ for (TSentryGroup group :role.getGroups()) {
+ assertTrue(group.getGroupName(), group.getGroupName().equalsIgnoreCase(groupName));
+ }
+ }
+
+ client.dropRole(requestorUserName, roleName);
+ }});
+ }
+
+ @Test
+ public void testShowGrant() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ String roleName = "admin_testdb";
+ String server = "server1";
+ String db = "testDB";
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName);
+ client.createRole(requestorUserName, roleName);
+
+ Set<TSentryRole> roles = client.listAllRoles(requestorUserName);
+ assertEquals("Incorrect number of roles", 1, roles.size());
+
+ client.grantDatabasePrivilege(requestorUserName, roleName, server, db, AccessConstants.ALL);
+ Set<TSentryPrivilege> privileges = client.listAllPrivilegesByRoleName(requestorUserName, roleName);
+ assertTrue(privileges.size() == 1);
+
+ client.revokeDatabasePrivilege(requestorUserName, roleName, server, db, AccessConstants.ALL);
+ client.dropRole(requestorUserName, roleName);
+ }});
+ }
+
+ //See SENTRY-166
+ @Test
+ public void testUriWithEquals() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ String roleName = "admin_testdb";
+ String server = "server1";
+ String uri = "file://u/w/h/t/partition=value/";
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ // Creating associated role
+ client.dropRoleIfExists(requestorUserName, roleName);
+ client.createRole(requestorUserName, roleName);
+ Set<TSentryRole> roles = client.listAllRoles(requestorUserName);
+ assertEquals("Incorrect number of roles", 1, roles.size());
+
+ client.grantURIPrivilege(requestorUserName, roleName, server, uri);
+ Set<TSentryPrivilege> privileges = client.listAllPrivilegesByRoleName(requestorUserName, roleName);
+ assertTrue(privileges.size() == 1);
+
+ // Revoking the same privilege
+ client.revokeURIPrivilege(requestorUserName, roleName, server, uri);
+ privileges = client.listAllPrivilegesByRoleName(requestorUserName, roleName);
+ assertTrue(privileges.size() == 0);
+
+ // Clean up
+ client.dropRole(requestorUserName, roleName);
+ }});
+ }
+
+
+ //See SENTRY-181
+ @Test
+ public void testSameGrantTwice() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+ String roleName = "admin_r1";
+
+ client.createRole(requestorUserName, roleName);
+ client.grantTablePrivilege(requestorUserName, roleName, "server", "db1", "table1", "ALL");
+ client.grantTablePrivilege(requestorUserName, roleName, "server", "db1", "table1", "ALL");
+ assertEquals(1, client.listAllPrivilegesByRoleName(requestorUserName, roleName).size());
+ }});
+ }
+
+ @Test
+ public void testGrantRevokeWithGrantOption() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ // Grant a privilege with Grant Option
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+ String roleName = "admin_r1";
+ boolean grantOption = true;
+ boolean withoutGrantOption = false;
+
+ client.dropRoleIfExists(requestorUserName, roleName);
+ client.createRole(requestorUserName, roleName);
+
+ client.grantTablePrivilege(requestorUserName, roleName, "server", "db1", "table1", "ALL", grantOption);
+ assertEquals(1, client.listAllPrivilegesByRoleName(requestorUserName, roleName).size());
+
+ // Try to revoke the privilege without grantOption and can't revoke the privilege.
+ client.revokeTablePrivilege(requestorUserName, roleName, "server", "db1", "table1", "ALL", withoutGrantOption);
+ assertEquals(1, client.listAllPrivilegesByRoleName(requestorUserName, roleName).size());
+
+ // Try to revoke the privilege with grantOption, the privilege will be revoked.
+ client.revokeTablePrivilege(requestorUserName, roleName, "server", "db1", "table1", "ALL", grantOption);
+ assertEquals(0, client.listAllPrivilegesByRoleName(requestorUserName, roleName).size());
+ }});
+ }
+
+ @Test
+ public void testGrantTwoPrivilegeDiffInGrantOption() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ // Grant a privilege with 'Grant Option'.
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+ String roleName = "admin_r1";
+ boolean grantOption = true;
+ boolean withoutGrantOption = false;
+
+ client.dropRoleIfExists(requestorUserName, roleName);
+ client.createRole(requestorUserName, roleName);
+
+ client.grantTablePrivilege(requestorUserName, roleName, "server", "db1", "table1", "ALL", grantOption);
+ assertEquals(1, client.listAllPrivilegesByRoleName(requestorUserName, roleName).size());
+
+ // Grant a privilege without 'Grant Option'.
+ client.grantTablePrivilege(requestorUserName, roleName, "server", "db1", "table1", "ALL", withoutGrantOption);
+ assertEquals(2, client.listAllPrivilegesByRoleName(requestorUserName, roleName).size());
+
+ // Use 'grantOption = null', the two privileges will be revoked.
+ client.revokeTablePrivilege(requestorUserName, roleName, "server", "db1", "table1", "ALL", null);
+ assertEquals(0, client.listAllPrivilegesByRoleName(requestorUserName, roleName).size());
+ }});
+ }
+
+ @Test
+ public void testGranRevokePrivilegeOnColumnForRole() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+ String roleName1 = "admin_r1";
+ String roleName2 = "admin_r2";
+
+ client.dropRoleIfExists(requestorUserName, roleName1);
+ client.createRole(requestorUserName, roleName1);
+
+ client.grantColumnPrivilege(requestorUserName, roleName1, "server", "db1", "table1", "col1", "ALL");
+ client.grantColumnPrivilege(requestorUserName, roleName1, "server", "db1", "table1", "col2", "ALL");
+ client.grantColumnPrivilege(requestorUserName, roleName1, "server", "db1", "table2", "col1", "ALL");
+ client.grantColumnPrivilege(requestorUserName, roleName1, "server", "db1", "table2", "col2", "ALL");
+ client.grantColumnPrivilege(requestorUserName, roleName1, "server", "db2", "table1", "col1", "ALL");
+ client.grantColumnPrivilege(requestorUserName, roleName1, "server", "db2", "table2", "col1", "ALL");
+
+
+ client.dropRoleIfExists(requestorUserName, roleName2);
+ client.createRole(requestorUserName, roleName2);
+
+ client.grantColumnPrivilege(requestorUserName, roleName2, "server", "db1", "table1", "col1", "ALL");
+ client.grantColumnPrivilege(requestorUserName, roleName2, "server", "db1", "table1", "col2", "ALL");
+ client.grantColumnPrivilege(requestorUserName, roleName2, "server", "db1", "table2", "col1", "ALL");
+ client.grantColumnPrivilege(requestorUserName, roleName2, "server", "db1", "table2", "col2", "ALL");
+ client.grantColumnPrivilege(requestorUserName, roleName2, "server", "db2", "table1", "col1", "ALL");
+ client.grantColumnPrivilege(requestorUserName, roleName2, "server", "db2", "table2", "col1", "ALL");
+
+ Set<TSentryPrivilege> listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
+ assertEquals("Privilege not assigned to role1 !!", 6, listPrivilegesByRoleName.size());
+
+ listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
+ assertEquals("Privilege not assigned to role2 !!", 6, listPrivilegesByRoleName.size());
+
+
+ client.revokeColumnPrivilege(requestorUserName, roleName1, "server", "db1", "table1", "col1", "ALL");
+ listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
+ assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 5);
+ listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
+ assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 6);
+
+ client.revokeTablePrivilege(requestorUserName, roleName2, "server", "db1", "table1", "ALL");
+ listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
+ assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 4);
+ listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
+ assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 5);
+
+ client.revokeDatabasePrivilege(requestorUserName, roleName1, "server", "db1", "ALL");
+ listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
+ assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 2);
+ client.revokeColumnPrivilege(requestorUserName, roleName1, "server", "db2", "table1", "col1", "ALL");
+ client.revokeColumnPrivilege(requestorUserName, roleName1, "server", "db2", "table2", "col1", "ALL");
+ listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
+ assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 0);
+
+ client.revokeColumnPrivilege(requestorUserName, roleName2, "server", "db1", "table2", "col1", "ALL");
+ client.revokeColumnPrivilege(requestorUserName, roleName2, "server", "db1", "table2", "col2", "ALL");
+ client.revokeColumnPrivilege(requestorUserName, roleName2, "server", "db2", "table1", "col1", "ALL");
+ client.revokeColumnPrivilege(requestorUserName, roleName2, "server", "db2", "table2", "col1", "ALL");
+ listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2);
+ assertTrue("Privilege not correctly revoked !!", listPrivilegesByRoleName.size() == 0);
+ }});
+ }
+
+ @Test
+ public void testListByAuthDB() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ String roleName1 = "role1";
+ String roleName2 = "role2";
+ Set<String> testRoleSet = Sets.newHashSet(roleName1, roleName2);
+ String group1 = "group1";
+ String group2 = "group2";
+ Set<String> testGroupSet = Sets.newHashSet(group1, group2);
+ String server = "server1";
+ String db = "testDB";
+ String db2 = "testDB2";
+ String tab = "testTab";
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ String group1user = "group1user";
+ setLocalGroupMapping(group1user, Sets.newHashSet(group1));
+ String group2user = "group2user";
+ setLocalGroupMapping(group2user, Sets.newHashSet(group2));
+ setLocalGroupMapping("random", Sets.newHashSet("foo"));
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName1);
+ client.createRole(requestorUserName, roleName1);
+ client.dropRoleIfExists(requestorUserName, roleName2);
+ client.createRole(requestorUserName, roleName2);
+
+ TSentryPrivilege role1db1 = client.grantDatabasePrivilege(
+ requestorUserName, roleName1, server, db, AccessConstants.SELECT);
+ client.grantTablePrivilege(requestorUserName, roleName1, server, db, tab,
+ AccessConstants.ALL);
+ client.grantTablePrivilege(requestorUserName, roleName1, server, db2, tab,
+ AccessConstants.SELECT);
+ client.grantURIPrivilege(requestorUserName, roleName1, server, "hdfs:///fooUri");
+ client.grantRoleToGroup(requestorUserName, group1, roleName1);
+
+ TSentryPrivilege role2db1 = client.grantDatabasePrivilege(
+ requestorUserName, roleName2, server, db,
+ AccessConstants.ALL);
+ client.grantDatabasePrivilege(requestorUserName, roleName2, server, db2,
+ AccessConstants.SELECT);
+ client.grantTablePrivilege(requestorUserName, roleName2, server, db2, tab,
+ AccessConstants.ALL);
+ client.grantRoleToGroup(requestorUserName, group2, roleName2);
+
+ // build expected output
+ TSentryPrivilegeMap db1RoleToPrivMap = new TSentryPrivilegeMap(
+ new TreeMap<String, Set<TSentryPrivilege>>());
+ db1RoleToPrivMap.getPrivilegeMap()
+ .put(roleName1, Sets.newHashSet(role1db1));
+ db1RoleToPrivMap.getPrivilegeMap()
+ .put(roleName2, Sets.newHashSet(role2db1));
+ Map<TSentryAuthorizable, TSentryPrivilegeMap> expectedResults = Maps
+ .newTreeMap();
+ List<? extends Authorizable> db1Authrizable = Lists.newArrayList(
+ new Server(server), new Database(db));
+ expectedResults.put(
+ SentryPolicyServiceClientDefaultImpl.setupSentryAuthorizable(db1Authrizable),
+ db1RoleToPrivMap);
+
+ Set<List<? extends Authorizable>> authorizableSet = Sets.newHashSet();
+ authorizableSet.add(db1Authrizable);
+
+ // verify for null group and null roleset
+ Map<TSentryAuthorizable, TSentryPrivilegeMap> authPrivMap = client
+ .listPrivilegsbyAuthorizable(requestorUserName, authorizableSet, null, null);
+ assertEquals(expectedResults, authPrivMap);
+
+ // verify for null group and specific roleset
+ authPrivMap = client.listPrivilegsbyAuthorizable(requestorUserName, authorizableSet,
+ null, new ActiveRoleSet(testRoleSet));
+ assertEquals(expectedResults, authPrivMap);
+
+ // verify for null group and specific roleset
+ authPrivMap = client.listPrivilegsbyAuthorizable(requestorUserName, authorizableSet, null,
+ ActiveRoleSet.ALL);
+ assertEquals(expectedResults, authPrivMap);
+
+ // verify for specific group and null roleset
+ authPrivMap = client.listPrivilegsbyAuthorizable(requestorUserName, authorizableSet,
+ testGroupSet, null);
+ assertEquals(expectedResults, authPrivMap);
+
+ // verify for specific group and specific roleset
+ authPrivMap = client.listPrivilegsbyAuthorizable(requestorUserName, authorizableSet,
+ testGroupSet, new ActiveRoleSet(testRoleSet));
+ assertEquals(expectedResults, authPrivMap);
+
+ // verify for specific group and ALL roleset
+ authPrivMap = client.listPrivilegsbyAuthorizable(requestorUserName, authorizableSet,
+ testGroupSet, ActiveRoleSet.ALL);
+ assertEquals(expectedResults, authPrivMap);
+
+ // verify users not belonging to any group are not shown anything
+ authPrivMap = client
+ .listPrivilegsbyAuthorizable("random", authorizableSet,
+ new HashSet<String>(), ActiveRoleSet.ALL);
+ expectedResults.clear();
+ expectedResults.put(
+ SentryPolicyServiceClientDefaultImpl.setupSentryAuthorizable(db1Authrizable),
+ new TSentryPrivilegeMap(new HashMap<String, Set<TSentryPrivilege>>()));
+ assertEquals(expectedResults, authPrivMap);
+ }});
+ }
+
+ @Test
+ public void testListByAuthTab() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ String roleName1 = "role1";
+ String roleName2 = "role2";
+ String server = "server1";
+ String db = "testDB";
+ String db2 = "testDB2";
+ String tab = "testTab";
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName1);
+ client.createRole(requestorUserName, roleName1);
+ client.dropRoleIfExists(requestorUserName, roleName2);
+ client.createRole(requestorUserName, roleName2);
+
+ client.grantDatabasePrivilege(
+ requestorUserName, roleName1, server, db, AccessConstants.SELECT);
+ client.grantTablePrivilege(requestorUserName, roleName1, server, db, tab,
+ AccessConstants.ALL);
+ TSentryPrivilege role1db2tab = client.grantTablePrivilege(
+ requestorUserName, roleName1, server, db2, tab,
+ AccessConstants.SELECT);
+
+ client.grantDatabasePrivilege(
+ requestorUserName, roleName2, server, db,
+ AccessConstants.ALL);
+ client.grantDatabasePrivilege(requestorUserName, roleName2, server, db2,
+ AccessConstants.SELECT);
+ TSentryPrivilege role2db2tab = client.grantTablePrivilege(
+ requestorUserName, roleName2, server, db2, tab,
+ AccessConstants.ALL);
+ client.grantURIPrivilege(requestorUserName, roleName1, server,
+ "hdfs:///fooUri");
+
+ // build expected output
+ TSentryPrivilegeMap db1RoleToPrivMap = new TSentryPrivilegeMap(
+ new TreeMap<String, Set<TSentryPrivilege>>());
+ db1RoleToPrivMap.getPrivilegeMap().put(roleName1,
+ Sets.newHashSet(role1db2tab));
+ db1RoleToPrivMap.getPrivilegeMap().put(roleName2,
+ Sets.newHashSet(role2db2tab));
+ Map<TSentryAuthorizable, TSentryPrivilegeMap> expectedResults = Maps
+ .newTreeMap();
+ List<? extends Authorizable> db2TabAuthrizable = Lists.newArrayList(
+ new Server(server), new Database(db2), new Table(tab));
+ expectedResults.put(
+ SentryPolicyServiceClientDefaultImpl.setupSentryAuthorizable(db2TabAuthrizable),
+ db1RoleToPrivMap);
+
+ Set<List<? extends Authorizable>> authorizableSet = Sets.newHashSet();
+ authorizableSet.add(db2TabAuthrizable);
+ Map<TSentryAuthorizable, TSentryPrivilegeMap> authPrivMap = client
+ .listPrivilegsbyAuthorizable(requestorUserName, authorizableSet, null, null);
+
+ assertEquals(expectedResults, authPrivMap);
+ }});
+ }
+
+ @Test
+ public void testListByAuthUri() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ String roleName1 = "role1";
+ String roleName2 = "role2";
+ String server = "server1";
+ String db = "testDB";
+ String db2 = "testDB2";
+ String tab = "testTab";
+ String uri1 = "hdfs:///fooUri";
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName1);
+ client.createRole(requestorUserName, roleName1);
+ client.dropRoleIfExists(requestorUserName, roleName2);
+ client.createRole(requestorUserName, roleName2);
+
+ client.grantDatabasePrivilege(requestorUserName, roleName1, server, db,
+ AccessConstants.SELECT);
+ client.grantTablePrivilege(requestorUserName, roleName1, server, db, tab,
+ AccessConstants.ALL);
+ client.grantTablePrivilege(requestorUserName, roleName1, server, db2, tab,
+ AccessConstants.SELECT);
+ TSentryPrivilege role1uri1 = client.grantURIPrivilege(requestorUserName,
+ roleName1, server, uri1);
+
+ client.grantDatabasePrivilege(requestorUserName, roleName2, server, db,
+ AccessConstants.ALL);
+ client.grantDatabasePrivilege(requestorUserName, roleName2, server, db2,
+ AccessConstants.SELECT);
+ client.grantTablePrivilege(requestorUserName, roleName2, server, db2, tab,
+ AccessConstants.ALL);
+ TSentryPrivilege role2uri2 = client.grantURIPrivilege(requestorUserName,
+ roleName2, server, uri1);
+
+ // build expected output
+ TSentryPrivilegeMap db1RoleToPrivMap = new TSentryPrivilegeMap(
+ new TreeMap<String, Set<TSentryPrivilege>>());
+ db1RoleToPrivMap.getPrivilegeMap().put(roleName1,
+ Sets.newHashSet(role1uri1));
+ db1RoleToPrivMap.getPrivilegeMap().put(roleName2,
+ Sets.newHashSet(role2uri2));
+ Map<TSentryAuthorizable, TSentryPrivilegeMap> expectedResults = Maps
+ .newTreeMap();
+ List<? extends Authorizable> uri1Authrizable = Lists.newArrayList(
+ new Server(server), new AccessURI(uri1));
+ expectedResults.put(
+ SentryPolicyServiceClientDefaultImpl.setupSentryAuthorizable(uri1Authrizable),
+ db1RoleToPrivMap);
+
+ Set<List<? extends Authorizable>> authorizableSet = Sets.newHashSet();
+ authorizableSet.add(uri1Authrizable);
+ Map<TSentryAuthorizable, TSentryPrivilegeMap> authPrivMap = client
+ .listPrivilegsbyAuthorizable(requestorUserName, authorizableSet, null, null);
+
+ assertEquals(expectedResults, authPrivMap);
+ }});
+ }
+
+ /**
+ * List privileges by authorizables executed by non-admin user
+ * Test various positive and negative cases for non-admin user
+ * @throws Exception
+ */
+ @Test
+ public void testListByAuthTabForNonAdmin() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ String user1 = "user1";
+ String group1 = "group1";
+ String group2 = "group2";
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ Set<String> userGroupNames1 = Sets.newHashSet(group1);
+ Set<String> userGroupNames2 = Sets.newHashSet(group2);
+ String roleName1 = "role1";
+ String roleName2 = "role2";
+ String server = "server1";
+ String db = "testDB";
+ String db2 = "testDB2";
+ String tab = "testTab";
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ setLocalGroupMapping(user1, userGroupNames1);
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName1);
+ client.createRole(requestorUserName, roleName1);
+ client.dropRoleIfExists(requestorUserName, roleName2);
+ client.createRole(requestorUserName, roleName2);
+
+ client.grantDatabasePrivilege(requestorUserName, roleName1, server, db,
+ AccessConstants.SELECT);
+ client.grantTablePrivilege(requestorUserName, roleName1, server, db, tab,
+ AccessConstants.ALL);
+ TSentryPrivilege role1db2tab = client.grantTablePrivilege(
+ requestorUserName, roleName1, server, db2, tab, AccessConstants.SELECT);
+ client.grantRoleToGroup(requestorUserName, group1, roleName1);
+
+ client.grantDatabasePrivilege(requestorUserName, roleName2, server, db,
+ AccessConstants.ALL);
+ client.grantDatabasePrivilege(requestorUserName, roleName2, server, db2,
+ AccessConstants.SELECT);
+ client.grantTablePrivilege(requestorUserName, roleName2, server, db2, tab,
+ AccessConstants.ALL);
+ client.grantURIPrivilege(requestorUserName, roleName1, server,
+ "hdfs:///fooUri");
+
+ // build expected output. user1 should see privileges on tab1 from role1
+ TSentryPrivilegeMap db1RoleToPrivMap = new TSentryPrivilegeMap(
+ new TreeMap<String, Set<TSentryPrivilege>>());
+ db1RoleToPrivMap.getPrivilegeMap().put(roleName1, Sets.newHashSet(role1db2tab));
+ Map<TSentryAuthorizable, TSentryPrivilegeMap> expectedResults = Maps.newTreeMap();
+ List<? extends Authorizable> db2TabAuthorizable = Lists.newArrayList(
+ new Server(server), new Database(db2), new Table(tab));
+ expectedResults.put(
+ SentryPolicyServiceClientDefaultImpl.setupSentryAuthorizable(db2TabAuthorizable),
+ db1RoleToPrivMap);
+
+ Set<List<? extends Authorizable>> authorizableSet = Sets.newHashSet();
+ authorizableSet.add(db2TabAuthorizable);
+
+ // list privileges with null group and roles
+ Map<TSentryAuthorizable, TSentryPrivilegeMap> authPrivMap = client
+ .listPrivilegsbyAuthorizable(user1, authorizableSet, null, null);
+ assertEquals(expectedResults, authPrivMap);
+
+ // list privileges with empty group set and null roles
+ authPrivMap = client.listPrivilegsbyAuthorizable(user1, authorizableSet,
+ new HashSet<String>(), null);
+ assertEquals(expectedResults, authPrivMap);
+
+ // list privileges with null group set and ALL roleset
+ authPrivMap = client.listPrivilegsbyAuthorizable(user1, authorizableSet,
+ null, new ActiveRoleSet(true));
+ assertEquals(expectedResults, authPrivMap);
+
+ // list privileges with user1's group set and null roles
+ authPrivMap = client.listPrivilegsbyAuthorizable(user1, authorizableSet,
+ userGroupNames1, null);
+ assertEquals(expectedResults, authPrivMap);
+
+ // list privileges with user1's group set and ALL roles
+ authPrivMap = client.listPrivilegsbyAuthorizable(user1, authorizableSet,
+ userGroupNames1, new ActiveRoleSet(true));
+ assertEquals(expectedResults, authPrivMap);
+
+ // list privileges with null group and user's specific roles with uppercase name
+ authPrivMap = client.listPrivilegsbyAuthorizable(user1, authorizableSet,
+ null, new ActiveRoleSet(Sets.newHashSet(roleName1.toUpperCase())));
+ assertEquals(expectedResults, authPrivMap);
+
+ // verify that user1 can't query group2
+ try {
+ client.listPrivilegsbyAuthorizable(user1, authorizableSet, userGroupNames2, null);
+ fail("listPrivilegsbyAuthorizable() should fail for user1 accessing " + group2);
+ } catch (SentryAccessDeniedException e) {
+ // expected
+ }
+
+ // verify that user1 can't query role2
+ ActiveRoleSet roleSet2 = new ActiveRoleSet(Sets.newHashSet(roleName2));
+ try {
+ client.listPrivilegsbyAuthorizable(user1, authorizableSet, null, roleSet2);
+ fail("listPrivilegsbyAuthorizable() should fail for user1 accessing " + roleName2);
+ } catch (SentryAccessDeniedException e) {
+ // expected
+ }
+ }});
+ }
+
+ /**
+ * Attempt to access a configuration value that is forbidden in getConfigVal
+ * @param configVal The banned value
+ * @param defaultVal A default to pass to getConfigValue
+ * @throws Exception
+ */
+ private void checkBannedConfigVal(final String configVal, final String defaultVal)
+ throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ try {
+ client.getConfigValue(configVal, defaultVal);
+ fail("Attempt to access " + configVal + " succeeded");
+ } catch (SentryAccessDeniedException e) {
+ assertTrue(e.toString().contains("was denied"));
+ assertTrue(e.toString().contains(configVal));
+ }
+ }});
+ }
+
+ @Test
+ public void testGetConfigVal() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ String val;
+
+ // Basic success case
+ val = client.getConfigValue("sentry.service.admin.group", "xxx");
+ assertEquals(val, "admin_group");
+
+ // Undefined value gets the default back
+ val = client.getConfigValue("sentry.this.is.not.defined", "hello");
+ assertEquals(val, "hello");
+
+ // Undefined value and null default gets null back
+ val = client.getConfigValue("sentry.this.is.not.defined", null);
+ assertEquals(val, null);
+
+ // Known config value with null default works as expected
+ val = client.getConfigValue("sentry.service.admin.group", null);
+ assertEquals(val, "admin_group");
+
+ // Value that is forbidden (anything not starting with "sentry") dies
+ checkBannedConfigVal("notsentry", "xxx");
+
+ // Ditto with a null default
+ checkBannedConfigVal("notsentry", null);
+
+ // Values with .jdbc. are forbidden
+ checkBannedConfigVal("sentry.xxx.jdbc.xxx", null);
+
+ // Values with password are forbidden
+ checkBannedConfigVal("sentry.xxx.password", null);
+
+ // Attempt to get the location of the keytab also fails
+ checkBannedConfigVal("sentry.service.server.keytab", null);
+
+ }});
+ }
+
+ /* SENTRY-841 */
+ @Test
+ public void testGranRevokePrivilegeOnServerForRole() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ String roleName1 = "admin_r1";
+
+ client.dropRoleIfExists(requestorUserName, roleName1);
+ client.createRole(requestorUserName, roleName1);
+
+ client.grantServerPrivilege(requestorUserName, roleName1, "server", false);
+
+ Set<TSentryPrivilege> listPrivs = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
+ assertTrue("Privilege should be all:",listPrivs.iterator().next().getAction().equals("*"));
+
+ client.revokeServerPrivilege(requestorUserName, roleName1, "server", false);
+ listPrivs = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
+ assertTrue("Privilege not correctly revoked !!", listPrivs.size() == 0);
+
+ }});
+ }
+
+ @Test
+ public void testGranRevokePrivilegeWithoutAction() throws Exception {
+ runTestAsSubject(new TestOperation(){
+ @Override
+ public void runTestAsSubject() throws Exception {
+ String requestorUserName = ADMIN_USER;
+ String roleName1 = "admin_r1";
+ Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+ setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
+ writePolicyFile();
+
+ client.dropRoleIfExists(requestorUserName, roleName1);
+ client.createRole(requestorUserName, roleName1);
+ client.grantServerPrivilege(requestorUserName, roleName1, "server1", false);
+
+ Set<TSentryPrivilege> listPrivs = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
+ assertTrue("Privilege should be all:", listPrivs.iterator().next().getAction().equals("*"));
+
+ client.revokeServerPrivilege(requestorUserName, roleName1, "server1", "ALL", false);
+ listPrivs = client.listAllPrivilegesByRoleName(requestorUserName, roleName1);
+ assertTrue("Privilege not correctly revoked !!", listPrivs.size() == 0);
+
+ }});
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceMetrics.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceMetrics.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceMetrics.java
new file mode 100644
index 0000000..55c8c82
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceMetrics.java
@@ -0,0 +1,86 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless createRequired by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sentry.api.service.thrift;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.hadoop.security.authentication.client.AuthenticatedURL;
+import org.apache.hadoop.security.authentication.client.KerberosAuthenticator;
+import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+import org.apache.sentry.service.thrift.SentryWebMetricParser;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.security.PrivilegedExceptionAction;
+
+public class TestSentryServiceMetrics extends SentryServiceIntegrationBase {
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ kerberos = true;
+ webServerEnabled = true;
+ webSecurity = true;
+ setupConf();
+ startSentryService();
+ }
+
+ //Overriding this method as the tests do not require a client handle
+ @Override
+ @Before
+ public void before() throws Exception {
+
+ }
+ /* SENTRY-1319 */
+ @Test
+ public void testSentryServiceGauges() throws Throwable {
+ //More Cases to be added once Sentry HA is implemented
+
+ //Check for gauges with the server handle.
+ Assert.assertEquals(Boolean.TRUE,server.getIsActiveGauge().getValue());
+ }
+
+ @Test
+ public void testMetricsWeb() throws Exception {
+ clientUgi.doAs(new PrivilegedExceptionAction<Void>() {
+ @Override
+ public Void run() throws Exception {
+ final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/metrics");
+ HttpURLConnection conn = new AuthenticatedURL(new KerberosAuthenticator()).
+ openConnection(url, new AuthenticatedURL.Token());
+ //make sure we are able to access the metrics page
+ Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
+ String response = IOUtils.toString(conn.getInputStream());
+ SentryWebMetricParser mp = new SentryWebMetricParser(response);
+ Assert.assertEquals(Boolean.FALSE,mp.isHA());
+ Assert.assertEquals(Boolean.TRUE,mp.isActive());
+ return null;
+ }} );
+ }
+
+ //Overriding this method as the client handle does not exist.
+ @Override
+ @After
+ public void after() {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceWithInvalidMsgSize.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceWithInvalidMsgSize.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceWithInvalidMsgSize.java
new file mode 100644
index 0000000..8ac6308
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceWithInvalidMsgSize.java
@@ -0,0 +1,122 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.service.thrift;
+
+import com.google.common.collect.Sets;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.sentry.api.common.ApiConstants;
+import org.apache.sentry.core.common.exception.SentryUserException;
+import org.apache.sentry.service.thrift.SentryServiceClientFactory;
+import org.apache.sentry.service.thrift.SentryServiceFactory;
+import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+import org.apache.sentry.service.common.ServiceConstants;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Set;
+
+/**
+ * Test sentry service with a larger message size than the server's or client's thrift max message size.
+ */
+public class TestSentryServiceWithInvalidMsgSize extends SentryServiceIntegrationBase {
+ private final Set<String> REQUESTER_USER_GROUP_NAMES = Sets.newHashSet(ADMIN_GROUP);
+ private final String ROLE_NAME = "admin_r";
+
+ /**
+ * Test the case when the message size is larger than the client's thrift max message size.
+ */
+ @Test
+ public void testClientWithSmallMaxMsgSize() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ SentryServiceClientFactory oldFactory = SentryServiceClientFactory.factoryReset(null);
+ Configuration confWithSmallMaxMsgSize = new Configuration(conf);
+ confWithSmallMaxMsgSize.setLong(ApiConstants.ClientConfig.SENTRY_POLICY_CLIENT_THRIFT_MAX_MESSAGE_SIZE, 20);
+ // create a client with a small thrift max message size
+ SentryPolicyServiceClient clientWithSmallMaxMsgSize = SentryServiceClientFactory.create(confWithSmallMaxMsgSize);
+
+ setLocalGroupMapping(ADMIN_USER, REQUESTER_USER_GROUP_NAMES);
+ writePolicyFile();
+
+ boolean exceptionThrown = false;
+ try {
+ // client throws exception when message size is larger than the client's thrift max message size.
+ clientWithSmallMaxMsgSize.listAllRoles(ADMIN_USER);
+ } catch (SentryUserException e) {
+ exceptionThrown = true;
+ Assert.assertTrue(e.getMessage().contains("Thrift exception occurred"));
+ Assert.assertTrue(e.getCause().getMessage().contains("Length exceeded max allowed"));
+ } finally {
+ Assert.assertEquals(true, exceptionThrown);
+ clientWithSmallMaxMsgSize.close();
+ SentryServiceClientFactory.factoryReset(oldFactory);
+ }
+
+ // client can still talk with sentry server when message size is smaller.
+ client.dropRoleIfExists(ADMIN_USER, ROLE_NAME);
+ client.listAllRoles(ADMIN_USER);
+ client.createRole(ADMIN_USER, ROLE_NAME);
+ client.listAllRoles(ADMIN_USER);
+ }
+ });
+ }
+
+ /**
+ * Test the case when the message size is larger than the server's thrift max message size.
+ */
+ @Test
+ public void testServerWithSmallMaxMsgSize() throws Exception {
+ runTestAsSubject(new TestOperation() {
+ @Override
+ public void runTestAsSubject() throws Exception {
+ Configuration confWithSmallMaxMsgSize = new Configuration(conf);
+ confWithSmallMaxMsgSize.setLong(ServiceConstants.ServerConfig.SENTRY_POLICY_SERVER_THRIFT_MAX_MESSAGE_SIZE,
+ 50);
+ stopSentryService();
+
+ // create a server with a small max thrift message size
+ server = SentryServiceFactory.create(confWithSmallMaxMsgSize);
+ startSentryService();
+
+ setLocalGroupMapping(ADMIN_USER, REQUESTER_USER_GROUP_NAMES);
+ writePolicyFile();
+
+ // client can talk with server when message size is smaller.
+ client.listAllRoles(ADMIN_USER);
+ client.createRole(ADMIN_USER, ROLE_NAME);
+
+ boolean exceptionThrown = false;
+ try {
+ // client throws exception when message size is larger than the server's thrift max message size.
+ client.grantServerPrivilege(ADMIN_USER, ROLE_NAME, "server", false);
+ } catch (SentryUserException e) {
+ exceptionThrown = true;
+ Assert.assertTrue(e.getCause().getMessage().contains("org.apache.thrift.transport.TTransportException"));
+ } finally {
+ Assert.assertEquals(true, exceptionThrown);
+ }
+
+ // client can still talk with sentry server when message size is smaller.
+ Set<TSentryRole> roles = client.listAllRoles(ADMIN_USER);
+ Assert.assertTrue(roles.size() == 1);
+ Assert.assertEquals(ROLE_NAME, roles.iterator().next().getRoleName());
+ }
+ });
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceWithKerberos.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceWithKerberos.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceWithKerberos.java
new file mode 100644
index 0000000..eff051b
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryServiceWithKerberos.java
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.service.thrift;
+
+import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test various kerberos related stuff on the SentryService side
+ */
+public class TestSentryServiceWithKerberos extends SentryServiceIntegrationBase {
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ SERVER_KERBEROS_NAME = "sentry/_HOST@" + REALM;
+ SentryServiceIntegrationBase.setup();
+ }
+
+ @Override
+ @Before
+ public void before() throws Exception {
+ }
+
+ @Override
+ @After
+ public void after() {
+ }
+
+ /**
+ * Test that we are correctly substituting "_HOST" if/when needed.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testHostSubstitution() throws Exception {
+ // We just need to ensure that we are able to correct connect to the server
+ connectToSentryService();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryWebServerWithKerberos.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryWebServerWithKerberos.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryWebServerWithKerberos.java
new file mode 100644
index 0000000..3cc9a9d
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryWebServerWithKerberos.java
@@ -0,0 +1,175 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.service.thrift;
+
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.security.PrivilegedExceptionAction;
+import java.util.HashSet;
+
+import javax.security.auth.Subject;
+import javax.security.auth.kerberos.KerberosPrincipal;
+import javax.security.auth.login.LoginContext;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.hadoop.security.authentication.client.AuthenticatedURL;
+import org.apache.hadoop.security.authentication.client.AuthenticationException;
+import org.apache.hadoop.security.authentication.client.KerberosAuthenticator;
+import org.apache.sentry.service.thrift.KerberosConfiguration;
+import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Sets;
+
+public class TestSentryWebServerWithKerberos extends SentryServiceIntegrationBase {
+
+ private static Logger LOG = LoggerFactory.getLogger(TestSentryWebServerWithKerberos.class);
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ webServerEnabled = true;
+ webSecurity = true;
+ SentryServiceIntegrationBase.setup();
+ }
+
+ @Override
+ @Before
+ public void before() throws Exception {
+ }
+
+ @Override
+ @After
+ public void after() {
+ }
+
+ @Test
+ public void testPing() throws Exception {
+ clientUgi.doAs(new PrivilegedExceptionAction<Void>() {
+ @Override
+ public Void run() throws Exception {
+ final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/ping");
+ HttpURLConnection conn = new AuthenticatedURL(new KerberosAuthenticator()).
+ openConnection(url, new AuthenticatedURL.Token());
+ Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
+ String response = IOUtils.toString(conn.getInputStream());
+ Assert.assertEquals("pong\n", response);
+ return null;
+ }} );
+ }
+
+ @Test
+ public void testPingWithoutSubject() throws Exception {
+ final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/ping");
+ try {
+ new AuthenticatedURL(new KerberosAuthenticator()).openConnection(url, new AuthenticatedURL.Token());
+ fail("Here should fail.");
+ } catch (Exception e) {
+ boolean isExpectError = e.getMessage().contains("No valid credentials provided");
+ Assert.assertTrue("Here should fail by 'No valid credentials provided'," +
+ " but the exception is:" + e, isExpectError);
+ }
+ }
+
+ @Test
+ public void testPingUsingHttpURLConnection() throws Exception {
+ final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/ping");
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ Assert.assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, conn.getResponseCode());
+ String errorMessage = IOUtils.toString(conn.getErrorStream());
+ Assert.assertTrue(errorMessage.contains("Authentication required"));
+ }
+
+ @Test
+ public void testPingWithUnauthorizedUser() throws Exception {
+ // create an unauthorized User with Kerberos
+ String userPrinciple = "user/" + SERVER_HOST;
+ String userKerberosName = userPrinciple + "@" + REALM;
+ Subject userSubject = new Subject(false, Sets.newHashSet(
+ new KerberosPrincipal(userKerberosName)), new HashSet<Object>(),new HashSet<Object>());
+ File userKeytab = new File(kdcWorkDir, "user.keytab");
+ kdc.createPrincipal(userKeytab, userPrinciple);
+ LoginContext userLoginContext = new LoginContext("", userSubject, null,
+ KerberosConfiguration.createClientConfig(userKerberosName, userKeytab));
+ userLoginContext.login();
+ Subject.doAs(userLoginContext.getSubject(), new PrivilegedExceptionAction<Void>() {
+ @Override
+ public Void run() throws Exception {
+ final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/ping");
+ try {
+ new AuthenticatedURL(new KerberosAuthenticator()).openConnection(url, new AuthenticatedURL.Token());
+ fail("Here should fail.");
+ } catch (AuthenticationException e) {
+ String expectedError = "status code: 403";
+ if (!e.getMessage().contains(expectedError)) {
+ LOG.error("UnexpectedError: " + e.getMessage(), e);
+ fail("UnexpectedError: " + e.getMessage());
+ }
+ }
+ return null;
+ }
+ });
+ }
+
+ @Test
+ public void testPingWithCaseSensitiveUser() throws Exception {
+ // USER1 is present in the list of users who are allowed to connect to sentry web ui.
+ String userPrinciple = "user1/" + SERVER_HOST;
+ String userKerberosName = userPrinciple + "@" + REALM;
+ Subject userSubject = new Subject(false, Sets.newHashSet(
+ new KerberosPrincipal(userKerberosName)), new HashSet<Object>(),new HashSet<Object>());
+ File userKeytab = new File(kdcWorkDir, "user1.keytab");
+ kdc.createPrincipal(userKeytab, userPrinciple);
+ LoginContext userLoginContext = new LoginContext("", userSubject, null,
+ KerberosConfiguration.createClientConfig(userKerberosName, userKeytab));
+ userLoginContext.login();
+ Subject.doAs(userLoginContext.getSubject(), new PrivilegedExceptionAction<Void>() {
+ @Override
+ public Void run() throws Exception {
+ final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/ping");
+ try {
+ new AuthenticatedURL(new KerberosAuthenticator()).openConnection(url, new AuthenticatedURL.Token());
+ fail("Login with user1 should fail");
+ } catch (AuthenticationException e) {
+ String expectedError = "status code: 403";
+ if (!e.getMessage().contains(expectedError)) {
+ LOG.error("UnexpectedError: " + e.getMessage(), e);
+ fail("UnexpectedError: " + e.getMessage());
+ }
+ }
+ return null;
+ }
+ });
+ }
+
+ @Test
+ public void testTraceIsDisabled() throws Exception {
+ final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort);
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ conn.setRequestMethod("TRACE");
+ Assert.assertEquals(HttpURLConnection.HTTP_FORBIDDEN, conn.getResponseCode());
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryWebServerWithSSL.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryWebServerWithSSL.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryWebServerWithSSL.java
new file mode 100644
index 0000000..b4e1b85
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryWebServerWithSSL.java
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.service.thrift;
+
+import com.google.common.io.Resources;
+import java.net.HttpURLConnection;
+import org.apache.commons.io.IOUtils;
+import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+import org.junit.*;
+
+import javax.net.ssl.HttpsURLConnection;
+import java.net.URL;
+import java.util.Properties;
+
+/**
+ * Test sentry web server when ssl is enabled.
+ */
+public class TestSentryWebServerWithSSL extends SentryServiceIntegrationBase {
+ @BeforeClass
+ public static void setup() throws Exception {
+ webServerEnabled = true;
+ webSecurity = false;
+ useSSL = true;
+ SentryServiceIntegrationBase.setup();
+ }
+
+ @Test
+ public void testPing() throws Exception {
+ final URL url = new URL("https://"+ SERVER_HOST + ":" + webServerPort + "/ping");
+ Properties systemProps = System.getProperties();
+ systemProps.put( "javax.net.ssl.trustStore", Resources.getResource("cacerts.jks").getPath());
+ System.setProperties(systemProps);
+ HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
+ Assert.assertEquals(HttpsURLConnection.HTTP_OK, conn.getResponseCode());
+ String response = IOUtils.toString(conn.getInputStream());
+ Assert.assertEquals("pong\n", response);
+ }
+
+ @Test
+ public void testTraceIsDisabled() throws Exception {
+ final URL url = new URL("https://"+ SERVER_HOST + ":" + webServerPort);
+ Properties systemProps = System.getProperties();
+ systemProps.put( "javax.net.ssl.trustStore", Resources.getResource("cacerts.jks").getPath());
+ System.setProperties(systemProps);
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ conn.setRequestMethod("TRACE");
+ Assert.assertEquals(HttpURLConnection.HTTP_FORBIDDEN, conn.getResponseCode());
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryWebServerWithoutSecurity.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryWebServerWithoutSecurity.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryWebServerWithoutSecurity.java
new file mode 100644
index 0000000..6e741e8
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/api/service/thrift/TestSentryWebServerWithoutSecurity.java
@@ -0,0 +1,95 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.api.service.thrift;
+
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TestSentryWebServerWithoutSecurity extends SentryServiceIntegrationBase {
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ webServerEnabled = true;
+ webSecurity = false;
+ SentryServiceIntegrationBase.setup();
+ }
+
+ @Override
+ @Before
+ public void before() throws Exception {
+ }
+
+ @Override
+ @After
+ public void after() {
+ }
+
+ @Test
+ public void testPing() throws Exception {
+ final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort + "/ping");
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
+ String response = IOUtils.toString(conn.getInputStream());
+ Assert.assertEquals("pong\n", response);
+ }
+
+ @Test
+ public void testConf() throws Exception {
+ // test bad format
+ final URL url = new URL("http://" + SERVER_HOST + ":" + webServerPort + "/conf?"
+ + ConfServlet.FORMAT_PARAM + "=badformat");
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ Assert.assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, conn.getResponseCode());
+
+ // test json format
+ final URL url1 = new URL("http://" + SERVER_HOST + ":" + webServerPort + "/conf?"
+ + ConfServlet.FORMAT_PARAM +"=" + ConfServlet.FORMAT_JSON);
+ conn = (HttpURLConnection) url1.openConnection();
+ Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
+
+ // test xml format
+ final URL url2 = new URL("http://" + SERVER_HOST + ":" + webServerPort + "/conf?"
+ + ConfServlet.FORMAT_PARAM +"=" + ConfServlet.FORMAT_XML);
+ conn = (HttpURLConnection) url2.openConnection();
+ Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
+ String xmlResponse = IOUtils.toString(conn.getInputStream());
+
+ // test default is xml format
+ final URL url3 = new URL("http://" + SERVER_HOST + ":" + webServerPort + "/conf");
+ conn = (HttpURLConnection) url3.openConnection();
+ Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
+ String defaultResponse = IOUtils.toString(conn.getInputStream());
+ Assert.assertEquals(xmlResponse, defaultResponse);
+ }
+
+ @Test
+ public void testTraceIsDisabled() throws Exception {
+ final URL url = new URL("http://"+ SERVER_HOST + ":" + webServerPort);
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ conn.setRequestMethod("TRACE");
+ Assert.assertEquals(HttpURLConnection.HTTP_FORBIDDEN, conn.getResponseCode());
+ }
+}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/TestSentryGenericProviderBackend.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/TestSentryGenericProviderBackend.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/TestSentryGenericProviderBackend.java
index 83b0f42..40746e3 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/TestSentryGenericProviderBackend.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/TestSentryGenericProviderBackend.java
@@ -20,10 +20,8 @@ package org.apache.sentry.provider.db.generic;
import org.apache.hadoop.conf.Configuration;
import org.apache.sentry.provider.common.ProviderBackendContext;
+import org.apache.sentry.api.common.ApiConstants;
import org.junit.Test;
-
-import static org.apache.sentry.service.thrift.ServiceConstants.ClientConfig.COMPONENT_TYPE;
-import static org.apache.sentry.service.thrift.ServiceConstants.ClientConfig.SERVICE_NAME;
import static org.junit.Assert.assertEquals;
public class TestSentryGenericProviderBackend {
@@ -32,8 +30,8 @@ public class TestSentryGenericProviderBackend {
Configuration conf = new Configuration();
String sampleServiceName = "sampleServiceName123";
String sampleComponentType = "sampleComponentType123";
- conf.set(SERVICE_NAME, sampleServiceName);
- conf.set(COMPONENT_TYPE, sampleComponentType);
+ conf.set(ApiConstants.ClientConfig.SERVICE_NAME, sampleServiceName);
+ conf.set(ApiConstants.ClientConfig.COMPONENT_TYPE, sampleComponentType);
SentryGenericProviderBackend providerBackend = new SentryGenericProviderBackend(conf, "resource");
assertEquals(sampleComponentType, providerBackend.getComponentType());
assertEquals(sampleServiceName, providerBackend.getServiceName());
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/SentryStoreIntegrationBase.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/SentryStoreIntegrationBase.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/SentryStoreIntegrationBase.java
index d8d1261..3fe5b6a 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/SentryStoreIntegrationBase.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/SentryStoreIntegrationBase.java
@@ -22,7 +22,7 @@ import java.io.File;
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.sentry.provider.file.PolicyFile;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/TestPrivilegeOperatePersistence.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/TestPrivilegeOperatePersistence.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/TestPrivilegeOperatePersistence.java
index 95fc2fb..246b2be 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/TestPrivilegeOperatePersistence.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/TestPrivilegeOperatePersistence.java
@@ -36,7 +36,7 @@ import org.apache.sentry.core.model.sqoop.SqoopActionConstant;
import org.apache.sentry.core.common.exception.SentryGrantDeniedException;
import org.apache.sentry.provider.db.generic.service.persistent.PrivilegeObject.Builder;
import org.apache.sentry.provider.file.PolicyFile;
-import org.apache.sentry.service.thrift.ServiceConstants;
+import org.apache.sentry.service.common.ServiceConstants;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/TestSentryRole.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/TestSentryRole.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/TestSentryRole.java
index ebbb526..65d26c0 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/TestSentryRole.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/TestSentryRole.java
@@ -38,7 +38,7 @@ import org.apache.sentry.provider.db.service.model.MSentryGMPrivilege;
import org.apache.sentry.provider.db.service.model.MSentryPrivilege;
import org.apache.sentry.provider.db.service.model.MSentryRole;
import org.apache.sentry.provider.db.service.persistent.SentryStore;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
[13/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceImportExport.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceImportExport.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceImportExport.java
deleted file mode 100644
index 930b473..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceImportExport.java
+++ /dev/null
@@ -1,751 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.service.thrift;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.sentry.core.common.utils.SentryConstants;
-import org.apache.sentry.core.common.utils.PolicyFileConstants;
-import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-public class TestSentryServiceImportExport extends SentryServiceIntegrationBase {
-
- // define the privileges
- public static String PRIVILIEGE1 = "server=server1";
- public static String PRIVILIEGE2 = "server=server1->action=select->grantoption=false";
- public static String PRIVILIEGE3 = "server=server1->db=db2->action=insert->grantoption=true";
- public static String PRIVILIEGE4 = "server=server1->db=db1->table=tbl1->action=insert";
- public static String PRIVILIEGE5 = "server=server1->db=db1->table=tbl2->column=col1->action=insert";
- public static String PRIVILIEGE6 = "server=server1->db=db1->table=tbl3->column=col1->action=*->grantoption=true";
- public static String PRIVILIEGE7 = "server=server1->db=db1->table=tbl4->column=col1->action=all->grantoption=true";
- public static String PRIVILIEGE8 = "server=server1->uri=hdfs://testserver:9999/path2->action=insert";
- public static String PRIVILIEGE9 = "server=server1->db=db2->table=tbl1->action=insert";
-
- @BeforeClass
- public static void setup() throws Exception {
- kerberos = false;
- setupConf();
- startSentryService();
- }
-
- @Before
- public void preparePolicyFile() throws Exception {
- super.before();
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
- }
-
- // Befor import, database is empty.
- // The following information is imported:
- // group1=role1,role2,role3
- // group2=role1,role2,role3
- // group3=role1,role2,role3
- // role1=privilege1,privilege2,privilege3,privilege4,privilege5,privilege6,privilege7,privilege8
- // role2=privilege1,privilege2,privilege3,privilege4,privilege5,privilege6,privilege7,privilege8
- // role3=privilege1,privilege2,privilege3,privilege4,privilege5,privilege6,privilege7,privilege8
- // Both import API importPolicy and export API exportPoicy are tested.
- @Test
- public void testImportExportPolicy1() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- Map<String, Map<String, Set<String>>> policyFileMappingData = Maps.newHashMap();
- Map<String, Set<String>> groupRolesMap = Maps.newHashMap();
- Set<String> roles = Sets.newHashSet("role1", "role2", "role3");
- groupRolesMap.put("group1", roles);
- groupRolesMap.put("group2", roles);
- groupRolesMap.put("group3", roles);
- Map<String, Set<String>> rolePrivilegesMap = Maps.newHashMap();
- for (String roleName : roles) {
- rolePrivilegesMap.put(roleName, Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3,
- PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
- }
- policyFileMappingData.put(PolicyFileConstants.GROUPS, groupRolesMap);
- policyFileMappingData.put(PolicyFileConstants.ROLES, rolePrivilegesMap);
- client.importPolicy(policyFileMappingData, ADMIN_USER, false);
-
- Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
- validateSentryMappingData(sentryMappingData,
- policyFileMappingData);
- }
- });
- }
-
- // call import twice, and there has no duplicate data:
- // The data for 1st import:
- // group1=role1
- // role1=privilege1,privilege2,privilege3,privilege4
- // The data for 2nd import:
- // group2=role2,role3
- // group3=role2,role3
- // role2=privilege5,privilege6,privilege7,privilege8
- // role3=privilege5,privilege6,privilege7,privilege8
- // Both import API importPolicy and export API exportPoicy are tested.
- @Test
- public void testImportExportPolicy2() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- Map<String, Map<String, Set<String>>> policyFileMappingData1 = Maps.newHashMap();
- Map<String, Set<String>> groupRolesMap1 = Maps.newHashMap();
- groupRolesMap1.put("group1", Sets.newHashSet("role1"));
- Map<String, Set<String>> rolePrivilegesMap1 = Maps.newHashMap();
- rolePrivilegesMap1.put("role1",
- Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3, PRIVILIEGE4));
- policyFileMappingData1.put(PolicyFileConstants.GROUPS, groupRolesMap1);
- policyFileMappingData1.put(PolicyFileConstants.ROLES, rolePrivilegesMap1);
- client.importPolicy(policyFileMappingData1, ADMIN_USER, false);
-
- Map<String, Map<String, Set<String>>> policyFileMappingData2 = Maps.newHashMap();
- Map<String, Set<String>> groupRolesMap2 = Maps.newHashMap();
- groupRolesMap2.put("group2", Sets.newHashSet("role2", "role3"));
- groupRolesMap2.put("group3", Sets.newHashSet("role2", "role3"));
- Map<String, Set<String>> rolePrivilegesMap2 = Maps.newHashMap();
- rolePrivilegesMap2.put("role2",
- Sets.newHashSet(PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
- rolePrivilegesMap2.put("role3",
- Sets.newHashSet(PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
- policyFileMappingData2.put(PolicyFileConstants.GROUPS, groupRolesMap2);
- policyFileMappingData2.put(PolicyFileConstants.ROLES, rolePrivilegesMap2);
- client.importPolicy(policyFileMappingData2, ADMIN_USER, false);
-
- Map<String, Map<String, Set<String>>> exceptedMappingData = Maps.newHashMap();
- // for exceptedMappingData, combine policyFileMappingData1 and policyFileMappingData2
- exceptedMappingData.put(PolicyFileConstants.GROUPS,
- policyFileMappingData1.get(PolicyFileConstants.GROUPS));
- exceptedMappingData.get(PolicyFileConstants.GROUPS).putAll(
- policyFileMappingData2.get(PolicyFileConstants.GROUPS));
- exceptedMappingData.put(PolicyFileConstants.ROLES,
- policyFileMappingData1.get(PolicyFileConstants.ROLES));
- exceptedMappingData.get(PolicyFileConstants.ROLES).putAll(
- policyFileMappingData2.get(PolicyFileConstants.ROLES));
-
- Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
- validateSentryMappingData(sentryMappingData, exceptedMappingData);
- }
- });
- }
-
- // Call import twice, and there has overlapping groups
- // The data for 1st import:
- // group1=role1, role2
- // group2=role1, role2
- // group3=role1, role2
- // role1=privilege1,privilege2,privilege3,privilege4,privilege5
- // role2=privilege1,privilege2,privilege3,privilege4,privilege5
- // The data for 2nd import:
- // group1=role2,role3
- // group2=role2,role3
- // group3=role2,role3
- // role2=privilege4,privilege5,privilege6,privilege7,privilege8
- // role3=privilege4,privilege5,privilege6,privilege7,privilege8
- // Both import API importPolicy and export API exportPoicy are tested.
- @Test
- public void testImportExportPolicy3() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- Map<String, Map<String, Set<String>>> policyFileMappingData1 = Maps.newHashMap();
- Map<String, Set<String>> groupRolesMap1 = Maps.newHashMap();
- groupRolesMap1.put("group1", Sets.newHashSet("role1", "role2"));
- groupRolesMap1.put("group2", Sets.newHashSet("role1", "role2"));
- groupRolesMap1.put("group3", Sets.newHashSet("role1", "role2"));
- Map<String, Set<String>> rolePrivilegesMap1 = Maps.newHashMap();
- rolePrivilegesMap1.put("role1",
- Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE5));
- rolePrivilegesMap1.put("role2",
- Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE5));
- policyFileMappingData1.put(PolicyFileConstants.GROUPS, groupRolesMap1);
- policyFileMappingData1.put(PolicyFileConstants.ROLES, rolePrivilegesMap1);
- client.importPolicy(policyFileMappingData1, ADMIN_USER, false);
-
- Map<String, Map<String, Set<String>>> policyFileMappingData2 = Maps.newHashMap();
- Map<String, Set<String>> groupRolesMap2 = Maps.newHashMap();
- groupRolesMap2.put("group1", Sets.newHashSet("role2", "role3"));
- groupRolesMap2.put("group2", Sets.newHashSet("role2", "role3"));
- groupRolesMap2.put("group3", Sets.newHashSet("role2", "role3"));
- Map<String, Set<String>> rolePrivilegesMap2 = Maps.newHashMap();
- rolePrivilegesMap2.put("role2",
- Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
- rolePrivilegesMap2.put("role3",
- Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
- policyFileMappingData2.put(PolicyFileConstants.GROUPS, groupRolesMap2);
- policyFileMappingData2.put(PolicyFileConstants.ROLES, rolePrivilegesMap2);
- client.importPolicy(policyFileMappingData2, ADMIN_USER, false);
-
- Map<String, Map<String, Set<String>>> exceptedMappingData = Maps.newHashMap();
- Map<String, Set<String>> exceptedRolesMap = Maps.newHashMap();
- exceptedRolesMap.put("group1", Sets.newHashSet("role1", "role2", "role3"));
- exceptedRolesMap.put("group2", Sets.newHashSet("role1", "role2", "role3"));
- exceptedRolesMap.put("group3", Sets.newHashSet("role1", "role2", "role3"));
- Map<String, Set<String>> exceptedPrivilegesMap = Maps.newHashMap();
- exceptedPrivilegesMap.put("role1",
- Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE5));
- exceptedPrivilegesMap.put("role2", Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3,
- PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
- exceptedPrivilegesMap.put("role3",
- Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
- exceptedMappingData.put(PolicyFileConstants.GROUPS, exceptedRolesMap);
- exceptedMappingData.put(PolicyFileConstants.ROLES, exceptedPrivilegesMap);
-
- Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
- validateSentryMappingData(sentryMappingData, exceptedMappingData);
- }
- });
- }
-
- // Only mapping data for [group,role] is imported:
- // group1=role1,role2
- @Test
- public void testImportExportPolicy4() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- Map<String, Map<String, Set<String>>> policyFileMappingData = Maps.newHashMap();
- Map<String, Set<String>> groupRolesMap = Maps.newHashMap();
- Set<String> roles = Sets.newHashSet("role1", "role2");
- groupRolesMap.put("group1", roles);
- Map<String, Set<String>> rolePrivilegesMap = Maps.newHashMap();
- policyFileMappingData.put(PolicyFileConstants.GROUPS, groupRolesMap);
- policyFileMappingData.put(PolicyFileConstants.ROLES, rolePrivilegesMap);
- client.importPolicy(policyFileMappingData, ADMIN_USER, false);
-
- Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
- validateSentryMappingData(sentryMappingData,
- policyFileMappingData);
- }
- });
- }
-
- // call import twice, and there has no duplicate data, the import will be with the overwrite mode:
- // The data for 1st import:
- // group1=role1
- // role1=privilege1
- // The data for 2nd import:
- // group2=role2,role3
- // group3=role2,role3
- // role2=privilege2
- // role3=privilege2
- // Both import API importSentryMetaData and export APIs getRolesMap, getGroupsMap,
- // getPrivilegesList are tested.
- @Test
- public void testImportExportPolicy5() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- Map<String, Map<String, Set<String>>> policyFileMappingData1 = Maps.newHashMap();
- Map<String, Set<String>> groupRolesMap1 = Maps.newHashMap();
- groupRolesMap1.put("group1", Sets.newHashSet("role1"));
- Map<String, Set<String>> rolePrivilegesMap1 = Maps.newHashMap();
- rolePrivilegesMap1.put("role1", Sets.newHashSet(PRIVILIEGE1));
- policyFileMappingData1.put(PolicyFileConstants.GROUPS, groupRolesMap1);
- policyFileMappingData1.put(PolicyFileConstants.ROLES, rolePrivilegesMap1);
- client.importPolicy(policyFileMappingData1, ADMIN_USER, true);
-
- Map<String, Map<String, Set<String>>> policyFileMappingData2 = Maps.newHashMap();
- Map<String, Set<String>> groupRolesMap2 = Maps.newHashMap();
- groupRolesMap2.put("group2", Sets.newHashSet("role2", "role3"));
- groupRolesMap2.put("group3", Sets.newHashSet("role2", "role3"));
- Map<String, Set<String>> rolePrivilegesMap2 = Maps.newHashMap();
- rolePrivilegesMap2.put("role2", Sets.newHashSet(PRIVILIEGE2));
- rolePrivilegesMap2.put("role3", Sets.newHashSet(PRIVILIEGE2));
- policyFileMappingData2.put(PolicyFileConstants.GROUPS, groupRolesMap2);
- policyFileMappingData2.put(PolicyFileConstants.ROLES, rolePrivilegesMap2);
- client.importPolicy(policyFileMappingData2, ADMIN_USER, true);
-
- Map<String, Map<String, Set<String>>> exceptedMappingData = Maps.newHashMap();
- Map<String, Set<String>> exceptedRolesMap = Maps.newHashMap();
- exceptedRolesMap.put("group1", Sets.newHashSet("role1"));
- exceptedRolesMap.put("group2", Sets.newHashSet("role2", "role3"));
- exceptedRolesMap.put("group3", Sets.newHashSet("role2", "role3"));
- Map<String, Set<String>> exceptedPrivilegesMap = Maps.newHashMap();
- exceptedPrivilegesMap.put("role1", Sets.newHashSet(PRIVILIEGE1));
- exceptedPrivilegesMap.put("role2", Sets.newHashSet(PRIVILIEGE2));
- exceptedPrivilegesMap.put("role3", Sets.newHashSet(PRIVILIEGE2));
- exceptedMappingData.put(PolicyFileConstants.GROUPS, exceptedRolesMap);
- exceptedMappingData.put(PolicyFileConstants.ROLES, exceptedPrivilegesMap);
-
- Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
- validateSentryMappingData(sentryMappingData, exceptedMappingData);
- }
- });
- }
-
- // call import twice, and there has data overlap, the import will be with the overwrite mode:
- // The data for 1st import:
- // group1=role1, role2
- // group2=role1, role2
- // group3=role1, role2
- // role1=privilege1,privilege2,privilege3,privilege4,privilege5
- // role2=privilege1,privilege2,privilege3,privilege4,privilege5
- // The data for 2nd import:
- // group1=role2,role3
- // group2=role2,role3
- // group3=role2,role3
- // role2=privilege4,privilege5,privilege6,privilege7,privilege8
- // role3=privilege4,privilege5,privilege6,privilege7,privilege8
- // Both import API importSentryMetaData and export APIs getRolesMap, getGroupsMap,
- // getPrivilegesList are tested.
- @Test
- public void testImportExportPolicy6() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- Map<String, Map<String, Set<String>>> policyFileMappingData1 = Maps.newHashMap();
- Map<String, Set<String>> groupRolesMap1 = Maps.newHashMap();
- groupRolesMap1.put("group1", Sets.newHashSet("role1", "role2"));
- groupRolesMap1.put("group2", Sets.newHashSet("role1", "role2"));
- groupRolesMap1.put("group3", Sets.newHashSet("role1", "role2"));
- Map<String, Set<String>> rolePrivilegesMap1 = Maps.newHashMap();
- rolePrivilegesMap1.put("role1",
- Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE5));
- rolePrivilegesMap1.put("role2",
- Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE5));
- policyFileMappingData1.put(PolicyFileConstants.GROUPS, groupRolesMap1);
- policyFileMappingData1.put(PolicyFileConstants.ROLES, rolePrivilegesMap1);
- client.importPolicy(policyFileMappingData1, ADMIN_USER, true);
-
- Map<String, Map<String, Set<String>>> policyFileMappingData2 = Maps.newHashMap();
- Map<String, Set<String>> groupRolesMap2 = Maps.newHashMap();
- groupRolesMap2.put("group1", Sets.newHashSet("role2", "role3"));
- groupRolesMap2.put("group2", Sets.newHashSet("role2", "role3"));
- groupRolesMap2.put("group3", Sets.newHashSet("role2", "role3"));
- Map<String, Set<String>> rolePrivilegesMap2 = Maps.newHashMap();
- rolePrivilegesMap2.put("role2",
- Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
- rolePrivilegesMap2.put("role3",
- Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
- policyFileMappingData2.put(PolicyFileConstants.GROUPS, groupRolesMap2);
- policyFileMappingData2.put(PolicyFileConstants.ROLES, rolePrivilegesMap2);
- client.importPolicy(policyFileMappingData2, ADMIN_USER, true);
-
- Map<String, Map<String, Set<String>>> exceptedMappingData = Maps.newHashMap();
- Map<String, Set<String>> exceptedRolesMap = Maps.newHashMap();
- exceptedRolesMap.put("group1", Sets.newHashSet("role1", "role2", "role3"));
- exceptedRolesMap.put("group2", Sets.newHashSet("role1", "role2", "role3"));
- exceptedRolesMap.put("group3", Sets.newHashSet("role1", "role2", "role3"));
- Map<String, Set<String>> exceptedPrivilegesMap = Maps.newHashMap();
- exceptedPrivilegesMap.put("role1",
- Sets.newHashSet(PRIVILIEGE1, PRIVILIEGE2, PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE5));
- exceptedPrivilegesMap.put("role2",
- Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
- exceptedPrivilegesMap.put("role3",
- Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
- exceptedMappingData.put(PolicyFileConstants.GROUPS, exceptedRolesMap);
- exceptedMappingData.put(PolicyFileConstants.ROLES, exceptedPrivilegesMap);
-
- Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
- validateSentryMappingData(sentryMappingData, exceptedMappingData);
- }
- });
- }
-
- // test the import privileges with the action: All, *, select, insert
- // All and * should replace the select and insert
- // The data for import:
- // group1=role1, role2
- // role1=testPrivilege1,testPrivilege2,testPrivilege3,testPrivilege4
- // role2=testPrivilege5, testPrivilege6,testPrivilege7,testPrivilege8
- @Test
- public void testImportExportPolicy7() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- String testPrivilege1 = "server=server1->db=db1->table=tbl1->action=select->grantoption=true";
- String testPrivilege2 = "server=server1->db=db1->table=tbl1->action=insert->grantoption=false";
- String testPrivilege3 = "server=server1->db=db1->table=tbl1->action=all->grantoption=true";
- String testPrivilege4 = "server=server1->db=db1->table=tbl1->action=insert->grantoption=true";
- String testPrivilege5 = "server=server1->db=db1->table=tbl2->action=select->grantoption=true";
- String testPrivilege6 = "server=server1->db=db1->table=tbl2->action=insert->grantoption=false";
- String testPrivilege7 = "server=server1->db=db1->table=tbl2->action=*->grantoption=true";
- String testPrivilege8 = "server=server1->db=db1->table=tbl2->action=insert->grantoption=true";
-
- Map<String, Map<String, Set<String>>> policyFileMappingData1 = Maps.newHashMap();
- Map<String, Set<String>> groupRolesMap1 = Maps.newHashMap();
- groupRolesMap1.put("group1", Sets.newHashSet("role1", "role2"));
- Map<String, Set<String>> rolePrivilegesMap1 = Maps.newHashMap();
- rolePrivilegesMap1.put("role1",
- Sets.newHashSet(testPrivilege1, testPrivilege2, testPrivilege3, testPrivilege4));
- rolePrivilegesMap1.put("role2",
- Sets.newHashSet(testPrivilege5, testPrivilege6, testPrivilege7, testPrivilege8));
- policyFileMappingData1.put(PolicyFileConstants.GROUPS, groupRolesMap1);
- policyFileMappingData1.put(PolicyFileConstants.ROLES, rolePrivilegesMap1);
- client.importPolicy(policyFileMappingData1, ADMIN_USER, true);
-
- Map<String, Map<String, Set<String>>> exceptedMappingData = Maps.newHashMap();
- Map<String, Set<String>> exceptedRolesMap = Maps.newHashMap();
- exceptedRolesMap.put("group1", Sets.newHashSet("role1", "role2"));
- Map<String, Set<String>> exceptedPrivilegesMap = Maps.newHashMap();
- exceptedPrivilegesMap.put("role1", Sets.newHashSet(testPrivilege2, testPrivilege3));
- exceptedPrivilegesMap.put("role2", Sets.newHashSet(testPrivilege6, testPrivilege7));
- exceptedMappingData.put(PolicyFileConstants.GROUPS, exceptedRolesMap);
- exceptedMappingData.put(PolicyFileConstants.ROLES, exceptedPrivilegesMap);
-
- Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
- validateSentryMappingData(sentryMappingData, exceptedMappingData);
- }
- });
- }
-
- // Call import twice, and there has overlapping actions, all and * should replace the select and
- // insert
- // The data for 1st import:
- // group1=role1, role2
- // role1=privilege1(with select action),privilege2(with insert action)
- // role2=privilege4(with select action),privilege5(with insert action)
- // The data for 2nd import:
- // group1=role1, role2
- // role1=privilege3(with all action)
- // role2=privilege6(with * action)
- @Test
- public void testImportExportPolicy8() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- String testPrivilege1 = "server=server1->db=db1->table=tbl1->action=select->grantoption=true";
- String testPrivilege2 = "server=server1->db=db1->table=tbl1->action=insert->grantoption=true";
- String testPrivilege3 = "server=server1->db=db1->table=tbl1->action=all->grantoption=true";
- String testPrivilege4 = "server=server1->db=db1->table=tbl2->action=select->grantoption=true";
- String testPrivilege5 = "server=server1->db=db1->table=tbl2->action=insert->grantoption=true";
- String testPrivilege6 = "server=server1->db=db1->table=tbl2->action=*->grantoption=true";
-
- Map<String, Map<String, Set<String>>> policyFileMappingData1 = Maps.newHashMap();
- Map<String, Set<String>> groupRolesMap1 = Maps.newHashMap();
- groupRolesMap1.put("group1", Sets.newHashSet("role1", "role2"));
- Map<String, Set<String>> rolePrivilegesMap1 = Maps.newHashMap();
- rolePrivilegesMap1.put("role1", Sets.newHashSet(testPrivilege1, testPrivilege2));
- rolePrivilegesMap1.put("role2", Sets.newHashSet(testPrivilege4, testPrivilege5));
- policyFileMappingData1.put(PolicyFileConstants.GROUPS, groupRolesMap1);
- policyFileMappingData1.put(PolicyFileConstants.ROLES, rolePrivilegesMap1);
- client.importPolicy(policyFileMappingData1, ADMIN_USER, false);
-
- Map<String, Map<String, Set<String>>> policyFileMappingData2 = Maps.newHashMap();
- Map<String, Set<String>> groupRolesMap2 = Maps.newHashMap();
- groupRolesMap2.put("group1", Sets.newHashSet("role1", "role2"));
- Map<String, Set<String>> rolePrivilegesMap2 = Maps.newHashMap();
- rolePrivilegesMap2.put("role1", Sets.newHashSet(testPrivilege3));
- rolePrivilegesMap2.put("role2", Sets.newHashSet(testPrivilege6));
- policyFileMappingData2.put(PolicyFileConstants.GROUPS, groupRolesMap2);
- policyFileMappingData2.put(PolicyFileConstants.ROLES, rolePrivilegesMap2);
- client.importPolicy(policyFileMappingData2, ADMIN_USER, false);
-
- Map<String, Map<String, Set<String>>> exceptedMappingData = policyFileMappingData2;
- Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
- // all and * should replace the select and insert
- validateSentryMappingData(sentryMappingData, exceptedMappingData);
- }
- });
- }
-
- // test the user not in the admin group can't do the import/export
- @Test
- public void testImportExportPolicy9() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- Map<String, Map<String, Set<String>>> policyFileMappingData1 = Maps.newHashMap();
- Map<String, Set<String>> groupRolesMap1 = Maps.newHashMap();
- Map<String, Set<String>> rolePrivilegesMap1 = Maps.newHashMap();
- policyFileMappingData1.put(PolicyFileConstants.GROUPS, groupRolesMap1);
- policyFileMappingData1.put(PolicyFileConstants.ROLES, rolePrivilegesMap1);
- try {
- client.importPolicy(policyFileMappingData1, "no-admin-user", false);
- fail("non-admin can't do the import.");
- } catch (Exception e) {
- // excepted exception
- }
-
- try {
- client.exportPolicy("no-admin-user", null);
- fail("non-admin can't do the export.");
- } catch (Exception e) {
- // excepted exception
- }
- }
- });
- }
-
- // The following data is imported:
- // group1=role1
- // group2=role1,role2
- // group3=role2,role3
- // group4=role1,role2,role3
- // role1=privilege3,privilege4,privilege9
- // role2=privilege3,privilege4,privilege5,privilege6,privilege7
- // role3=privilege4,privilege5,privilege6,privilege7,privilege8
- // Export APIs getRoleNameTPrivilegesMap, getGroupNameRoleNamesMap are tested.
- @Test
- public void testExportPolicyWithSpecificObject() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- // import the test data
- Map<String, Map<String, Set<String>>> policyFileMappingData = Maps.newHashMap();
- Map<String, Set<String>> groupRolesMap = Maps.newHashMap();
- groupRolesMap.put("group1", Sets.newHashSet("role1"));
- groupRolesMap.put("group2", Sets.newHashSet("role1", "role2"));
- groupRolesMap.put("group3", Sets.newHashSet("role2", "role3"));
- groupRolesMap.put("group4", Sets.newHashSet("role1", "role2", "role3"));
- Map<String, Set<String>> rolePrivilegesMap1 = Maps.newHashMap();
- rolePrivilegesMap1.put("role1",
- Sets.newHashSet(PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE9));
- rolePrivilegesMap1.put("role2",
- Sets.newHashSet(PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE5,
- PRIVILIEGE6, PRIVILIEGE7));
- rolePrivilegesMap1.put("role3",
- Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE5, PRIVILIEGE6,
- PRIVILIEGE7, PRIVILIEGE8));
- policyFileMappingData.put(PolicyFileConstants.GROUPS, groupRolesMap);
- policyFileMappingData.put(PolicyFileConstants.ROLES, rolePrivilegesMap1);
- client.importPolicy(policyFileMappingData, ADMIN_USER, true);
-
- // verify the rolePrivilegesMap and groupRolesMap with null objectPath
- Map<String, Map<String, Set<String>>> expectedMappingData = Maps.newHashMap();
- Map<String, Set<String>> expectedGroupRoles = Maps.newHashMap();
- expectedGroupRoles.put("group1", Sets.newHashSet("role1"));
- expectedGroupRoles.put("group2", Sets.newHashSet("role1", "role2"));
- expectedGroupRoles.put("group3", Sets.newHashSet("role2", "role3"));
- expectedGroupRoles.put("group4", Sets.newHashSet("role1", "role2", "role3"));
- Map<String, Set<String>> expectedRolePrivileges = Maps.newHashMap();
- expectedRolePrivileges.put("role1", Sets.newHashSet(
- PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE9));
- expectedRolePrivileges.put("role2", Sets.newHashSet(PRIVILIEGE3, PRIVILIEGE4,
- PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7));
- expectedRolePrivileges.put("role3", Sets.newHashSet(PRIVILIEGE4,
- PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
- expectedMappingData.put(PolicyFileConstants.GROUPS, expectedGroupRoles);
- expectedMappingData.put(PolicyFileConstants.ROLES, expectedRolePrivileges);
-
- Map<String, Map<String, Set<String>>> sentryMappingData = client.exportPolicy(ADMIN_USER, null);
- validateSentryMappingData(sentryMappingData, expectedMappingData);
-
- // verify the rolePrivilegesMap and groupRolesMap with empty objectPath
- expectedMappingData = Maps.newHashMap();
- expectedGroupRoles = Maps.newHashMap();
- expectedGroupRoles.put("group1", Sets.newHashSet("role1"));
- expectedGroupRoles.put("group2", Sets.newHashSet("role1", "role2"));
- expectedGroupRoles.put("group3", Sets.newHashSet("role2", "role3"));
- expectedGroupRoles.put("group4", Sets.newHashSet("role1", "role2", "role3"));
- expectedRolePrivileges = Maps.newHashMap();
- expectedRolePrivileges.put("role1", Sets.newHashSet(
- PRIVILIEGE3, PRIVILIEGE4, PRIVILIEGE9));
- expectedRolePrivileges.put("role2", Sets.newHashSet(PRIVILIEGE3, PRIVILIEGE4,
- PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7));
- expectedRolePrivileges.put("role3", Sets.newHashSet(PRIVILIEGE4,
- PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7, PRIVILIEGE8));
- expectedMappingData.put(PolicyFileConstants.GROUPS, expectedGroupRoles);
- expectedMappingData.put(PolicyFileConstants.ROLES, expectedRolePrivileges);
-
- sentryMappingData = client.exportPolicy(ADMIN_USER, "");
- validateSentryMappingData(sentryMappingData, expectedMappingData);
-
- // verify the rolePrivilegesMap and groupRolesMap for db=db1
- expectedMappingData = Maps.newHashMap();
- expectedGroupRoles = Maps.newHashMap();
- expectedGroupRoles.put("group1", Sets.newHashSet("role1"));
- expectedGroupRoles.put("group2", Sets.newHashSet("role1", "role2"));
- expectedGroupRoles.put("group3", Sets.newHashSet("role2", "role3"));
- expectedGroupRoles.put("group4", Sets.newHashSet("role1", "role2", "role3"));
- expectedRolePrivileges = Maps.newHashMap();
- expectedRolePrivileges.put("role1", Sets.newHashSet(PRIVILIEGE4));
- expectedRolePrivileges.put("role2", Sets.newHashSet(PRIVILIEGE4,
- PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7));
- expectedRolePrivileges.put("role3", Sets.newHashSet(PRIVILIEGE4,
- PRIVILIEGE5, PRIVILIEGE6, PRIVILIEGE7));
- expectedMappingData.put(PolicyFileConstants.GROUPS, expectedGroupRoles);
- expectedMappingData.put(PolicyFileConstants.ROLES, expectedRolePrivileges);
-
- sentryMappingData = client.exportPolicy(ADMIN_USER, "db=db1");
- validateSentryMappingData(sentryMappingData, expectedMappingData);
-
- // verify the rolePrivilegesMap and groupRolesMap for db=db2
- expectedMappingData = Maps.newHashMap();
- expectedGroupRoles = Maps.newHashMap();
- expectedGroupRoles.put("group1", Sets.newHashSet("role1"));
- expectedGroupRoles.put("group2", Sets.newHashSet("role1", "role2"));
- expectedGroupRoles.put("group3", Sets.newHashSet("role2"));
- expectedGroupRoles.put("group4", Sets.newHashSet("role1", "role2"));
- expectedRolePrivileges = Maps.newHashMap();
- expectedRolePrivileges.put("role1", Sets.newHashSet(PRIVILIEGE3, PRIVILIEGE9));
- expectedRolePrivileges.put("role2", Sets.newHashSet(PRIVILIEGE3));
- expectedMappingData.put(PolicyFileConstants.GROUPS, expectedGroupRoles);
- expectedMappingData.put(PolicyFileConstants.ROLES, expectedRolePrivileges);
-
- sentryMappingData = client.exportPolicy(ADMIN_USER, "db=db2");
- validateSentryMappingData(sentryMappingData, expectedMappingData);
-
- // verify the rolePrivilegesMap and groupRolesMap for db=db1->table=tbl1
- expectedMappingData = Maps.newHashMap();
- expectedGroupRoles = Maps.newHashMap();
- expectedGroupRoles.put("group1", Sets.newHashSet("role1"));
- expectedGroupRoles.put("group2", Sets.newHashSet("role1", "role2"));
- expectedGroupRoles.put("group3", Sets.newHashSet("role2", "role3"));
- expectedGroupRoles.put("group4", Sets.newHashSet("role1", "role2", "role3"));
- expectedRolePrivileges = Maps.newHashMap();
- expectedRolePrivileges.put("role1", Sets.newHashSet(PRIVILIEGE4));
- expectedRolePrivileges.put("role2", Sets.newHashSet(PRIVILIEGE4));
- expectedRolePrivileges.put("role3", Sets.newHashSet(PRIVILIEGE4));
- expectedMappingData.put(PolicyFileConstants.GROUPS, expectedGroupRoles);
- expectedMappingData.put(PolicyFileConstants.ROLES, expectedRolePrivileges);
-
- sentryMappingData = client.exportPolicy(ADMIN_USER, "db=db1->table=tbl1");
- validateSentryMappingData(sentryMappingData, expectedMappingData);
-
- // verify the rolePrivilegesMap and groupRolesMap for db=db1->table=tbl2
- expectedMappingData = Maps.newHashMap();
- expectedGroupRoles = Maps.newHashMap();
- expectedGroupRoles.put("group2", Sets.newHashSet("role2"));
- expectedGroupRoles.put("group3", Sets.newHashSet("role2", "role3"));
- expectedGroupRoles.put("group4", Sets.newHashSet("role2", "role3"));
- expectedRolePrivileges = Maps.newHashMap();
- expectedRolePrivileges.put("role2", Sets.newHashSet(PRIVILIEGE5));
- expectedRolePrivileges.put("role3", Sets.newHashSet(PRIVILIEGE5));
- expectedMappingData.put(PolicyFileConstants.GROUPS, expectedGroupRoles);
- expectedMappingData.put(PolicyFileConstants.ROLES, expectedRolePrivileges);
-
- sentryMappingData = client.exportPolicy(ADMIN_USER, "db=db1->table=tbl2");
- validateSentryMappingData(sentryMappingData, expectedMappingData);
-
- // verify the rolePrivilegesMap and groupRolesMap for db=db1->table=tbl1
- expectedMappingData = Maps.newHashMap();
- expectedGroupRoles = Maps.newHashMap();
- expectedGroupRoles.put("group1", Sets.newHashSet("role1"));
- expectedGroupRoles.put("group2", Sets.newHashSet("role1", "role2"));
- expectedGroupRoles.put("group3", Sets.newHashSet("role2", "role3"));
- expectedGroupRoles.put("group4", Sets.newHashSet("role1", "role2", "role3"));
- expectedRolePrivileges = Maps.newHashMap();
- expectedRolePrivileges.put("role1", Sets.newHashSet(PRIVILIEGE4, PRIVILIEGE9));
- expectedRolePrivileges.put("role2", Sets.newHashSet(PRIVILIEGE4));
- expectedRolePrivileges.put("role3", Sets.newHashSet(PRIVILIEGE4));
- expectedMappingData.put(PolicyFileConstants.GROUPS, expectedGroupRoles);
- expectedMappingData.put(PolicyFileConstants.ROLES, expectedRolePrivileges);
-
- sentryMappingData = client.exportPolicy(ADMIN_USER, "table=tbl1");
- validateSentryMappingData(sentryMappingData, expectedMappingData);
-
- // verify the invalid exportObject string
- try {
- client.exportPolicy(ADMIN_USER, "invalidString");
- fail("RuntimeException should be thrown.");
- } catch (RuntimeException sue) {
- // excepted exception
- }
- }
- });
- }
-
- // Befor import, database is empty.
- // The following information is imported:
- // group1=role1,role2,role3
- // group2=role1,role2,role3
- // user1=role1,role2,role3
- // user2=role1,role2,role3
- // role1=privilege1,privilege2,privilege3,privilege4
- // role2=privilege1,privilege2,privilege3,privilege4
- // role3=privilege1,privilege2,privilege3,privilege4
- @Test
- public void testImportExportPolicyWithUser() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- Map<String, Map<String, Set<String>>> policyFileMappingData = Maps.newHashMap();
- Map<String, Set<String>> groupRolesMap = Maps.newHashMap();
- Map<String, Set<String>> userRolesMap = Maps.newHashMap();
- Set<String> roles = Sets.newHashSet("role1", "role2", "role3");
- groupRolesMap.put("group1", roles);
- groupRolesMap.put("group2", roles);
- userRolesMap.put("user1", roles);
- userRolesMap.put("user2", roles);
- Map<String, Set<String>> rolePrivilegesMap = Maps.newHashMap();
- for (String roleName : roles) {
- rolePrivilegesMap.put(roleName, Sets.newHashSet(PRIVILIEGE1,
- PRIVILIEGE2, PRIVILIEGE3, PRIVILIEGE4));
- }
- policyFileMappingData.put(PolicyFileConstants.USER_ROLES, userRolesMap);
- policyFileMappingData.put(PolicyFileConstants.GROUPS, groupRolesMap);
- policyFileMappingData.put(PolicyFileConstants.ROLES, rolePrivilegesMap);
- client.importPolicy(policyFileMappingData, ADMIN_USER, false);
-
- Map<String, Map<String, Set<String>>> sentryMappingData =
- client.exportPolicy(ADMIN_USER, null);
- // validate the [user, role] mapping
- validateRolesMap(sentryMappingData.get(PolicyFileConstants.USER_ROLES),
- policyFileMappingData.get(PolicyFileConstants.USER_ROLES));
- validateSentryMappingData(sentryMappingData,
- policyFileMappingData);
- }
- });
- }
-
- // verify the mapping data
- public void validateSentryMappingData(
- Map<String, Map<String, Set<String>>> actualMappingData,
- Map<String, Map<String, Set<String>>> expectedMappingData) {
- validateRolesMap(actualMappingData.get(PolicyFileConstants.GROUPS),
- expectedMappingData.get(PolicyFileConstants.GROUPS));
- validateRolePrivilegesMap(actualMappingData.get(PolicyFileConstants.ROLES),
- expectedMappingData.get(PolicyFileConstants.ROLES));
- }
-
- // verify the mapping data for [group,role] and [user,role]
- private void validateRolesMap(Map<String, Set<String>> actualMap,
- Map<String, Set<String>> expectedMap) {
- assertEquals(expectedMap.keySet().size(), actualMap.keySet().size());
- for (String name : actualMap.keySet()) {
- Set<String> actualRoles = actualMap.get(name);
- Set<String> expectedRoles = expectedMap.get(name);
- assertEquals(actualRoles.size(), expectedRoles.size());
- assertTrue(actualRoles.equals(expectedRoles));
- }
- }
-
- // verify the mapping data for [role,privilege]
- private void validateRolePrivilegesMap(Map<String, Set<String>> actualMap,
- Map<String, Set<String>> expectedMap) {
- assertEquals(expectedMap.keySet().size(), actualMap.keySet().size());
- for (String roleName : actualMap.keySet()) {
- Set<String> actualPrivileges = actualMap.get(roleName);
- Set<String> exceptedPrivileges = expectedMap.get(roleName);
- assertEquals(exceptedPrivileges.size(), actualPrivileges.size());
- for (String actualPrivilege : actualPrivileges) {
- boolean isFound = exceptedPrivileges.contains(actualPrivilege);
- if (!isFound) {
- String withOptionPrivilege = SentryConstants.AUTHORIZABLE_JOINER.join(actualPrivilege,
- SentryConstants.KV_JOINER.join(PolicyFileConstants.PRIVILEGE_GRANT_OPTION_NAME,
- "false"));
- isFound = exceptedPrivileges.contains(withOptionPrivilege);
- }
- assertTrue(isFound);
- }
- }
- }
-}
[28/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryMappingData.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryMappingData.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryMappingData.java
deleted file mode 100644
index 28adf0a..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryMappingData.java
+++ /dev/null
@@ -1,898 +0,0 @@
-/**
- * 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.provider.db.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 TSentryMappingData implements org.apache.thrift.TBase<TSentryMappingData, TSentryMappingData._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryMappingData> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryMappingData");
-
- private static final org.apache.thrift.protocol.TField GROUP_ROLES_MAP_FIELD_DESC = new org.apache.thrift.protocol.TField("groupRolesMap", org.apache.thrift.protocol.TType.MAP, (short)1);
- private static final org.apache.thrift.protocol.TField ROLE_PRIVILEGES_MAP_FIELD_DESC = new org.apache.thrift.protocol.TField("rolePrivilegesMap", org.apache.thrift.protocol.TType.MAP, (short)2);
- private static final org.apache.thrift.protocol.TField USER_ROLES_MAP_FIELD_DESC = new org.apache.thrift.protocol.TField("userRolesMap", org.apache.thrift.protocol.TType.MAP, (short)3);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryMappingDataStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryMappingDataTupleSchemeFactory());
- }
-
- private Map<String,Set<String>> groupRolesMap; // optional
- private Map<String,Set<TSentryPrivilege>> rolePrivilegesMap; // optional
- private Map<String,Set<String>> userRolesMap; // optional
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- GROUP_ROLES_MAP((short)1, "groupRolesMap"),
- ROLE_PRIVILEGES_MAP((short)2, "rolePrivilegesMap"),
- USER_ROLES_MAP((short)3, "userRolesMap");
-
- 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: // GROUP_ROLES_MAP
- return GROUP_ROLES_MAP;
- case 2: // ROLE_PRIVILEGES_MAP
- return ROLE_PRIVILEGES_MAP;
- case 3: // USER_ROLES_MAP
- return USER_ROLES_MAP;
- 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 _Fields optionals[] = {_Fields.GROUP_ROLES_MAP,_Fields.ROLE_PRIVILEGES_MAP,_Fields.USER_ROLES_MAP};
- 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.GROUP_ROLES_MAP, new org.apache.thrift.meta_data.FieldMetaData("groupRolesMap", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))));
- tmpMap.put(_Fields.ROLE_PRIVILEGES_MAP, new org.apache.thrift.meta_data.FieldMetaData("rolePrivilegesMap", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class)))));
- tmpMap.put(_Fields.USER_ROLES_MAP, new org.apache.thrift.meta_data.FieldMetaData("userRolesMap", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryMappingData.class, metaDataMap);
- }
-
- public TSentryMappingData() {
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryMappingData(TSentryMappingData other) {
- if (other.isSetGroupRolesMap()) {
- Map<String,Set<String>> __this__groupRolesMap = new HashMap<String,Set<String>>(other.groupRolesMap.size());
- for (Map.Entry<String, Set<String>> other_element : other.groupRolesMap.entrySet()) {
-
- String other_element_key = other_element.getKey();
- Set<String> other_element_value = other_element.getValue();
-
- String __this__groupRolesMap_copy_key = other_element_key;
-
- Set<String> __this__groupRolesMap_copy_value = new HashSet<String>(other_element_value);
-
- __this__groupRolesMap.put(__this__groupRolesMap_copy_key, __this__groupRolesMap_copy_value);
- }
- this.groupRolesMap = __this__groupRolesMap;
- }
- if (other.isSetRolePrivilegesMap()) {
- Map<String,Set<TSentryPrivilege>> __this__rolePrivilegesMap = new HashMap<String,Set<TSentryPrivilege>>(other.rolePrivilegesMap.size());
- for (Map.Entry<String, Set<TSentryPrivilege>> other_element : other.rolePrivilegesMap.entrySet()) {
-
- String other_element_key = other_element.getKey();
- Set<TSentryPrivilege> other_element_value = other_element.getValue();
-
- String __this__rolePrivilegesMap_copy_key = other_element_key;
-
- Set<TSentryPrivilege> __this__rolePrivilegesMap_copy_value = new HashSet<TSentryPrivilege>(other_element_value.size());
- for (TSentryPrivilege other_element_value_element : other_element_value) {
- __this__rolePrivilegesMap_copy_value.add(new TSentryPrivilege(other_element_value_element));
- }
-
- __this__rolePrivilegesMap.put(__this__rolePrivilegesMap_copy_key, __this__rolePrivilegesMap_copy_value);
- }
- this.rolePrivilegesMap = __this__rolePrivilegesMap;
- }
- if (other.isSetUserRolesMap()) {
- Map<String,Set<String>> __this__userRolesMap = new HashMap<String,Set<String>>(other.userRolesMap.size());
- for (Map.Entry<String, Set<String>> other_element : other.userRolesMap.entrySet()) {
-
- String other_element_key = other_element.getKey();
- Set<String> other_element_value = other_element.getValue();
-
- String __this__userRolesMap_copy_key = other_element_key;
-
- Set<String> __this__userRolesMap_copy_value = new HashSet<String>(other_element_value);
-
- __this__userRolesMap.put(__this__userRolesMap_copy_key, __this__userRolesMap_copy_value);
- }
- this.userRolesMap = __this__userRolesMap;
- }
- }
-
- public TSentryMappingData deepCopy() {
- return new TSentryMappingData(this);
- }
-
- @Override
- public void clear() {
- this.groupRolesMap = null;
- this.rolePrivilegesMap = null;
- this.userRolesMap = null;
- }
-
- public int getGroupRolesMapSize() {
- return (this.groupRolesMap == null) ? 0 : this.groupRolesMap.size();
- }
-
- public void putToGroupRolesMap(String key, Set<String> val) {
- if (this.groupRolesMap == null) {
- this.groupRolesMap = new HashMap<String,Set<String>>();
- }
- this.groupRolesMap.put(key, val);
- }
-
- public Map<String,Set<String>> getGroupRolesMap() {
- return this.groupRolesMap;
- }
-
- public void setGroupRolesMap(Map<String,Set<String>> groupRolesMap) {
- this.groupRolesMap = groupRolesMap;
- }
-
- public void unsetGroupRolesMap() {
- this.groupRolesMap = null;
- }
-
- /** Returns true if field groupRolesMap is set (has been assigned a value) and false otherwise */
- public boolean isSetGroupRolesMap() {
- return this.groupRolesMap != null;
- }
-
- public void setGroupRolesMapIsSet(boolean value) {
- if (!value) {
- this.groupRolesMap = null;
- }
- }
-
- public int getRolePrivilegesMapSize() {
- return (this.rolePrivilegesMap == null) ? 0 : this.rolePrivilegesMap.size();
- }
-
- public void putToRolePrivilegesMap(String key, Set<TSentryPrivilege> val) {
- if (this.rolePrivilegesMap == null) {
- this.rolePrivilegesMap = new HashMap<String,Set<TSentryPrivilege>>();
- }
- this.rolePrivilegesMap.put(key, val);
- }
-
- public Map<String,Set<TSentryPrivilege>> getRolePrivilegesMap() {
- return this.rolePrivilegesMap;
- }
-
- public void setRolePrivilegesMap(Map<String,Set<TSentryPrivilege>> rolePrivilegesMap) {
- this.rolePrivilegesMap = rolePrivilegesMap;
- }
-
- public void unsetRolePrivilegesMap() {
- this.rolePrivilegesMap = null;
- }
-
- /** Returns true if field rolePrivilegesMap is set (has been assigned a value) and false otherwise */
- public boolean isSetRolePrivilegesMap() {
- return this.rolePrivilegesMap != null;
- }
-
- public void setRolePrivilegesMapIsSet(boolean value) {
- if (!value) {
- this.rolePrivilegesMap = null;
- }
- }
-
- public int getUserRolesMapSize() {
- return (this.userRolesMap == null) ? 0 : this.userRolesMap.size();
- }
-
- public void putToUserRolesMap(String key, Set<String> val) {
- if (this.userRolesMap == null) {
- this.userRolesMap = new HashMap<String,Set<String>>();
- }
- this.userRolesMap.put(key, val);
- }
-
- public Map<String,Set<String>> getUserRolesMap() {
- return this.userRolesMap;
- }
-
- public void setUserRolesMap(Map<String,Set<String>> userRolesMap) {
- this.userRolesMap = userRolesMap;
- }
-
- public void unsetUserRolesMap() {
- this.userRolesMap = null;
- }
-
- /** Returns true if field userRolesMap is set (has been assigned a value) and false otherwise */
- public boolean isSetUserRolesMap() {
- return this.userRolesMap != null;
- }
-
- public void setUserRolesMapIsSet(boolean value) {
- if (!value) {
- this.userRolesMap = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case GROUP_ROLES_MAP:
- if (value == null) {
- unsetGroupRolesMap();
- } else {
- setGroupRolesMap((Map<String,Set<String>>)value);
- }
- break;
-
- case ROLE_PRIVILEGES_MAP:
- if (value == null) {
- unsetRolePrivilegesMap();
- } else {
- setRolePrivilegesMap((Map<String,Set<TSentryPrivilege>>)value);
- }
- break;
-
- case USER_ROLES_MAP:
- if (value == null) {
- unsetUserRolesMap();
- } else {
- setUserRolesMap((Map<String,Set<String>>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case GROUP_ROLES_MAP:
- return getGroupRolesMap();
-
- case ROLE_PRIVILEGES_MAP:
- return getRolePrivilegesMap();
-
- case USER_ROLES_MAP:
- return getUserRolesMap();
-
- }
- 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 GROUP_ROLES_MAP:
- return isSetGroupRolesMap();
- case ROLE_PRIVILEGES_MAP:
- return isSetRolePrivilegesMap();
- case USER_ROLES_MAP:
- return isSetUserRolesMap();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryMappingData)
- return this.equals((TSentryMappingData)that);
- return false;
- }
-
- public boolean equals(TSentryMappingData that) {
- if (that == null)
- return false;
-
- boolean this_present_groupRolesMap = true && this.isSetGroupRolesMap();
- boolean that_present_groupRolesMap = true && that.isSetGroupRolesMap();
- if (this_present_groupRolesMap || that_present_groupRolesMap) {
- if (!(this_present_groupRolesMap && that_present_groupRolesMap))
- return false;
- if (!this.groupRolesMap.equals(that.groupRolesMap))
- return false;
- }
-
- boolean this_present_rolePrivilegesMap = true && this.isSetRolePrivilegesMap();
- boolean that_present_rolePrivilegesMap = true && that.isSetRolePrivilegesMap();
- if (this_present_rolePrivilegesMap || that_present_rolePrivilegesMap) {
- if (!(this_present_rolePrivilegesMap && that_present_rolePrivilegesMap))
- return false;
- if (!this.rolePrivilegesMap.equals(that.rolePrivilegesMap))
- return false;
- }
-
- boolean this_present_userRolesMap = true && this.isSetUserRolesMap();
- boolean that_present_userRolesMap = true && that.isSetUserRolesMap();
- if (this_present_userRolesMap || that_present_userRolesMap) {
- if (!(this_present_userRolesMap && that_present_userRolesMap))
- return false;
- if (!this.userRolesMap.equals(that.userRolesMap))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List<Object> list = new ArrayList<Object>();
-
- boolean present_groupRolesMap = true && (isSetGroupRolesMap());
- list.add(present_groupRolesMap);
- if (present_groupRolesMap)
- list.add(groupRolesMap);
-
- boolean present_rolePrivilegesMap = true && (isSetRolePrivilegesMap());
- list.add(present_rolePrivilegesMap);
- if (present_rolePrivilegesMap)
- list.add(rolePrivilegesMap);
-
- boolean present_userRolesMap = true && (isSetUserRolesMap());
- list.add(present_userRolesMap);
- if (present_userRolesMap)
- list.add(userRolesMap);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryMappingData other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetGroupRolesMap()).compareTo(other.isSetGroupRolesMap());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroupRolesMap()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groupRolesMap, other.groupRolesMap);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRolePrivilegesMap()).compareTo(other.isSetRolePrivilegesMap());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRolePrivilegesMap()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rolePrivilegesMap, other.rolePrivilegesMap);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetUserRolesMap()).compareTo(other.isSetUserRolesMap());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetUserRolesMap()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userRolesMap, other.userRolesMap);
- 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("TSentryMappingData(");
- boolean first = true;
-
- if (isSetGroupRolesMap()) {
- sb.append("groupRolesMap:");
- if (this.groupRolesMap == null) {
- sb.append("null");
- } else {
- sb.append(this.groupRolesMap);
- }
- first = false;
- }
- if (isSetRolePrivilegesMap()) {
- if (!first) sb.append(", ");
- sb.append("rolePrivilegesMap:");
- if (this.rolePrivilegesMap == null) {
- sb.append("null");
- } else {
- sb.append(this.rolePrivilegesMap);
- }
- first = false;
- }
- if (isSetUserRolesMap()) {
- if (!first) sb.append(", ");
- sb.append("userRolesMap:");
- if (this.userRolesMap == null) {
- sb.append("null");
- } else {
- sb.append(this.userRolesMap);
- }
- first = false;
- }
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- // check for sub-struct validity
- }
-
- 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 TSentryMappingDataStandardSchemeFactory implements SchemeFactory {
- public TSentryMappingDataStandardScheme getScheme() {
- return new TSentryMappingDataStandardScheme();
- }
- }
-
- private static class TSentryMappingDataStandardScheme extends StandardScheme<TSentryMappingData> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryMappingData 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: // GROUP_ROLES_MAP
- if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
- {
- org.apache.thrift.protocol.TMap _map156 = iprot.readMapBegin();
- struct.groupRolesMap = new HashMap<String,Set<String>>(2*_map156.size);
- String _key157;
- Set<String> _val158;
- for (int _i159 = 0; _i159 < _map156.size; ++_i159)
- {
- _key157 = iprot.readString();
- {
- org.apache.thrift.protocol.TSet _set160 = iprot.readSetBegin();
- _val158 = new HashSet<String>(2*_set160.size);
- String _elem161;
- for (int _i162 = 0; _i162 < _set160.size; ++_i162)
- {
- _elem161 = iprot.readString();
- _val158.add(_elem161);
- }
- iprot.readSetEnd();
- }
- struct.groupRolesMap.put(_key157, _val158);
- }
- iprot.readMapEnd();
- }
- struct.setGroupRolesMapIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // ROLE_PRIVILEGES_MAP
- if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
- {
- org.apache.thrift.protocol.TMap _map163 = iprot.readMapBegin();
- struct.rolePrivilegesMap = new HashMap<String,Set<TSentryPrivilege>>(2*_map163.size);
- String _key164;
- Set<TSentryPrivilege> _val165;
- for (int _i166 = 0; _i166 < _map163.size; ++_i166)
- {
- _key164 = iprot.readString();
- {
- org.apache.thrift.protocol.TSet _set167 = iprot.readSetBegin();
- _val165 = new HashSet<TSentryPrivilege>(2*_set167.size);
- TSentryPrivilege _elem168;
- for (int _i169 = 0; _i169 < _set167.size; ++_i169)
- {
- _elem168 = new TSentryPrivilege();
- _elem168.read(iprot);
- _val165.add(_elem168);
- }
- iprot.readSetEnd();
- }
- struct.rolePrivilegesMap.put(_key164, _val165);
- }
- iprot.readMapEnd();
- }
- struct.setRolePrivilegesMapIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // USER_ROLES_MAP
- if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
- {
- org.apache.thrift.protocol.TMap _map170 = iprot.readMapBegin();
- struct.userRolesMap = new HashMap<String,Set<String>>(2*_map170.size);
- String _key171;
- Set<String> _val172;
- for (int _i173 = 0; _i173 < _map170.size; ++_i173)
- {
- _key171 = iprot.readString();
- {
- org.apache.thrift.protocol.TSet _set174 = iprot.readSetBegin();
- _val172 = new HashSet<String>(2*_set174.size);
- String _elem175;
- for (int _i176 = 0; _i176 < _set174.size; ++_i176)
- {
- _elem175 = iprot.readString();
- _val172.add(_elem175);
- }
- iprot.readSetEnd();
- }
- struct.userRolesMap.put(_key171, _val172);
- }
- iprot.readMapEnd();
- }
- struct.setUserRolesMapIsSet(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, TSentryMappingData struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.groupRolesMap != null) {
- if (struct.isSetGroupRolesMap()) {
- oprot.writeFieldBegin(GROUP_ROLES_MAP_FIELD_DESC);
- {
- oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.SET, struct.groupRolesMap.size()));
- for (Map.Entry<String, Set<String>> _iter177 : struct.groupRolesMap.entrySet())
- {
- oprot.writeString(_iter177.getKey());
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, _iter177.getValue().size()));
- for (String _iter178 : _iter177.getValue())
- {
- oprot.writeString(_iter178);
- }
- oprot.writeSetEnd();
- }
- }
- oprot.writeMapEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- if (struct.rolePrivilegesMap != null) {
- if (struct.isSetRolePrivilegesMap()) {
- oprot.writeFieldBegin(ROLE_PRIVILEGES_MAP_FIELD_DESC);
- {
- oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.SET, struct.rolePrivilegesMap.size()));
- for (Map.Entry<String, Set<TSentryPrivilege>> _iter179 : struct.rolePrivilegesMap.entrySet())
- {
- oprot.writeString(_iter179.getKey());
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, _iter179.getValue().size()));
- for (TSentryPrivilege _iter180 : _iter179.getValue())
- {
- _iter180.write(oprot);
- }
- oprot.writeSetEnd();
- }
- }
- oprot.writeMapEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- if (struct.userRolesMap != null) {
- if (struct.isSetUserRolesMap()) {
- oprot.writeFieldBegin(USER_ROLES_MAP_FIELD_DESC);
- {
- oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.SET, struct.userRolesMap.size()));
- for (Map.Entry<String, Set<String>> _iter181 : struct.userRolesMap.entrySet())
- {
- oprot.writeString(_iter181.getKey());
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, _iter181.getValue().size()));
- for (String _iter182 : _iter181.getValue())
- {
- oprot.writeString(_iter182);
- }
- oprot.writeSetEnd();
- }
- }
- oprot.writeMapEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryMappingDataTupleSchemeFactory implements SchemeFactory {
- public TSentryMappingDataTupleScheme getScheme() {
- return new TSentryMappingDataTupleScheme();
- }
- }
-
- private static class TSentryMappingDataTupleScheme extends TupleScheme<TSentryMappingData> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryMappingData struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetGroupRolesMap()) {
- optionals.set(0);
- }
- if (struct.isSetRolePrivilegesMap()) {
- optionals.set(1);
- }
- if (struct.isSetUserRolesMap()) {
- optionals.set(2);
- }
- oprot.writeBitSet(optionals, 3);
- if (struct.isSetGroupRolesMap()) {
- {
- oprot.writeI32(struct.groupRolesMap.size());
- for (Map.Entry<String, Set<String>> _iter183 : struct.groupRolesMap.entrySet())
- {
- oprot.writeString(_iter183.getKey());
- {
- oprot.writeI32(_iter183.getValue().size());
- for (String _iter184 : _iter183.getValue())
- {
- oprot.writeString(_iter184);
- }
- }
- }
- }
- }
- if (struct.isSetRolePrivilegesMap()) {
- {
- oprot.writeI32(struct.rolePrivilegesMap.size());
- for (Map.Entry<String, Set<TSentryPrivilege>> _iter185 : struct.rolePrivilegesMap.entrySet())
- {
- oprot.writeString(_iter185.getKey());
- {
- oprot.writeI32(_iter185.getValue().size());
- for (TSentryPrivilege _iter186 : _iter185.getValue())
- {
- _iter186.write(oprot);
- }
- }
- }
- }
- }
- if (struct.isSetUserRolesMap()) {
- {
- oprot.writeI32(struct.userRolesMap.size());
- for (Map.Entry<String, Set<String>> _iter187 : struct.userRolesMap.entrySet())
- {
- oprot.writeString(_iter187.getKey());
- {
- oprot.writeI32(_iter187.getValue().size());
- for (String _iter188 : _iter187.getValue())
- {
- oprot.writeString(_iter188);
- }
- }
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryMappingData struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(3);
- if (incoming.get(0)) {
- {
- org.apache.thrift.protocol.TMap _map189 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.SET, iprot.readI32());
- struct.groupRolesMap = new HashMap<String,Set<String>>(2*_map189.size);
- String _key190;
- Set<String> _val191;
- for (int _i192 = 0; _i192 < _map189.size; ++_i192)
- {
- _key190 = iprot.readString();
- {
- org.apache.thrift.protocol.TSet _set193 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- _val191 = new HashSet<String>(2*_set193.size);
- String _elem194;
- for (int _i195 = 0; _i195 < _set193.size; ++_i195)
- {
- _elem194 = iprot.readString();
- _val191.add(_elem194);
- }
- }
- struct.groupRolesMap.put(_key190, _val191);
- }
- }
- struct.setGroupRolesMapIsSet(true);
- }
- if (incoming.get(1)) {
- {
- org.apache.thrift.protocol.TMap _map196 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.SET, iprot.readI32());
- struct.rolePrivilegesMap = new HashMap<String,Set<TSentryPrivilege>>(2*_map196.size);
- String _key197;
- Set<TSentryPrivilege> _val198;
- for (int _i199 = 0; _i199 < _map196.size; ++_i199)
- {
- _key197 = iprot.readString();
- {
- org.apache.thrift.protocol.TSet _set200 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- _val198 = new HashSet<TSentryPrivilege>(2*_set200.size);
- TSentryPrivilege _elem201;
- for (int _i202 = 0; _i202 < _set200.size; ++_i202)
- {
- _elem201 = new TSentryPrivilege();
- _elem201.read(iprot);
- _val198.add(_elem201);
- }
- }
- struct.rolePrivilegesMap.put(_key197, _val198);
- }
- }
- struct.setRolePrivilegesMapIsSet(true);
- }
- if (incoming.get(2)) {
- {
- org.apache.thrift.protocol.TMap _map203 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.SET, iprot.readI32());
- struct.userRolesMap = new HashMap<String,Set<String>>(2*_map203.size);
- String _key204;
- Set<String> _val205;
- for (int _i206 = 0; _i206 < _map203.size; ++_i206)
- {
- _key204 = iprot.readString();
- {
- org.apache.thrift.protocol.TSet _set207 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- _val205 = new HashSet<String>(2*_set207.size);
- String _elem208;
- for (int _i209 = 0; _i209 < _set207.size; ++_i209)
- {
- _elem208 = iprot.readString();
- _val205.add(_elem208);
- }
- }
- struct.userRolesMap.put(_key204, _val205);
- }
- }
- struct.setUserRolesMapIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilege.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilege.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilege.java
deleted file mode 100644
index 8c3e572..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilege.java
+++ /dev/null
@@ -1,1258 +0,0 @@
-/**
- * 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.provider.db.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 TSentryPrivilege implements org.apache.thrift.TBase<TSentryPrivilege, TSentryPrivilege._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryPrivilege> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryPrivilege");
-
- private static final org.apache.thrift.protocol.TField PRIVILEGE_SCOPE_FIELD_DESC = new org.apache.thrift.protocol.TField("privilegeScope", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final org.apache.thrift.protocol.TField SERVER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("serverName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField DB_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("dbName", org.apache.thrift.protocol.TType.STRING, (short)4);
- private static final org.apache.thrift.protocol.TField TABLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tableName", org.apache.thrift.protocol.TType.STRING, (short)5);
- private static final org.apache.thrift.protocol.TField URI_FIELD_DESC = new org.apache.thrift.protocol.TField("URI", org.apache.thrift.protocol.TType.STRING, (short)6);
- private static final org.apache.thrift.protocol.TField ACTION_FIELD_DESC = new org.apache.thrift.protocol.TField("action", org.apache.thrift.protocol.TType.STRING, (short)7);
- private static final org.apache.thrift.protocol.TField CREATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("createTime", org.apache.thrift.protocol.TType.I64, (short)8);
- private static final org.apache.thrift.protocol.TField GRANT_OPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("grantOption", org.apache.thrift.protocol.TType.I32, (short)9);
- private static final org.apache.thrift.protocol.TField COLUMN_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("columnName", org.apache.thrift.protocol.TType.STRING, (short)10);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryPrivilegeStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryPrivilegeTupleSchemeFactory());
- }
-
- private String privilegeScope; // required
- private String serverName; // required
- private String dbName; // optional
- private String tableName; // optional
- private String URI; // optional
- private String action; // required
- private long createTime; // optional
- private TSentryGrantOption grantOption; // optional
- private String columnName; // optional
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- PRIVILEGE_SCOPE((short)1, "privilegeScope"),
- SERVER_NAME((short)3, "serverName"),
- DB_NAME((short)4, "dbName"),
- TABLE_NAME((short)5, "tableName"),
- URI((short)6, "URI"),
- ACTION((short)7, "action"),
- CREATE_TIME((short)8, "createTime"),
- /**
- *
- * @see TSentryGrantOption
- */
- GRANT_OPTION((short)9, "grantOption"),
- COLUMN_NAME((short)10, "columnName");
-
- 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: // PRIVILEGE_SCOPE
- return PRIVILEGE_SCOPE;
- case 3: // SERVER_NAME
- return SERVER_NAME;
- case 4: // DB_NAME
- return DB_NAME;
- case 5: // TABLE_NAME
- return TABLE_NAME;
- case 6: // URI
- return URI;
- case 7: // ACTION
- return ACTION;
- case 8: // CREATE_TIME
- return CREATE_TIME;
- case 9: // GRANT_OPTION
- return GRANT_OPTION;
- case 10: // COLUMN_NAME
- return COLUMN_NAME;
- 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 __CREATETIME_ISSET_ID = 0;
- private byte __isset_bitfield = 0;
- private static final _Fields optionals[] = {_Fields.DB_NAME,_Fields.TABLE_NAME,_Fields.URI,_Fields.CREATE_TIME,_Fields.GRANT_OPTION,_Fields.COLUMN_NAME};
- 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.PRIVILEGE_SCOPE, new org.apache.thrift.meta_data.FieldMetaData("privilegeScope", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.SERVER_NAME, new org.apache.thrift.meta_data.FieldMetaData("serverName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.DB_NAME, new org.apache.thrift.meta_data.FieldMetaData("dbName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.TABLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("tableName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.URI, new org.apache.thrift.meta_data.FieldMetaData("URI", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ACTION, new org.apache.thrift.meta_data.FieldMetaData("action", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.CREATE_TIME, new org.apache.thrift.meta_data.FieldMetaData("createTime", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
- tmpMap.put(_Fields.GRANT_OPTION, new org.apache.thrift.meta_data.FieldMetaData("grantOption", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TSentryGrantOption.class)));
- tmpMap.put(_Fields.COLUMN_NAME, new org.apache.thrift.meta_data.FieldMetaData("columnName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryPrivilege.class, metaDataMap);
- }
-
- public TSentryPrivilege() {
- this.dbName = "";
-
- this.tableName = "";
-
- this.URI = "";
-
- this.action = "";
-
- this.grantOption = org.apache.sentry.provider.db.service.thrift.TSentryGrantOption.FALSE;
-
- this.columnName = "";
-
- }
-
- public TSentryPrivilege(
- String privilegeScope,
- String serverName,
- String action)
- {
- this();
- this.privilegeScope = privilegeScope;
- this.serverName = serverName;
- this.action = action;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryPrivilege(TSentryPrivilege other) {
- __isset_bitfield = other.__isset_bitfield;
- if (other.isSetPrivilegeScope()) {
- this.privilegeScope = other.privilegeScope;
- }
- if (other.isSetServerName()) {
- this.serverName = other.serverName;
- }
- if (other.isSetDbName()) {
- this.dbName = other.dbName;
- }
- if (other.isSetTableName()) {
- this.tableName = other.tableName;
- }
- if (other.isSetURI()) {
- this.URI = other.URI;
- }
- if (other.isSetAction()) {
- this.action = other.action;
- }
- this.createTime = other.createTime;
- if (other.isSetGrantOption()) {
- this.grantOption = other.grantOption;
- }
- if (other.isSetColumnName()) {
- this.columnName = other.columnName;
- }
- }
-
- public TSentryPrivilege deepCopy() {
- return new TSentryPrivilege(this);
- }
-
- @Override
- public void clear() {
- this.privilegeScope = null;
- this.serverName = null;
- this.dbName = "";
-
- this.tableName = "";
-
- this.URI = "";
-
- this.action = "";
-
- setCreateTimeIsSet(false);
- this.createTime = 0;
- this.grantOption = org.apache.sentry.provider.db.service.thrift.TSentryGrantOption.FALSE;
-
- this.columnName = "";
-
- }
-
- public String getPrivilegeScope() {
- return this.privilegeScope;
- }
-
- public void setPrivilegeScope(String privilegeScope) {
- this.privilegeScope = privilegeScope;
- }
-
- public void unsetPrivilegeScope() {
- this.privilegeScope = null;
- }
-
- /** Returns true if field privilegeScope is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivilegeScope() {
- return this.privilegeScope != null;
- }
-
- public void setPrivilegeScopeIsSet(boolean value) {
- if (!value) {
- this.privilegeScope = null;
- }
- }
-
- public String getServerName() {
- return this.serverName;
- }
-
- public void setServerName(String serverName) {
- this.serverName = serverName;
- }
-
- public void unsetServerName() {
- this.serverName = null;
- }
-
- /** Returns true if field serverName is set (has been assigned a value) and false otherwise */
- public boolean isSetServerName() {
- return this.serverName != null;
- }
-
- public void setServerNameIsSet(boolean value) {
- if (!value) {
- this.serverName = null;
- }
- }
-
- public String getDbName() {
- return this.dbName;
- }
-
- public void setDbName(String dbName) {
- this.dbName = dbName;
- }
-
- public void unsetDbName() {
- this.dbName = null;
- }
-
- /** Returns true if field dbName is set (has been assigned a value) and false otherwise */
- public boolean isSetDbName() {
- return this.dbName != null;
- }
-
- public void setDbNameIsSet(boolean value) {
- if (!value) {
- this.dbName = null;
- }
- }
-
- public String getTableName() {
- return this.tableName;
- }
-
- public void setTableName(String tableName) {
- this.tableName = tableName;
- }
-
- public void unsetTableName() {
- this.tableName = null;
- }
-
- /** Returns true if field tableName is set (has been assigned a value) and false otherwise */
- public boolean isSetTableName() {
- return this.tableName != null;
- }
-
- public void setTableNameIsSet(boolean value) {
- if (!value) {
- this.tableName = null;
- }
- }
-
- public String getURI() {
- return this.URI;
- }
-
- public void setURI(String URI) {
- this.URI = URI;
- }
-
- public void unsetURI() {
- this.URI = null;
- }
-
- /** Returns true if field URI is set (has been assigned a value) and false otherwise */
- public boolean isSetURI() {
- return this.URI != null;
- }
-
- public void setURIIsSet(boolean value) {
- if (!value) {
- this.URI = null;
- }
- }
-
- public String getAction() {
- return this.action;
- }
-
- public void setAction(String action) {
- this.action = action;
- }
-
- public void unsetAction() {
- this.action = null;
- }
-
- /** Returns true if field action is set (has been assigned a value) and false otherwise */
- public boolean isSetAction() {
- return this.action != null;
- }
-
- public void setActionIsSet(boolean value) {
- if (!value) {
- this.action = null;
- }
- }
-
- public long getCreateTime() {
- return this.createTime;
- }
-
- public void setCreateTime(long createTime) {
- this.createTime = createTime;
- setCreateTimeIsSet(true);
- }
-
- public void unsetCreateTime() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CREATETIME_ISSET_ID);
- }
-
- /** Returns true if field createTime is set (has been assigned a value) and false otherwise */
- public boolean isSetCreateTime() {
- return EncodingUtils.testBit(__isset_bitfield, __CREATETIME_ISSET_ID);
- }
-
- public void setCreateTimeIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CREATETIME_ISSET_ID, value);
- }
-
- /**
- *
- * @see TSentryGrantOption
- */
- public TSentryGrantOption getGrantOption() {
- return this.grantOption;
- }
-
- /**
- *
- * @see TSentryGrantOption
- */
- public void setGrantOption(TSentryGrantOption grantOption) {
- this.grantOption = grantOption;
- }
-
- public void unsetGrantOption() {
- this.grantOption = null;
- }
-
- /** Returns true if field grantOption is set (has been assigned a value) and false otherwise */
- public boolean isSetGrantOption() {
- return this.grantOption != null;
- }
-
- public void setGrantOptionIsSet(boolean value) {
- if (!value) {
- this.grantOption = null;
- }
- }
-
- public String getColumnName() {
- return this.columnName;
- }
-
- public void setColumnName(String columnName) {
- this.columnName = columnName;
- }
-
- public void unsetColumnName() {
- this.columnName = null;
- }
-
- /** Returns true if field columnName is set (has been assigned a value) and false otherwise */
- public boolean isSetColumnName() {
- return this.columnName != null;
- }
-
- public void setColumnNameIsSet(boolean value) {
- if (!value) {
- this.columnName = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case PRIVILEGE_SCOPE:
- if (value == null) {
- unsetPrivilegeScope();
- } else {
- setPrivilegeScope((String)value);
- }
- break;
-
- case SERVER_NAME:
- if (value == null) {
- unsetServerName();
- } else {
- setServerName((String)value);
- }
- break;
-
- case DB_NAME:
- if (value == null) {
- unsetDbName();
- } else {
- setDbName((String)value);
- }
- break;
-
- case TABLE_NAME:
- if (value == null) {
- unsetTableName();
- } else {
- setTableName((String)value);
- }
- break;
-
- case URI:
- if (value == null) {
- unsetURI();
- } else {
- setURI((String)value);
- }
- break;
-
- case ACTION:
- if (value == null) {
- unsetAction();
- } else {
- setAction((String)value);
- }
- break;
-
- case CREATE_TIME:
- if (value == null) {
- unsetCreateTime();
- } else {
- setCreateTime((Long)value);
- }
- break;
-
- case GRANT_OPTION:
- if (value == null) {
- unsetGrantOption();
- } else {
- setGrantOption((TSentryGrantOption)value);
- }
- break;
-
- case COLUMN_NAME:
- if (value == null) {
- unsetColumnName();
- } else {
- setColumnName((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PRIVILEGE_SCOPE:
- return getPrivilegeScope();
-
- case SERVER_NAME:
- return getServerName();
-
- case DB_NAME:
- return getDbName();
-
- case TABLE_NAME:
- return getTableName();
-
- case URI:
- return getURI();
-
- case ACTION:
- return getAction();
-
- case CREATE_TIME:
- return getCreateTime();
-
- case GRANT_OPTION:
- return getGrantOption();
-
- case COLUMN_NAME:
- return getColumnName();
-
- }
- 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 PRIVILEGE_SCOPE:
- return isSetPrivilegeScope();
- case SERVER_NAME:
- return isSetServerName();
- case DB_NAME:
- return isSetDbName();
- case TABLE_NAME:
- return isSetTableName();
- case URI:
- return isSetURI();
- case ACTION:
- return isSetAction();
- case CREATE_TIME:
- return isSetCreateTime();
- case GRANT_OPTION:
- return isSetGrantOption();
- case COLUMN_NAME:
- return isSetColumnName();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryPrivilege)
- return this.equals((TSentryPrivilege)that);
- return false;
- }
-
- public boolean equals(TSentryPrivilege that) {
- if (that == null)
- return false;
-
- boolean this_present_privilegeScope = true && this.isSetPrivilegeScope();
- boolean that_present_privilegeScope = true && that.isSetPrivilegeScope();
- if (this_present_privilegeScope || that_present_privilegeScope) {
- if (!(this_present_privilegeScope && that_present_privilegeScope))
- return false;
- if (!this.privilegeScope.equals(that.privilegeScope))
- return false;
- }
-
- boolean this_present_serverName = true && this.isSetServerName();
- boolean that_present_serverName = true && that.isSetServerName();
- if (this_present_serverName || that_present_serverName) {
- if (!(this_present_serverName && that_present_serverName))
- return false;
- if (!this.serverName.equals(that.serverName))
- return false;
- }
-
- boolean this_present_dbName = true && this.isSetDbName();
- boolean that_present_dbName = true && that.isSetDbName();
- if (this_present_dbName || that_present_dbName) {
- if (!(this_present_dbName && that_present_dbName))
- return false;
- if (!this.dbName.equals(that.dbName))
- return false;
- }
-
- boolean this_present_tableName = true && this.isSetTableName();
- boolean that_present_tableName = true && that.isSetTableName();
- if (this_present_tableName || that_present_tableName) {
- if (!(this_present_tableName && that_present_tableName))
- return false;
- if (!this.tableName.equals(that.tableName))
- return false;
- }
-
- boolean this_present_URI = true && this.isSetURI();
- boolean that_present_URI = true && that.isSetURI();
- if (this_present_URI || that_present_URI) {
- if (!(this_present_URI && that_present_URI))
- return false;
- if (!this.URI.equals(that.URI))
- return false;
- }
-
- boolean this_present_action = true && this.isSetAction();
- boolean that_present_action = true && that.isSetAction();
- if (this_present_action || that_present_action) {
- if (!(this_present_action && that_present_action))
- return false;
- if (!this.action.equals(that.action))
- return false;
- }
-
- boolean this_present_createTime = true && this.isSetCreateTime();
- boolean that_present_createTime = true && that.isSetCreateTime();
- if (this_present_createTime || that_present_createTime) {
- if (!(this_present_createTime && that_present_createTime))
- return false;
- if (this.createTime != that.createTime)
- return false;
- }
-
- boolean this_present_grantOption = true && this.isSetGrantOption();
- boolean that_present_grantOption = true && that.isSetGrantOption();
- if (this_present_grantOption || that_present_grantOption) {
- if (!(this_present_grantOption && that_present_grantOption))
- return false;
- if (!this.grantOption.equals(that.grantOption))
- return false;
- }
-
- boolean this_present_columnName = true && this.isSetColumnName();
- boolean that_present_columnName = true && that.isSetColumnName();
- if (this_present_columnName || that_present_columnName) {
- if (!(this_present_columnName && that_present_columnName))
- return false;
- if (!this.columnName.equals(that.columnName))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List<Object> list = new ArrayList<Object>();
-
- boolean present_privilegeScope = true && (isSetPrivilegeScope());
- list.add(present_privilegeScope);
- if (present_privilegeScope)
- list.add(privilegeScope);
-
- boolean present_serverName = true && (isSetServerName());
- list.add(present_serverName);
- if (present_serverName)
- list.add(serverName);
-
- boolean present_dbName = true && (isSetDbName());
- list.add(present_dbName);
- if (present_dbName)
- list.add(dbName);
-
- boolean present_tableName = true && (isSetTableName());
- list.add(present_tableName);
- if (present_tableName)
- list.add(tableName);
-
- boolean present_URI = true && (isSetURI());
- list.add(present_URI);
- if (present_URI)
- list.add(URI);
-
- boolean present_action = true && (isSetAction());
- list.add(present_action);
- if (present_action)
- list.add(action);
-
- boolean present_createTime = true && (isSetCreateTime());
- list.add(present_createTime);
- if (present_createTime)
- list.add(createTime);
-
- boolean present_grantOption = true && (isSetGrantOption());
- list.add(present_grantOption);
- if (present_grantOption)
- list.add(grantOption.getValue());
-
- boolean present_columnName = true && (isSetColumnName());
- list.add(present_columnName);
- if (present_columnName)
- list.add(columnName);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TSentryPrivilege other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetPrivilegeScope()).compareTo(other.isSetPrivilegeScope());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivilegeScope()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilegeScope, other.privilegeScope);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetServerName()).compareTo(other.isSetServerName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetServerName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serverName, other.serverName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetDbName()).compareTo(other.isSetDbName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetDbName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dbName, other.dbName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetTableName()).compareTo(other.isSetTableName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetTableName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tableName, other.tableName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetURI()).compareTo(other.isSetURI());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetURI()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.URI, other.URI);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetAction()).compareTo(other.isSetAction());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAction()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.action, other.action);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetCreateTime()).compareTo(other.isSetCreateTime());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetCreateTime()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.createTime, other.createTime);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGrantOption()).compareTo(other.isSetGrantOption());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGrantOption()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.grantOption, other.grantOption);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetColumnName()).compareTo(other.isSetColumnName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetColumnName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columnName, other.columnName);
- 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("TSentryPrivilege(");
- boolean first = true;
-
- sb.append("privilegeScope:");
- if (this.privilegeScope == null) {
- sb.append("null");
- } else {
- sb.append(this.privilegeScope);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("serverName:");
- if (this.serverName == null) {
- sb.append("null");
- } else {
- sb.append(this.serverName);
- }
- first = false;
- if (isSetDbName()) {
- if (!first) sb.append(", ");
- sb.append("dbName:");
- if (this.dbName == null) {
- sb.append("null");
- } else {
- sb.append(this.dbName);
- }
- first = false;
- }
- if (isSetTableName()) {
- if (!first) sb.append(", ");
- sb.append("tableName:");
- if (this.tableName == null) {
- sb.append("null");
- } else {
- sb.append(this.tableName);
- }
- first = false;
- }
- if (isSetURI()) {
- if (!first) sb.append(", ");
- sb.append("URI:");
- if (this.URI == null) {
- sb.append("null");
- } else {
- sb.append(this.URI);
- }
- first = false;
- }
- if (!first) sb.append(", ");
- sb.append("action:");
- if (this.action == null) {
- sb.append("null");
- } else {
- sb.append(this.action);
- }
- first = false;
- if (isSetCreateTime()) {
- if (!first) sb.append(", ");
- sb.append("createTime:");
- sb.append(this.createTime);
- first = false;
- }
- if (isSetGrantOption()) {
- if (!first) sb.append(", ");
- sb.append("grantOption:");
- if (this.grantOption == null) {
- sb.append("null");
- } else {
- sb.append(this.grantOption);
- }
- first = false;
- }
- if (isSetColumnName()) {
- if (!first) sb.append(", ");
- sb.append("columnName:");
- if (this.columnName == null) {
- sb.append("null");
- } else {
- sb.append(this.columnName);
- }
- first = false;
- }
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetPrivilegeScope()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilegeScope' is unset! Struct:" + toString());
- }
-
- if (!isSetServerName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'serverName' is unset! Struct:" + toString());
- }
-
- if (!isSetAction()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'action' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TSentryPrivilegeStandardSchemeFactory implements SchemeFactory {
- public TSentryPrivilegeStandardScheme getScheme() {
- return new TSentryPrivilegeStandardScheme();
- }
- }
-
- private static class TSentryPrivilegeStandardScheme extends StandardScheme<TSentryPrivilege> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryPrivilege 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: // PRIVILEGE_SCOPE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.privilegeScope = iprot.readString();
- struct.setPrivilegeScopeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // SERVER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.serverName = iprot.readString();
- struct.setServerNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // DB_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.dbName = iprot.readString();
- struct.setDbNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // TABLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.tableName = iprot.readString();
- struct.setTableNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 6: // URI
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.URI = iprot.readString();
- struct.setURIIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 7: // ACTION
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.action = iprot.readString();
- struct.setActionIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 8: // CREATE_TIME
- if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
- struct.createTime = iprot.readI64();
- struct.setCreateTimeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 9: // GRANT_OPTION
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.grantOption = org.apache.sentry.provider.db.service.thrift.TSentryGrantOption.findByValue(iprot.readI32());
- struct.setGrantOptionIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 10: // COLUMN_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.columnName = iprot.readString();
- struct.setColumnNameIsSet(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, TSentryPrivilege struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.privilegeScope != null) {
- oprot.writeFieldBegin(PRIVILEGE_SCOPE_FIELD_DESC);
- oprot.writeString(struct.privilegeScope);
- oprot.writeFieldEnd();
- }
- if (struct.serverName != null) {
- oprot.writeFieldBegin(SERVER_NAME_FIELD_DESC);
- oprot.writeString(struct.serverName);
- oprot.writeFieldEnd();
- }
- if (struct.dbName != null) {
- if (struct.isSetDbName()) {
- oprot.writeFieldBegin(DB_NAME_FIELD_DESC);
- oprot.writeString(struct.dbName);
- oprot.writeFieldEnd();
- }
- }
- if (struct.tableName != null) {
- if (struct.isSetTableName()) {
- oprot.writeFieldBegin(TABLE_NAME_FIELD_DESC);
- oprot.writeString(struct.tableName);
- oprot.writeFieldEnd();
- }
- }
- if (struct.URI != null) {
- if (struct.isSetURI()) {
- oprot.writeFieldBegin(URI_FIELD_DESC);
- oprot.writeString(struct.URI);
- oprot.writeFieldEnd();
- }
- }
- if (struct.action != null) {
- oprot.writeFieldBegin(ACTION_FIELD_DESC);
- oprot.writeString(struct.action);
- oprot.writeFieldEnd();
- }
- if (struct.isSetCreateTime()) {
- oprot.writeFieldBegin(CREATE_TIME_FIELD_DESC);
- oprot.writeI64(struct.createTime);
- oprot.writeFieldEnd();
- }
- if (struct.grantOption != null) {
- if (struct.isSetGrantOption()) {
- oprot.writeFieldBegin(GRANT_OPTION_FIELD_DESC);
- oprot.writeI32(struct.grantOption.getValue());
- oprot.writeFieldEnd();
- }
- }
- if (struct.columnName != null) {
- if (struct.isSetColumnName()) {
- oprot.writeFieldBegin(COLUMN_NAME_FIELD_DESC);
- oprot.writeString(struct.columnName);
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryPrivilegeTupleSchemeFactory implements SchemeFactory {
- public TSentryPrivilegeTupleScheme getScheme() {
- return new TSentryPrivilegeTupleScheme();
- }
- }
-
- private static class TSentryPrivilegeTupleScheme extends TupleScheme<TSentryPrivilege> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryPrivilege struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeString(struct.privilegeScope);
- oprot.writeString(struct.serverName);
- oprot.writeString(struct.action);
- BitSet optionals = new BitSet();
- if (struct.isSetDbName()) {
- optionals.set(0);
- }
- if (struct.isSetTableName()) {
- optionals.set(1);
- }
- if (struct.isSetURI()) {
- optionals.set(2);
- }
- if (struct.isSetCreateTime()) {
- optionals.set(3);
- }
- if (struct.isSetGrantOption()) {
- optionals.set(4);
- }
- if (struct.isSetColumnName()) {
- optionals.set(5);
- }
- oprot.writeBitSet(optionals, 6);
- if (struct.isSetDbName()) {
- oprot.writeString(struct.dbName);
- }
- if (struct.isSetTableName()) {
- oprot.writeString(struct.tableName);
- }
- if (struct.isSetURI()) {
- oprot.writeString(struct.URI);
- }
- if (struct.isSetCreateTime()) {
- oprot.writeI64(struct.createTime);
- }
- if (struct.isSetGrantOption()) {
- oprot.writeI32(struct.grantOption.getValue());
- }
- if (struct.isSetColumnName()) {
- oprot.writeString(struct.columnName);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryPrivilege struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.privilegeScope = iprot.readString();
- struct.setPrivilegeScopeIsSet(true);
- struct.serverName = iprot.readString();
- struct.setServerNameIsSet(true);
- struct.action = iprot.readString();
- struct.setActionIsSet(true);
- BitSet incoming = iprot.readBitSet(6);
- if (incoming.get(0)) {
- struct.dbName = iprot.readString();
- struct.setDbNameIsSet(true);
- }
- if (incoming.get(1)) {
- struct.tableName = iprot.readString();
- struct.setTableNameIsSet(true);
- }
- if (incoming.get(2)) {
- struct.URI = iprot.readString();
- struct.setURIIsSet(true);
- }
- if (incoming.get(3)) {
- struct.createTime = iprot.readI64();
- struct.setCreateTimeIsSet(true);
- }
- if (incoming.get(4)) {
- struct.grantOption = org.apache.sentry.provider.db.service.thrift.TSentryGrantOption.findByValue(iprot.readI32());
- struct.setGrantOptionIsSet(true);
- }
- if (incoming.get(5)) {
- struct.columnName = iprot.readString();
- struct.setColumnNameIsSet(true);
- }
- }
- }
-
-}
-
[06/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TDropPrivilegesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TDropPrivilegesResponse.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TDropPrivilegesResponse.java
new file mode 100644
index 0000000..a518119
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TDropPrivilegesResponse.java
@@ -0,0 +1,391 @@
+/**
+ * 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.generic.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 TDropPrivilegesResponse implements org.apache.thrift.TBase<TDropPrivilegesResponse, TDropPrivilegesResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TDropPrivilegesResponse> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropPrivilegesResponse");
+
+ 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TDropPrivilegesResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TDropPrivilegesResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
+
+ 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;
+ 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropPrivilegesResponse.class, metaDataMap);
+ }
+
+ public TDropPrivilegesResponse() {
+ }
+
+ public TDropPrivilegesResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TDropPrivilegesResponse(TDropPrivilegesResponse other) {
+ if (other.isSetStatus()) {
+ this.status = other.status;
+ }
+ }
+
+ public TDropPrivilegesResponse deepCopy() {
+ return new TDropPrivilegesResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ }
+
+ 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 void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ }
+ 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();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TDropPrivilegesResponse)
+ return this.equals((TDropPrivilegesResponse)that);
+ return false;
+ }
+
+ public boolean equals(TDropPrivilegesResponse 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;
+ }
+
+ 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);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TDropPrivilegesResponse 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;
+ }
+ }
+ 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("TDropPrivilegesResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ 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());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TDropPrivilegesResponseStandardSchemeFactory implements SchemeFactory {
+ public TDropPrivilegesResponseStandardScheme getScheme() {
+ return new TDropPrivilegesResponseStandardScheme();
+ }
+ }
+
+ private static class TDropPrivilegesResponseStandardScheme extends StandardScheme<TDropPrivilegesResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TDropPrivilegesResponse 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;
+ 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, TDropPrivilegesResponse 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.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TDropPrivilegesResponseTupleSchemeFactory implements SchemeFactory {
+ public TDropPrivilegesResponseTupleScheme getScheme() {
+ return new TDropPrivilegesResponseTupleScheme();
+ }
+ }
+
+ private static class TDropPrivilegesResponseTupleScheme extends TupleScheme<TDropPrivilegesResponse> {
+
+ @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 read(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesResponse 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);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TDropSentryRoleRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TDropSentryRoleRequest.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TDropSentryRoleRequest.java
new file mode 100644
index 0000000..29611fa
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TDropSentryRoleRequest.java
@@ -0,0 +1,692 @@
+/**
+ * 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.generic.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 TDropSentryRoleRequest implements org.apache.thrift.TBase<TDropSentryRoleRequest, TDropSentryRoleRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TDropSentryRoleRequest> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropSentryRoleRequest");
+
+ 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TDropSentryRoleRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TDropSentryRoleRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String roleName; // required
+ private String component; // 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"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ ROLE_NAME((short)3, "roleName"),
+ COMPONENT((short)4, "component");
+
+ 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: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // ROLE_NAME
+ return ROLE_NAME;
+ case 4: // COMPONENT
+ return COMPONENT;
+ 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropSentryRoleRequest.class, metaDataMap);
+ }
+
+ public TDropSentryRoleRequest() {
+ this.protocol_version = 2;
+
+ }
+
+ public TDropSentryRoleRequest(
+ int protocol_version,
+ String requestorUserName,
+ String roleName,
+ String component)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.roleName = roleName;
+ this.component = component;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TDropSentryRoleRequest(TDropSentryRoleRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetRoleName()) {
+ this.roleName = other.roleName;
+ }
+ if (other.isSetComponent()) {
+ this.component = other.component;
+ }
+ }
+
+ public TDropSentryRoleRequest deepCopy() {
+ return new TDropSentryRoleRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 2;
+
+ this.requestorUserName = null;
+ this.roleName = null;
+ this.component = 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 String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public String getRoleName() {
+ return this.roleName;
+ }
+
+ public void setRoleName(String roleName) {
+ this.roleName = roleName;
+ }
+
+ public void unsetRoleName() {
+ this.roleName = null;
+ }
+
+ /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRoleName() {
+ return this.roleName != null;
+ }
+
+ public void setRoleNameIsSet(boolean value) {
+ if (!value) {
+ this.roleName = null;
+ }
+ }
+
+ public String getComponent() {
+ return this.component;
+ }
+
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ public void unsetComponent() {
+ this.component = null;
+ }
+
+ /** Returns true if field component is set (has been assigned a value) and false otherwise */
+ public boolean isSetComponent() {
+ return this.component != null;
+ }
+
+ public void setComponentIsSet(boolean value) {
+ if (!value) {
+ this.component = 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 REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case ROLE_NAME:
+ if (value == null) {
+ unsetRoleName();
+ } else {
+ setRoleName((String)value);
+ }
+ break;
+
+ case COMPONENT:
+ if (value == null) {
+ unsetComponent();
+ } else {
+ setComponent((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return getProtocol_version();
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case ROLE_NAME:
+ return getRoleName();
+
+ case COMPONENT:
+ return getComponent();
+
+ }
+ 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 REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case ROLE_NAME:
+ return isSetRoleName();
+ case COMPONENT:
+ return isSetComponent();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TDropSentryRoleRequest)
+ return this.equals((TDropSentryRoleRequest)that);
+ return false;
+ }
+
+ public boolean equals(TDropSentryRoleRequest 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_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_roleName = true && this.isSetRoleName();
+ boolean that_present_roleName = true && that.isSetRoleName();
+ if (this_present_roleName || that_present_roleName) {
+ if (!(this_present_roleName && that_present_roleName))
+ return false;
+ if (!this.roleName.equals(that.roleName))
+ return false;
+ }
+
+ boolean this_present_component = true && this.isSetComponent();
+ boolean that_present_component = true && that.isSetComponent();
+ if (this_present_component || that_present_component) {
+ if (!(this_present_component && that_present_component))
+ return false;
+ if (!this.component.equals(that.component))
+ 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_requestorUserName = true && (isSetRequestorUserName());
+ list.add(present_requestorUserName);
+ if (present_requestorUserName)
+ list.add(requestorUserName);
+
+ boolean present_roleName = true && (isSetRoleName());
+ list.add(present_roleName);
+ if (present_roleName)
+ list.add(roleName);
+
+ boolean present_component = true && (isSetComponent());
+ list.add(present_component);
+ if (present_component)
+ list.add(component);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TDropSentryRoleRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetComponent()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
+ 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("TDropSentryRoleRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("roleName:");
+ if (this.roleName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roleName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("component:");
+ if (this.component == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.component);
+ }
+ 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 (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRoleName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetComponent()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TDropSentryRoleRequestStandardSchemeFactory implements SchemeFactory {
+ public TDropSentryRoleRequestStandardScheme getScheme() {
+ return new TDropSentryRoleRequestStandardScheme();
+ }
+ }
+
+ private static class TDropSentryRoleRequestStandardScheme extends StandardScheme<TDropSentryRoleRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TDropSentryRoleRequest 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: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // ROLE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // COMPONENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(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, TDropSentryRoleRequest 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();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.roleName != null) {
+ oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
+ oprot.writeString(struct.roleName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.component != null) {
+ oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
+ oprot.writeString(struct.component);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TDropSentryRoleRequestTupleSchemeFactory implements SchemeFactory {
+ public TDropSentryRoleRequestTupleScheme getScheme() {
+ return new TDropSentryRoleRequestTupleScheme();
+ }
+ }
+
+ private static class TDropSentryRoleRequestTupleScheme extends TupleScheme<TDropSentryRoleRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeString(struct.roleName);
+ oprot.writeString(struct.component);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TDropSentryRoleResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TDropSentryRoleResponse.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TDropSentryRoleResponse.java
new file mode 100644
index 0000000..eaf6b30
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TDropSentryRoleResponse.java
@@ -0,0 +1,391 @@
+/**
+ * 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.generic.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 TDropSentryRoleResponse implements org.apache.thrift.TBase<TDropSentryRoleResponse, TDropSentryRoleResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TDropSentryRoleResponse> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropSentryRoleResponse");
+
+ 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TDropSentryRoleResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TDropSentryRoleResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
+
+ 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;
+ 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropSentryRoleResponse.class, metaDataMap);
+ }
+
+ public TDropSentryRoleResponse() {
+ }
+
+ public TDropSentryRoleResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TDropSentryRoleResponse(TDropSentryRoleResponse other) {
+ if (other.isSetStatus()) {
+ this.status = other.status;
+ }
+ }
+
+ public TDropSentryRoleResponse deepCopy() {
+ return new TDropSentryRoleResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ }
+
+ 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 void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ }
+ 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();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TDropSentryRoleResponse)
+ return this.equals((TDropSentryRoleResponse)that);
+ return false;
+ }
+
+ public boolean equals(TDropSentryRoleResponse 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;
+ }
+
+ 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);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TDropSentryRoleResponse 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;
+ }
+ }
+ 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("TDropSentryRoleResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ 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());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TDropSentryRoleResponseStandardSchemeFactory implements SchemeFactory {
+ public TDropSentryRoleResponseStandardScheme getScheme() {
+ return new TDropSentryRoleResponseStandardScheme();
+ }
+ }
+
+ private static class TDropSentryRoleResponseStandardScheme extends StandardScheme<TDropSentryRoleResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TDropSentryRoleResponse 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;
+ 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, TDropSentryRoleResponse 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.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TDropSentryRoleResponseTupleSchemeFactory implements SchemeFactory {
+ public TDropSentryRoleResponseTupleScheme getScheme() {
+ return new TDropSentryRoleResponseTupleScheme();
+ }
+ }
+
+ private static class TDropSentryRoleResponseTupleScheme extends TupleScheme<TDropSentryRoleResponse> {
+
+ @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 read(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleResponse 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);
+ }
+ }
+
+}
+
[15/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericServiceIntegrationBase.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericServiceIntegrationBase.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericServiceIntegrationBase.java
deleted file mode 100644
index 94cade1..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/SentryGenericServiceIntegrationBase.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.generic.service.thrift;
-
-import java.security.PrivilegedExceptionAction;
-import java.util.Set;
-
-import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.junit.After;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SentryGenericServiceIntegrationBase extends SentryServiceIntegrationBase {
- private static final Logger LOGGER = LoggerFactory.getLogger(SentryGenericServiceIntegrationBase.class);
- protected static final String SOLR = "SOLR";
- protected SentryGenericServiceClient client;
-
- /**
- * use the generic client to connect sentry service
- */
- @Override
- public void connectToSentryService() throws Exception {
- // The client should already be logged in when running in solr
- // therefore we must manually login in the integration tests
- if (kerberos) {
- this.client = clientUgi.doAs( new PrivilegedExceptionAction<SentryGenericServiceClient>() {
- @Override
- public SentryGenericServiceClient run() throws Exception {
- return SentryGenericServiceClientFactory.create(conf);
- }
- });
- } else {
- this.client = SentryGenericServiceClientFactory.create(conf);
- }
- }
-
- @After
- public void after() {
- try {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- Set<TSentryRole> tRoles = client.listAllRoles(ADMIN_USER, SOLR);
- for (TSentryRole tRole : tRoles) {
- client.dropRole(ADMIN_USER, tRole.getRoleName(), SOLR);
- }
- if(client != null) {
- client.close();
- }
- }
- });
- } catch (Exception e) {
- LOGGER.error(e.getMessage(), e);
- } finally {
- policyFilePath.delete();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/TestAuditLogForSentryGenericService.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/TestAuditLogForSentryGenericService.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/TestAuditLogForSentryGenericService.java
deleted file mode 100644
index fbf8af3..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/TestAuditLogForSentryGenericService.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.generic.service.thrift;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.security.PrivilegedExceptionAction;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.sentry.provider.db.log.appender.AuditLoggerTestAppender;
-import org.apache.sentry.provider.db.log.util.CommandUtil;
-import org.apache.sentry.provider.db.log.util.Constants;
-import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.codehaus.jettison.json.JSONObject;
-import org.junit.After;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-public class TestAuditLogForSentryGenericService extends SentryServiceIntegrationBase {
-
- private SentryGenericServiceClient client;
- private static final String COMPONENT = "SQOOP";
- private static final org.slf4j.Logger LOGGER = LoggerFactory
- .getLogger(TestAuditLogForSentryGenericService.class);
-
- @BeforeClass
- public static void setup() throws Exception {
- SentryServiceIntegrationBase.setup();
- Logger logger = Logger.getLogger("sentry.generic.authorization.ddl.logger");
- AuditLoggerTestAppender testAppender = new AuditLoggerTestAppender();
- logger.addAppender(testAppender);
- logger.setLevel(Level.INFO);
- }
-
- @Override
- @After
- public void after() {
- try {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- Set<TSentryRole> tRoles = client.listAllRoles(ADMIN_USER, COMPONENT);
- for (TSentryRole tRole : tRoles) {
- client.dropRole(ADMIN_USER, tRole.getRoleName(), COMPONENT);
- }
- if (client != null) {
- client.close();
- }
- }
- });
- } catch (Exception e) {
- // log the exception
- LOGGER.warn("Exception happened after test case.", e);
- } finally {
- policyFilePath.delete();
- }
- }
-
- /**
- * use the generic client to connect sentry service
- */
- @Override
- public void connectToSentryService() throws Exception {
- if (kerberos) {
- this.client = clientUgi.doAs(new PrivilegedExceptionAction<SentryGenericServiceClient>() {
- @Override
- public SentryGenericServiceClient run() throws Exception {
- return SentryGenericServiceClientFactory.create(conf);
- }
- });
- } else {
- this.client = SentryGenericServiceClientFactory.create(conf);
- }
- }
-
- @Test
- public void testAuditLogForGenericModel() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- String roleName = "admin_r";
- String testGroupName = "g1";
- String action = "all";
- String service = "sentryService";
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- // test the audit log for create role, success
- client.createRole(requestorUserName, roleName, COMPONENT);
- Map<String, String> fieldValueMap = new HashMap<String, String>();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_CREATE_ROLE);
- fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "CREATE ROLE " + roleName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
-
- // test the audit log for create role, failed
- try {
- client.createRole(requestorUserName, roleName, COMPONENT);
- fail("Exception should have been thrown");
- } catch (Exception e) {
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_CREATE_ROLE);
- fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "CREATE ROLE " + roleName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- }
-
- // test the audit log for add role to group, success
- client.grantRoleToGroups(requestorUserName, roleName, COMPONENT,
- Sets.newHashSet(testGroupName));
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_ADD_ROLE);
- fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT ROLE " + roleName
- + " TO GROUP " + testGroupName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
-
- // test the audit log for add role to group, failed
- try {
- client.grantRoleToGroups(requestorUserName, "invalidRole", COMPONENT,
- Sets.newHashSet(testGroupName));
- fail("Exception should have been thrown");
- } catch (Exception e) {
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_ADD_ROLE);
- fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "GRANT ROLE invalidRole TO GROUP "
- + testGroupName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- }
-
- // test the audit log for grant privilege, success
- TSentryPrivilege privilege = new TSentryPrivilege(COMPONENT, service, Lists.newArrayList(
- new TAuthorizable("resourceType1", "resourceName1"), new TAuthorizable("resourceType2",
- "resourceName2")), action);
- client.grantPrivilege(requestorUserName, roleName, COMPONENT, privilege);
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_GRANT_PRIVILEGE);
- fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT,
- "GRANT ALL ON resourceType1 resourceName1 resourceType2 resourceName2 TO ROLE "
- + roleName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
-
- // for error audit log
- TSentryPrivilege invalidPrivilege = new TSentryPrivilege(COMPONENT, service,
- Lists.newArrayList(new TAuthorizable("resourceType1", "resourceName1")),
- "invalidAction");
- // test the audit log for grant privilege, failed
- try {
- client.grantPrivilege(requestorUserName, roleName, COMPONENT, invalidPrivilege);
- fail("Exception should have been thrown");
- } catch (Exception e) {
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_GRANT_PRIVILEGE);
- fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT,
- "GRANT INVALIDACTION ON resourceType1 resourceName1 TO ROLE " + roleName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- }
-
- // test the audit log for revoke privilege, success
- client.revokePrivilege(requestorUserName, roleName, COMPONENT, privilege);
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_REVOKE_PRIVILEGE);
- fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT,
- "REVOKE ALL ON resourceType1 resourceName1 resourceType2 resourceName2 FROM ROLE "
- + roleName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
-
- // test the audit log for revoke privilege, failed
- try {
- client.revokePrivilege(requestorUserName, "invalidRole", COMPONENT, invalidPrivilege);
- fail("Exception should have been thrown");
- } catch (Exception e) {
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_REVOKE_PRIVILEGE);
- fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT,
- "REVOKE INVALIDACTION ON resourceType1 resourceName1 FROM ROLE invalidRole");
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- }
-
- // test the audit log for delete role from group, success
- client.revokeRoleFromGroups(requestorUserName, roleName, COMPONENT,
- Sets.newHashSet(testGroupName));
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_DELETE_ROLE);
- fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "REVOKE ROLE " + roleName
- + " FROM GROUP " + testGroupName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- // test the audit log for delete role from group, failed
- try {
- client.revokeRoleFromGroups(requestorUserName, "invalidRole", COMPONENT,
- Sets.newHashSet(testGroupName));
- fail("Exception should have been thrown");
- } catch (Exception e) {
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_DELETE_ROLE);
- fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT,
- "REVOKE ROLE invalidRole FROM GROUP " + testGroupName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- }
- // test the audit log for drop role, success
- client.dropRole(requestorUserName, roleName, COMPONENT);
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_DROP_ROLE);
- fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "DROP ROLE " + roleName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.TRUE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- // test the audit log for drop role, failed
- try {
- client.dropRole(requestorUserName, roleName, COMPONENT);
- fail("Exception should have been thrown");
- } catch (Exception e) {
- fieldValueMap.clear();
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION, Constants.OPERATION_DROP_ROLE);
- fieldValueMap.put(Constants.LOG_FIELD_COMPONENT, COMPONENT);
- fieldValueMap.put(Constants.LOG_FIELD_OPERATION_TEXT, "DROP ROLE " + roleName);
- fieldValueMap.put(Constants.LOG_FIELD_ALLOWED, Constants.FALSE);
- fieldValueMap.put(Constants.LOG_FIELD_IP_ADDRESS, null);
- assertAuditLog(fieldValueMap);
- }
- }
- });
- }
-
- private void assertAuditLog(Map<String, String> fieldValueMap) throws Exception {
- assertThat(AuditLoggerTestAppender.getLastLogLevel(), is(Level.INFO));
- JSONObject jsonObject = new JSONObject(AuditLoggerTestAppender.getLastLogEvent());
- if (fieldValueMap != null) {
- for (Map.Entry<String, String> entry : fieldValueMap.entrySet()) {
- String entryKey = entry.getKey();
- if (Constants.LOG_FIELD_IP_ADDRESS.equals(entryKey)) {
- assertTrue(CommandUtil.assertIPInAuditLog(jsonObject.get(entryKey).toString()));
- } else {
- assertTrue(entry.getValue().equalsIgnoreCase(jsonObject.get(entryKey).toString()));
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/TestSentryGenericPolicyProcessor.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/TestSentryGenericPolicyProcessor.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/TestSentryGenericPolicyProcessor.java
deleted file mode 100644
index cc72b33..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/TestSentryGenericPolicyProcessor.java
+++ /dev/null
@@ -1,364 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.generic.service.thrift;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyListOf;
-import static org.mockito.Matchers.anySetOf;
-import static org.mockito.Matchers.anyString;
-
-import java.util.*;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.sentry.core.common.Authorizable;
-import org.apache.sentry.core.common.exception.SentrySiteConfigurationException;
-import org.apache.sentry.core.model.solr.Collection;
-import org.apache.sentry.core.model.solr.Field;
-import org.apache.sentry.core.model.solr.SolrConstants;
-import org.apache.sentry.core.common.exception.SentryAlreadyExistsException;
-import org.apache.sentry.core.common.exception.SentryGrantDeniedException;
-import org.apache.sentry.core.common.exception.SentryInvalidInputException;
-import org.apache.sentry.core.common.exception.SentryNoSuchObjectException;
-import org.apache.sentry.provider.common.GroupMappingService;
-import org.apache.sentry.provider.db.generic.service.persistent.PrivilegeObject;
-import org.apache.sentry.provider.db.generic.service.persistent.SentryStoreLayer;
-import org.apache.sentry.provider.db.generic.service.persistent.PrivilegeObject.Builder;
-import org.apache.sentry.provider.db.service.model.MSentryGMPrivilege;
-import org.apache.sentry.provider.db.service.model.MSentryRole;
-import org.apache.sentry.core.common.utils.PolicyStoreConstants;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
-import org.apache.sentry.service.thrift.Status;
-import org.apache.sentry.service.thrift.TSentryResponseStatus;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import com.google.common.collect.Sets;
-
-public class TestSentryGenericPolicyProcessor extends org.junit.Assert {
- private static final String ADMIN_GROUP = "admin_group";
- private static final String ADMIN_USER = "admin_user";
- private static final String NOT_ADMIN_USER = "not_admin_user";
- private static final String NOT_ADMIN_GROUP = "not_admin_group";
- private static final String NO_GROUP_USER = "no_group_user";
-
- private SentryStoreLayer mockStore = Mockito.mock(SentryStoreLayer.class);
- private SentryGenericPolicyProcessor processor;
-
- @Before
- public void setup() throws Exception {
- Configuration conf = new Configuration();
- conf.set(ServerConfig.ADMIN_GROUPS, ADMIN_GROUP);
- conf.set(ServerConfig.SENTRY_STORE_GROUP_MAPPING, MockGroupMapping.class.getName());
- processor = new SentryGenericPolicyProcessor(conf, mockStore);
- }
-
- @Test
- public void testNotAdminOperation() throws Exception {
- String requestUser = NOT_ADMIN_USER;
- Status validateStatus = Status.ACCESS_DENIED;
- testOperation(requestUser, validateStatus);
- }
-
- private void testOperation(String requestUser, Status validateStatus) throws Exception {
- TCreateSentryRoleRequest createrequest = new TCreateSentryRoleRequest();
- createrequest.setRequestorUserName(requestUser);
- createrequest.setRoleName("r1");
- assertEquals(validateStatus, fromTSentryStatus(processor.create_sentry_role(createrequest).getStatus()));
-
- TDropSentryRoleRequest dropRequest = new TDropSentryRoleRequest();
- dropRequest.setRequestorUserName(requestUser);
- dropRequest.setRoleName("r1");
- assertEquals(validateStatus, fromTSentryStatus(processor.drop_sentry_role(dropRequest).getStatus()));
-
- TAlterSentryRoleAddGroupsRequest addRequest = new TAlterSentryRoleAddGroupsRequest();
- addRequest.setRequestorUserName(requestUser);
- addRequest.setRoleName("r1");
- addRequest.setGroups(Sets.newHashSet("g1"));
- assertEquals(validateStatus, fromTSentryStatus(processor.alter_sentry_role_add_groups(addRequest).getStatus()));
-
- TAlterSentryRoleDeleteGroupsRequest delRequest = new TAlterSentryRoleDeleteGroupsRequest();
- delRequest.setRequestorUserName(requestUser);
- delRequest.setRoleName("r1");
- delRequest.setGroups(Sets.newHashSet("g1"));
- assertEquals(validateStatus, fromTSentryStatus(processor.alter_sentry_role_delete_groups(delRequest).getStatus()));
-
- TDropPrivilegesRequest dropPrivRequest = new TDropPrivilegesRequest();
- dropPrivRequest.setRequestorUserName(requestUser);
- dropPrivRequest.setPrivilege(new TSentryPrivilege("test", "test", new ArrayList<TAuthorizable>(), "test"));
- assertEquals(validateStatus, fromTSentryStatus(processor.drop_sentry_privilege(dropPrivRequest).getStatus()));
-
- TRenamePrivilegesRequest renameRequest = new TRenamePrivilegesRequest();
- renameRequest.setRequestorUserName(requestUser);
- assertEquals(validateStatus, fromTSentryStatus(processor.rename_sentry_privilege(renameRequest).getStatus()));
- }
-
- private Status fromTSentryStatus(TSentryResponseStatus status) {
- return Status.fromCode(status.getValue());
- }
-
- @Test
- public void testAdminOperation() throws Exception {
- testOperation(ADMIN_USER, Status.OK);
- }
-
- @Test
- public void testGrantAndRevokePrivilege() throws Exception {
- setup();
-
- TSentryPrivilege tprivilege = new TSentryPrivilege("test", "test", new ArrayList<TAuthorizable>(), "test");
- tprivilege.setGrantOption(TSentryGrantOption.UNSET);
-
- TAlterSentryRoleGrantPrivilegeRequest grantRequest = new TAlterSentryRoleGrantPrivilegeRequest();
- grantRequest.setRequestorUserName(ADMIN_USER);
- grantRequest.setRoleName("r1");
- grantRequest.setPrivilege(tprivilege);
- assertEquals(Status.OK, fromTSentryStatus(processor.alter_sentry_role_grant_privilege(grantRequest).getStatus()));
-
- TAlterSentryRoleRevokePrivilegeRequest revokeRequest = new TAlterSentryRoleRevokePrivilegeRequest();
- revokeRequest.setRequestorUserName(ADMIN_USER);
- revokeRequest.setRoleName("r1");
- revokeRequest.setPrivilege(tprivilege);
- assertEquals(Status.OK, fromTSentryStatus(processor.alter_sentry_role_revoke_privilege(revokeRequest).getStatus()));
- }
-
- @Test
- public void testOperationWithException() throws Exception {
- String roleName = anyString();
- Mockito.when(mockStore.createRole(anyString(), roleName, anyString()))
- .thenThrow(new SentryAlreadyExistsException("Role: " + roleName));
-
- roleName = anyString();
- Mockito.when(mockStore.dropRole(anyString(), roleName, anyString()))
- .thenThrow(new SentryNoSuchObjectException("Role: " + roleName ));
-
- roleName = anyString();
- Mockito.when(mockStore.alterRoleAddGroups(anyString(), roleName, anySetOf(String.class),anyString()))
- .thenThrow(new SentryNoSuchObjectException("Role: " + roleName));
-
- roleName = anyString();
- Mockito.when(mockStore.alterRoleDeleteGroups(anyString(), roleName, anySetOf(String.class), anyString()))
- .thenThrow(new SentryNoSuchObjectException("Role: " + roleName));
-
- roleName = anyString();
- Mockito.when(mockStore.alterRoleGrantPrivilege(anyString(), roleName, any(PrivilegeObject.class), anyString()))
- .thenThrow(new SentryGrantDeniedException("Role: " + roleName + " is not allowed to do grant"));
-
- roleName = anyString();
- Mockito.when(mockStore.alterRoleRevokePrivilege(anyString(), roleName, any(PrivilegeObject.class), anyString()))
- .thenThrow(new SentryGrantDeniedException("Role: " + roleName + " is not allowed to do grant"));
-
- Mockito.when(mockStore.dropPrivilege(anyString(), any(PrivilegeObject.class), anyString()))
- .thenThrow(new SentryInvalidInputException("Invalid input privilege object"));
-
- Mockito.when(mockStore.renamePrivilege(anyString(), anyString(), anyListOf(Authorizable.class),
- anyListOf(Authorizable.class), anyString()))
- .thenThrow(new RuntimeException("Unknown error"));
-
- setup();
-
- TCreateSentryRoleRequest createrequest = new TCreateSentryRoleRequest();
- createrequest.setRequestorUserName(ADMIN_USER);
- createrequest.setRoleName("r1");
- assertEquals(Status.ALREADY_EXISTS, fromTSentryStatus(processor.create_sentry_role(createrequest).getStatus()));
-
- TDropSentryRoleRequest dropRequest = new TDropSentryRoleRequest();
- dropRequest.setRequestorUserName(ADMIN_USER);
- dropRequest.setRoleName("r1");
- assertEquals(Status.NO_SUCH_OBJECT, fromTSentryStatus(processor.drop_sentry_role(dropRequest).getStatus()));
-
- TAlterSentryRoleAddGroupsRequest addRequest = new TAlterSentryRoleAddGroupsRequest();
- addRequest.setRequestorUserName(ADMIN_USER);
- addRequest.setRoleName("r1");
- addRequest.setGroups(Sets.newHashSet("g1"));
- assertEquals(Status.NO_SUCH_OBJECT, fromTSentryStatus(processor.alter_sentry_role_add_groups(addRequest).getStatus()));
-
- TAlterSentryRoleDeleteGroupsRequest delRequest = new TAlterSentryRoleDeleteGroupsRequest();
- delRequest.setRequestorUserName(ADMIN_USER);
- delRequest.setRoleName("r1");
- delRequest.setGroups(Sets.newHashSet("g1"));
- assertEquals(Status.NO_SUCH_OBJECT, fromTSentryStatus(processor.alter_sentry_role_delete_groups(delRequest).getStatus()));
-
- TDropPrivilegesRequest dropPrivRequest = new TDropPrivilegesRequest();
- dropPrivRequest.setRequestorUserName(ADMIN_USER);
- dropPrivRequest.setPrivilege(new TSentryPrivilege("test", "test", new ArrayList<TAuthorizable>(), "test"));
- assertEquals(Status.INVALID_INPUT, fromTSentryStatus(processor.drop_sentry_privilege(dropPrivRequest).getStatus()));
-
- TRenamePrivilegesRequest renameRequest = new TRenamePrivilegesRequest();
- renameRequest.setRequestorUserName(ADMIN_USER);
- assertEquals(Status.RUNTIME_ERROR, fromTSentryStatus(processor.rename_sentry_privilege(renameRequest).getStatus()));
-
- TSentryPrivilege tprivilege = new TSentryPrivilege("test", "test", new ArrayList<TAuthorizable>(), "test");
- tprivilege.setGrantOption(TSentryGrantOption.UNSET);
-
- TAlterSentryRoleGrantPrivilegeRequest grantRequest = new TAlterSentryRoleGrantPrivilegeRequest();
- grantRequest.setRequestorUserName(ADMIN_USER);
- grantRequest.setRoleName("r1");
- grantRequest.setPrivilege(tprivilege);
- assertEquals(Status.ACCESS_DENIED, fromTSentryStatus(processor.alter_sentry_role_grant_privilege(grantRequest).getStatus()));
-
- TAlterSentryRoleRevokePrivilegeRequest revokeRequest = new TAlterSentryRoleRevokePrivilegeRequest();
- revokeRequest.setRequestorUserName(ADMIN_USER);
- revokeRequest.setRoleName("r1");
- revokeRequest.setPrivilege(tprivilege);
- assertEquals(Status.ACCESS_DENIED, fromTSentryStatus(processor.alter_sentry_role_revoke_privilege(revokeRequest).getStatus()));
- }
-
- @Test
- public void testUserWithNoGroup() throws Exception {
- setup();
-
- TCreateSentryRoleRequest createrequest = new TCreateSentryRoleRequest();
- createrequest.setRequestorUserName(NO_GROUP_USER);
- createrequest.setRoleName("r1");
- assertEquals(Status.ACCESS_DENIED, fromTSentryStatus(processor.create_sentry_role(createrequest).getStatus()));
-
- TDropSentryRoleRequest dropRequest = new TDropSentryRoleRequest();
- dropRequest.setRequestorUserName(NO_GROUP_USER);
- dropRequest.setRoleName("r1");
- assertEquals(Status.ACCESS_DENIED, fromTSentryStatus(processor.drop_sentry_role(dropRequest).getStatus()));
-
- TAlterSentryRoleAddGroupsRequest addRequest = new TAlterSentryRoleAddGroupsRequest();
- addRequest.setRequestorUserName(NO_GROUP_USER);
- addRequest.setRoleName("r1");
- addRequest.setGroups(Sets.newHashSet("g1"));
- assertEquals(Status.ACCESS_DENIED, fromTSentryStatus(processor.alter_sentry_role_add_groups(addRequest).getStatus()));
-
- TAlterSentryRoleDeleteGroupsRequest delRequest = new TAlterSentryRoleDeleteGroupsRequest();
- delRequest.setRequestorUserName(NO_GROUP_USER);
- delRequest.setRoleName("r1");
- delRequest.setGroups(Sets.newHashSet("g1"));
- assertEquals(Status.ACCESS_DENIED, fromTSentryStatus(processor.alter_sentry_role_delete_groups(delRequest).getStatus()));
-
- TDropPrivilegesRequest dropPrivRequest = new TDropPrivilegesRequest();
- dropPrivRequest.setRequestorUserName(NO_GROUP_USER);
- dropPrivRequest.setPrivilege(new TSentryPrivilege("test", "test", new ArrayList<TAuthorizable>(), "test"));
- assertEquals(Status.ACCESS_DENIED, fromTSentryStatus(processor.drop_sentry_privilege(dropPrivRequest).getStatus()));
-
- TRenamePrivilegesRequest renameRequest = new TRenamePrivilegesRequest();
- renameRequest.setRequestorUserName(NO_GROUP_USER);
- assertEquals(Status.ACCESS_DENIED, fromTSentryStatus(processor.rename_sentry_privilege(renameRequest).getStatus()));
-
- // Can't test GrantPrivilege / RevokePrivilege since the authorization happens
- // in the persistence layer, which isn't setup in this test.
- }
-
- @Test
- public void testGetRolesAndPrivileges() throws Exception {
- String roleName = "r1";
- String groupName = "g1";
- PrivilegeObject queryPrivilege = new Builder()
- .setComponent("SOLR")
- .setAction(SolrConstants.QUERY)
- .setService("service1")
- .setAuthorizables(Arrays.asList(new Collection("c1"), new Field("f1")))
- .build();
- PrivilegeObject updatePrivilege = new Builder(queryPrivilege)
- .setAction(SolrConstants.UPDATE)
- .build();
-
- MSentryGMPrivilege mSentryGMPrivilege = new MSentryGMPrivilege("SOLR", "service1",
- Arrays.asList(new Collection("c1"), new Field("f1")),
- SolrConstants.QUERY, true);
-
- MSentryRole role = new MSentryRole("r1", 290);
- mSentryGMPrivilege.setRoles(Sets.newHashSet(role));
-
- Mockito.when(mockStore.getRolesByGroups(anyString(), anySetOf(String.class)))
- .thenReturn(Sets.newHashSet(roleName));
-
- Mockito.when(mockStore.getPrivilegesByProvider(anyString(), anyString(), anySetOf(String.class),
- anySetOf(String.class), anyListOf(Authorizable.class)))
- .thenReturn(Sets.newHashSet(queryPrivilege, updatePrivilege));
-
- Mockito.when(mockStore.getGroupsByRoles(anyString(), anySetOf(String.class)))
- .thenReturn(Sets.newHashSet(groupName));
-
- Mockito.when(mockStore.getPrivilegesByAuthorizable(anyString(), anyString(), anySetOf(String.class), anyListOf(Authorizable.class)))
- .thenReturn(Sets.newHashSet(mSentryGMPrivilege));
-
- Mockito.when(mockStore.getAllRoleNames())
- .thenReturn(Sets.newHashSet(roleName));
-
- TListSentryPrivilegesRequest request1 = new TListSentryPrivilegesRequest();
- request1.setRoleName(roleName);
- request1.setRequestorUserName(ADMIN_USER);
- TListSentryPrivilegesResponse response1 = processor.list_sentry_privileges_by_role(request1);
- assertEquals(Status.OK, fromTSentryStatus(response1.getStatus()));
- assertEquals(2, response1.getPrivileges().size());
-
- TListSentryRolesRequest request2 = new TListSentryRolesRequest();
- request2.setRequestorUserName(ADMIN_USER);
- request2.setGroupName(groupName);
- TListSentryRolesResponse response2 = processor.list_sentry_roles_by_group(request2);
- assertEquals(Status.OK, fromTSentryStatus(response2.getStatus()));
- assertEquals(1, response2.getRoles().size());
-
- TListSentryPrivilegesForProviderRequest request3 = new TListSentryPrivilegesForProviderRequest();
- request3.setGroups(Sets.newHashSet(groupName));
- request3.setRoleSet(new TSentryActiveRoleSet(true, null));
- TListSentryPrivilegesForProviderResponse response3 = processor.list_sentry_privileges_for_provider(request3);
- assertEquals(Status.OK, fromTSentryStatus(response3.getStatus()));
- assertEquals(2, response3.getPrivileges().size());
-
- // Optional parameters activeRoleSet and requested group name are both provided.
- TListSentryPrivilegesByAuthRequest request4 = new TListSentryPrivilegesByAuthRequest();
- request4.setGroups(Sets.newHashSet(groupName));
- request4.setRoleSet(new TSentryActiveRoleSet(true, null));
- request4.setRequestorUserName(ADMIN_USER);
- Set<String> authorizablesSet = Sets.newHashSet("Collection=c1->Field=f1");
- request4.setAuthorizablesSet(authorizablesSet);
-
- TListSentryPrivilegesByAuthResponse response4 = processor.list_sentry_privileges_by_authorizable(request4);
- assertEquals(Status.OK, fromTSentryStatus(response4.getStatus()));
- assertEquals(1, response4.getPrivilegesMapByAuth().size());
-
- // Optional parameters activeRoleSet and requested group name are both not provided.
- TListSentryPrivilegesByAuthRequest request5 = new TListSentryPrivilegesByAuthRequest();
- request5.setRequestorUserName("not_" + ADMIN_USER);
- authorizablesSet = Sets.newHashSet("Collection=c1->Field=f2");
- request5.setAuthorizablesSet(authorizablesSet);
-
- TListSentryPrivilegesByAuthResponse response5 = processor.list_sentry_privileges_by_authorizable(request5);
- assertEquals(Status.OK, fromTSentryStatus(response5.getStatus()));
- assertEquals(1, response5.getPrivilegesMapByAuth().size());
- }
-
- @Test(expected=SentrySiteConfigurationException.class)
- public void testConfigCannotCreateNotificationHandler() throws Exception {
- Configuration conf = new Configuration();
- conf.set(PolicyStoreConstants.SENTRY_GENERIC_POLICY_NOTIFICATION,"junk");
- SentryGenericPolicyProcessor.createHandlers(conf);
- }
-
- public static class MockGroupMapping implements GroupMappingService {
- public MockGroupMapping(Configuration conf, String resource) { //NOPMD
- }
- @Override
- public Set<String> getGroups(String user) {
- if (user.equalsIgnoreCase(ADMIN_USER)) {
- return Sets.newHashSet(ADMIN_GROUP);
- } else if (user.equalsIgnoreCase(NOT_ADMIN_USER)){
- return Sets.newHashSet(NOT_ADMIN_GROUP);
- } else {
- return Collections.emptySet();
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/TestSentryGenericServiceClient.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/TestSentryGenericServiceClient.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/TestSentryGenericServiceClient.java
deleted file mode 100644
index 5813626..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/TestSentryGenericServiceClient.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db.generic.service.thrift;
-
-import java.util.Set;
-
-import org.apache.sentry.service.thrift.SentryServiceFactory;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.google.common.collect.Sets;
-
-public class TestSentryGenericServiceClient extends SentryGenericServiceIntegrationBase {
-
- @BeforeClass
- public static void setup() throws Exception {
- beforeSetup();
- setupConf();
- startSentryService();
- afterSetup();
- kerberos = false;
- }
-
- @Test
- public void testConnectionWhenReconnect() throws Exception {
- runTestAsSubject(new TestOperation() {
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- String roleName = "admin_r";
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName, "solr");
- client.createRole(requestorUserName, roleName, "solr");
- stopSentryService();
- server = SentryServiceFactory.create(conf);
- startSentryService();
- client.dropRole(requestorUserName, roleName, "solr");
- }
- });
- }
-
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/TestSentryGenericServiceIntegration.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/TestSentryGenericServiceIntegration.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/TestSentryGenericServiceIntegration.java
deleted file mode 100644
index 5364d10..0000000
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/service/thrift/TestSentryGenericServiceIntegration.java
+++ /dev/null
@@ -1,503 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.generic.service.thrift;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.sentry.core.common.exception.SentryUserException;
-import org.apache.sentry.core.common.ActiveRoleSet;
-import org.apache.sentry.core.common.Authorizable;
-import org.apache.sentry.core.model.solr.Collection;
-import org.apache.sentry.core.model.solr.Field;
-import org.apache.sentry.core.model.solr.SolrConstants;
-import org.junit.Test;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-public class TestSentryGenericServiceIntegration extends SentryGenericServiceIntegrationBase {
-
- @Test
- public void testCreateDropShowRole() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- String roleName = "admin_r";
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName, SOLR);
-
- client.createRole(requestorUserName, roleName, SOLR);
-
- client.grantRoleToGroups(requestorUserName, roleName, SOLR, Sets.newHashSet(requestorUserGroupNames));
-
- Set<TSentryRole> roles = client.listUserRoles(requestorUserName,SOLR);
- assertEquals("Incorrect number of roles", 1, roles.size());
- for (TSentryRole role:roles) {
- assertTrue(role.getRoleName(), role.getRoleName().equalsIgnoreCase(roleName));
- }
- client.dropRole(requestorUserName, roleName, SOLR);
- }});
- }
-
- @Test
- public void testAddDeleteRoleToGroup() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- String testGroupName = "g1";
- String roleName = "admin_r";
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- setLocalGroupMapping(requestorUserName, Sets.newHashSet(testGroupName));
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName, SOLR);
-
- client.createRole(requestorUserName, roleName, SOLR);
-
- client.grantRoleToGroups(requestorUserName, roleName, SOLR, Sets.newHashSet(testGroupName));
-
- Set<TSentryRole> roles = client.listUserRoles(requestorUserName,SOLR);
- assertEquals("Incorrect number of roles", 1, roles.size());
- for (TSentryRole role:roles) {
- assertTrue(role.getRoleName(), role.getRoleName().equalsIgnoreCase(roleName));
- assertTrue(role.getGroups().size() == 1);
- for (String group :role.getGroups()) {
- assertEquals(testGroupName, group);
- }
- }
-
- client.revokeRoleFromGroups(requestorUserName, roleName, SOLR, Sets.newHashSet(testGroupName));
- roles = client.listUserRoles(requestorUserName,SOLR);
- assertEquals("Incorrect number of roles", 0, roles.size());
-
- client.dropRole(requestorUserName, roleName, SOLR);
- }});
- }
-
- @Test
- public void testGranRevokePrivilege() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
- String roleName1 = "admin_r1";
- String roleName2 = "admin_r2";
-
- client.dropRoleIfExists(requestorUserName, roleName1, SOLR);
- client.createRole(requestorUserName, roleName1, SOLR);
-
- client.dropRoleIfExists(requestorUserName, roleName2, SOLR);
- client.createRole(requestorUserName, roleName2, SOLR);
-
- TSentryPrivilege queryPrivilege = new TSentryPrivilege(SOLR, "service1",
- fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
- SolrConstants.QUERY);
-
- TSentryPrivilege updatePrivilege = new TSentryPrivilege(SOLR, "service1",
- fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
- SolrConstants.UPDATE);
-
- client.grantPrivilege(requestorUserName, roleName1, SOLR, queryPrivilege);
- client.grantPrivilege(requestorUserName, roleName2, SOLR, updatePrivilege);
-
- client.revokePrivilege(requestorUserName, roleName1, SOLR, queryPrivilege);
- client.revokePrivilege(requestorUserName, roleName2, SOLR, updatePrivilege);
- }});
- }
-
- @Test
- public void testMultipleRolesSamePrivilege() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
- String roleName1 = "admin_r1";
- String roleName2 = "admin_r2";
-
- client.dropRoleIfExists(requestorUserName, roleName1, SOLR);
- client.createRole(requestorUserName, roleName1, SOLR);
-
- client.dropRoleIfExists(requestorUserName, roleName2, SOLR);
- client.createRole(requestorUserName, roleName2, SOLR);
-
- TSentryPrivilege queryPrivilege = new TSentryPrivilege(SOLR, "service1",
- fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
- SolrConstants.QUERY);
-
- client.grantPrivilege(requestorUserName, roleName1, SOLR, queryPrivilege);
- Set<TSentryPrivilege> listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName1, SOLR, "service1");
- assertTrue("Privilege not assigned to role1 !!", listPrivilegesByRoleName.size() == 1);
-
- client.grantPrivilege(requestorUserName, roleName2, SOLR, queryPrivilege);
- listPrivilegesByRoleName = client.listAllPrivilegesByRoleName(requestorUserName, roleName2, SOLR, "service1");
- assertTrue("Privilege not assigned to role2 !!", listPrivilegesByRoleName.size() == 1);
- }});
- }
-
- @Test
- public void testShowRoleGrant() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- String roleName = "admin_r1";
- String groupName = "group1";
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- setLocalGroupMapping(requestorUserName, Sets.newHashSet(groupName));
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName, SOLR);
- client.createRole(requestorUserName, roleName, SOLR);
- client.grantRoleToGroups(requestorUserName, roleName, SOLR, Sets.newHashSet(groupName));
-
- Set<TSentryRole> groupRoles = client.listRolesByGroupName(requestorUserName, groupName,SOLR);
- assertTrue(groupRoles.size() == 1);
- for (TSentryRole role:groupRoles) {
- assertTrue(role.getRoleName(), role.getRoleName().equalsIgnoreCase(roleName));
- assertTrue(role.getGroups().size() == 1);
- for (String group :role.getGroups()) {
- assertEquals(groupName, group);
- }
- }
-
- client.dropRole(requestorUserName, roleName, SOLR);
- }});
- }
-
- @Test
- public void testShowGrant() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- String roleName = "admin_r1";
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
-
- client.dropRoleIfExists(requestorUserName, roleName, SOLR);
- client.createRole(requestorUserName, roleName, SOLR);
-
- TSentryPrivilege queryPrivilege = new TSentryPrivilege(SOLR, "service1",
- fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
- SolrConstants.QUERY);
-
- TSentryPrivilege updatePrivilege = new TSentryPrivilege(SOLR, "service1",
- fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
- SolrConstants.UPDATE);
-
- client.grantPrivilege(requestorUserName, roleName, SOLR, updatePrivilege);
- client.grantPrivilege(requestorUserName, roleName, SOLR, queryPrivilege);
- Set<TSentryPrivilege> privileges = client.listAllPrivilegesByRoleName(requestorUserName, roleName, SOLR, "service1");
- assertTrue(privileges.size() == 2);
-
- client.revokePrivilege(requestorUserName, roleName, SOLR, updatePrivilege);
- privileges = client.listAllPrivilegesByRoleName(requestorUserName, roleName, SOLR, "service1");
- assertTrue(privileges.size() == 1);
- }});
- }
-
- @Test
- public void testSameGrantTwice() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
- String roleName = "admin_r1";
-
- client.createRole(requestorUserName, roleName, SOLR);
-
- TSentryPrivilege queryPrivilege = new TSentryPrivilege(SOLR, "service1",
- fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
- SolrConstants.QUERY);
-
- client.grantPrivilege(requestorUserName, roleName, SOLR, queryPrivilege);
- assertEquals(1, client.listAllPrivilegesByRoleName(requestorUserName, roleName, SOLR, "service1").size());
- }});
- }
-
- @Test
- public void testGrantRevokeWithGrantOption() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String adminUser = ADMIN_USER;
- Set<String> adminGroup = Sets.newHashSet(ADMIN_GROUP);
- String grantOptionUser = "user1";
- Set<String> grantOptionGroup = Sets.newHashSet("group1");
- String noGrantOptionUser = "user2";
- Set<String> noGrantOptionGroup = Sets.newHashSet("group2");
-
- setLocalGroupMapping(adminUser, adminGroup);
- setLocalGroupMapping(grantOptionUser, grantOptionGroup);
- setLocalGroupMapping(noGrantOptionUser, noGrantOptionGroup);
- writePolicyFile();
-
- String grantRole = "grant_r";
- String noGrantRole = "no_grant_r";
- String testRole = "test_role";
-
- client.createRole(adminUser, grantRole, SOLR);
- client.createRole(adminUser, noGrantRole, SOLR);
- client.createRole(adminUser, testRole, SOLR);
-
- TSentryPrivilege grantPrivilege = new TSentryPrivilege(SOLR, "service1",
- fromAuthorizable(Arrays.asList(new Collection("c1"))),
- SolrConstants.QUERY);
- grantPrivilege.setGrantOption(TSentryGrantOption.TRUE);
-
- TSentryPrivilege noGrantPrivilege = new TSentryPrivilege(SOLR, "service1",
- fromAuthorizable(Arrays.asList(new Collection("c1"))),
- SolrConstants.QUERY);
- noGrantPrivilege.setGrantOption(TSentryGrantOption.FALSE);
-
- TSentryPrivilege testPrivilege = new TSentryPrivilege(SOLR, "service1",
- fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
- SolrConstants.QUERY);
- testPrivilege.setGrantOption(TSentryGrantOption.FALSE);
-
- client.grantPrivilege(adminUser, grantRole, SOLR, grantPrivilege);
- client.grantPrivilege(adminUser, noGrantRole, SOLR, noGrantPrivilege);
-
- client.grantRoleToGroups(adminUser, grantRole, SOLR, grantOptionGroup);
- client.grantRoleToGroups(adminUser, noGrantRole, SOLR, noGrantOptionGroup);
-
- try {
- client.grantPrivilege(grantOptionUser,testRole,SOLR, testPrivilege);
- } catch (SentryUserException e) {
- fail("grantOptionUser failed grant privilege to user");
- }
-
- try {
- client.grantPrivilege(noGrantOptionUser, testRole, SOLR, testPrivilege);
- fail("noGrantOptionUser can't grant privilege to user");
- } catch (SentryUserException e) {
- }
-
- try {
- client.revokePrivilege(grantOptionUser, testRole, SOLR, testPrivilege);
- } catch(SentryUserException e) {
- fail("grantOptionUser failed revoke privilege to user");
- }
-
- try {
- client.revokePrivilege(noGrantOptionUser, testRole, SOLR, testPrivilege);
- fail("noGrantOptionUser can't revoke privilege to user");
- } catch (SentryUserException e) {
- }
- }});
- }
-
- @Test
- public void testGetPrivilegeByHierarchy() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String adminUser = ADMIN_USER;
- Set<String> adminGroup = Sets.newHashSet(ADMIN_GROUP);
- String testRole = "role1";
- Set<String> testGroup = Sets.newHashSet("group1");
- String testUser = "user1";
- setLocalGroupMapping(adminUser, adminGroup);
- setLocalGroupMapping(testUser, testGroup);
- writePolicyFile();
-
-
- client.createRole(adminUser, testRole, SOLR);
- client.grantRoleToGroups(adminUser, testRole, SOLR, testGroup);
-
- TSentryPrivilege queryPrivilege = new TSentryPrivilege(SOLR, "service1",
- fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
- SolrConstants.QUERY);
-
- TSentryPrivilege updatePrivilege = new TSentryPrivilege(SOLR, "service1",
- fromAuthorizable(Arrays.asList(new Collection("c2"), new Field("f2"))),
- SolrConstants.UPDATE);
-
- client.grantPrivilege(adminUser, testRole, SOLR, queryPrivilege);
- client.grantPrivilege(adminUser, testRole, SOLR, updatePrivilege);
-
- assertEquals(2, client.listAllPrivilegesByRoleName(testUser, testRole, SOLR, "service1").size());
-
- assertEquals(1, client.listPrivilegesByRoleName(testUser, testRole,
- SOLR, "service1", Arrays.asList(new Collection("c1"))).size());
-
- assertEquals(1, client.listPrivilegesByRoleName(testUser, testRole,
- SOLR, "service1", Arrays.asList(new Collection("c2"))).size());
-
- assertEquals(1, client.listPrivilegesByRoleName(testUser, testRole,
- SOLR, "service1", Arrays.asList(new Collection("c1"), new Field("f1"))).size());
-
- assertEquals(1, client.listPrivilegesByRoleName(testUser, testRole,
- SOLR, "service1", Arrays.asList(new Collection("c2"), new Field("f2"))).size());
-
- //test listPrivilegesForProvider by group(testGroup)
- ActiveRoleSet roleSet = ActiveRoleSet.ALL;
-
- assertEquals(1, client.listPrivilegesForProvider(SOLR, "service1", roleSet,
- testGroup, Arrays.asList(new Collection("c1"))).size());
-
- assertEquals(1, client.listPrivilegesForProvider(SOLR, "service1", roleSet,
- testGroup, Arrays.asList(new Collection("c2"))).size());
-
- assertEquals(1, client.listPrivilegesForProvider(SOLR, "service1", roleSet,
- testGroup, Arrays.asList(new Collection("c1"), new Field("f1"))).size());
-
- assertEquals(1, client.listPrivilegesForProvider(SOLR, "service1", roleSet,
- testGroup, Arrays.asList(new Collection("c2"), new Field("f2"))).size());
- }});
- }
-
- @Test
- public void testGetPrivilegeByAuthorizable() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String adminUser = ADMIN_USER;
- Set<String> adminGroup = Sets.newHashSet(ADMIN_GROUP);
- String testRole = "role1";
- Set<String> testGroup = Sets.newHashSet("group1");
- String testUser = "user1";
- setLocalGroupMapping(adminUser, adminGroup);
- setLocalGroupMapping(testUser, testGroup);
- writePolicyFile();
-
- client.createRole(adminUser, testRole, SOLR);
- client.grantRoleToGroups(adminUser, testRole, SOLR, adminGroup);
-
- TSentryPrivilege queryPrivilege = new TSentryPrivilege(SOLR, "service1",
- fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
- SolrConstants.QUERY);
-
- TSentryPrivilege updatePrivilege = new TSentryPrivilege(SOLR, "service1",
- fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f2"))),
- SolrConstants.UPDATE);
-
- client.grantPrivilege(adminUser, testRole, SOLR, queryPrivilege);
- client.grantPrivilege(adminUser, testRole, SOLR, updatePrivilege);
-
- //test listPrivilegesbyAuthorizable without requested group and active role set.
- assertEquals(1, client.listPrivilegesbyAuthorizable(SOLR, "service1", adminUser,
- Sets.newHashSet(new String("Collection=c1->Field=f1")), null, null).size());
-
- //test listPrivilegesbyAuthorizable with requested group (testGroup)
- Map<String, TSentryPrivilegeMap> privilegeMap = client.listPrivilegesbyAuthorizable(SOLR,
- "service1", adminUser, Sets.newHashSet(new String("Collection=c1->Field=f1")), testGroup, null);
- TSentryPrivilegeMap actualMap = privilegeMap.get(new String("Collection=c1->Field=f1"));
- assertEquals(0, actualMap.getPrivilegeMap().size());
-
- //test listPrivilegesbyAuthorizable with active role set.
- ActiveRoleSet roleSet = ActiveRoleSet.ALL;
- assertEquals(1, client.listPrivilegesbyAuthorizable(SOLR, "service1", adminUser,
- Sets.newHashSet(new String("Collection=c1->Field=f1")), null, roleSet).size());
- privilegeMap = client.listPrivilegesbyAuthorizable(SOLR,
- "service1", adminUser, Sets.newHashSet(new String("Collection=c1->Field=f1")), null, roleSet);
- actualMap = privilegeMap.get(new String("Collection=c1->Field=f1"));
- assertEquals(1, actualMap.getPrivilegeMap().size());
-
- privilegeMap = client.listPrivilegesbyAuthorizable(SOLR,
- "service1", testUser, Sets.newHashSet(new String("Collection=c1->Field=f1")), null, roleSet);
- actualMap = privilegeMap.get(new String("Collection=c1->Field=f1"));
- assertEquals(0, actualMap.getPrivilegeMap().size());
-
- // grant tesRole to testGroup.
- client.grantRoleToGroups(adminUser, testRole, SOLR, testGroup);
-
- privilegeMap = client.listPrivilegesbyAuthorizable(SOLR,
- "service1", testUser, Sets.newHashSet(new String("Collection=c1")), null, roleSet);
- actualMap = privilegeMap.get(new String("Collection=c1"));
- assertEquals(1, actualMap.getPrivilegeMap().size());
- assertEquals(2, actualMap.getPrivilegeMap().get(testRole).size());
- }});
- }
-
- @Test
- public void testDropAndRenamePrivilege() throws Exception {
- runTestAsSubject(new TestOperation(){
- @Override
- public void runTestAsSubject() throws Exception {
- String requestorUserName = ADMIN_USER;
- Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
- setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
- writePolicyFile();
- String roleName = "admin_r1";
-
- client.createRole(requestorUserName, roleName, SOLR);
-
- TSentryPrivilege queryPrivilege = new TSentryPrivilege(SOLR, "service1",
- fromAuthorizable(Arrays.asList(new Collection("c1"), new Field("f1"))),
- SolrConstants.QUERY);
- client.grantPrivilege(requestorUserName, roleName, SOLR, queryPrivilege);
-
- assertEquals(1, client.listPrivilegesByRoleName(requestorUserName, roleName,
- SOLR, "service1", Arrays.asList(new Collection("c1"), new Field("f1"))).size());
-
- assertEquals(0, client.listPrivilegesByRoleName(requestorUserName, roleName,
- SOLR, "service1", Arrays.asList(new Collection("c2"), new Field("f2"))).size());
-
- client.renamePrivilege(requestorUserName, SOLR, "service1", Arrays.asList(new Collection("c1"), new Field("f1")),
- Arrays.asList(new Collection("c2"), new Field("f2")));
-
- assertEquals(0, client.listPrivilegesByRoleName(requestorUserName, roleName,
- SOLR, "service1", Arrays.asList(new Collection("c1"), new Field("f1"))).size());
-
- assertEquals(1, client.listPrivilegesByRoleName(requestorUserName, roleName,
- SOLR, "service1", Arrays.asList(new Collection("c2"), new Field("f2"))).size());
-
- TSentryPrivilege dropPrivilege = new TSentryPrivilege(SOLR, "service1",
- fromAuthorizable(Arrays.asList(new Collection("c2"), new Field("f2"))),
- SolrConstants.QUERY);
-
- client.dropPrivilege(requestorUserName, SOLR, dropPrivilege);
-
- assertEquals(0, client.listPrivilegesByRoleName(requestorUserName, roleName,
- SOLR, "service1", Arrays.asList(new Collection("c2"), new Field("f2"))).size());
- }});
- }
-
- private List<TAuthorizable> fromAuthorizable(List<? extends Authorizable> authorizables) {
- List<TAuthorizable> tAuthorizables = Lists.newArrayList();
- for (Authorizable authorizable : authorizables) {
- tAuthorizables.add(new TAuthorizable(authorizable.getTypeName(), authorizable.getName()));
- }
- return tAuthorizables;
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/log/entity/TestJsonLogEntityFactory.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/log/entity/TestJsonLogEntityFactory.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/log/entity/TestJsonLogEntityFactory.java
index b1c2365..307f38e 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/log/entity/TestJsonLogEntityFactory.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/log/entity/TestJsonLogEntityFactory.java
@@ -26,24 +26,24 @@ import java.util.Set;
import org.apache.hadoop.conf.Configuration;
import org.apache.sentry.core.model.db.AccessConstants;
import org.apache.sentry.provider.db.log.util.Constants;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleAddGroupsRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleAddGroupsResponse;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleDeleteGroupsRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleDeleteGroupsResponse;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleGrantPrivilegeRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleGrantPrivilegeResponse;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleRevokePrivilegeRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleRevokePrivilegeResponse;
-import org.apache.sentry.provider.db.service.thrift.TCreateSentryRoleRequest;
-import org.apache.sentry.provider.db.service.thrift.TCreateSentryRoleResponse;
-import org.apache.sentry.provider.db.service.thrift.TDropSentryRoleRequest;
-import org.apache.sentry.provider.db.service.thrift.TDropSentryRoleResponse;
-import org.apache.sentry.provider.db.service.thrift.TSentryGroup;
-import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege;
+import org.apache.sentry.api.common.ApiConstants.PrivilegeScope;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleAddGroupsRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleAddGroupsResponse;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleDeleteGroupsRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleDeleteGroupsResponse;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleGrantPrivilegeRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleGrantPrivilegeResponse;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleRevokePrivilegeRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleRevokePrivilegeResponse;
+import org.apache.sentry.api.service.thrift.TCreateSentryRoleRequest;
+import org.apache.sentry.api.service.thrift.TCreateSentryRoleResponse;
+import org.apache.sentry.api.service.thrift.TDropSentryRoleRequest;
+import org.apache.sentry.api.service.thrift.TDropSentryRoleResponse;
+import org.apache.sentry.api.service.thrift.TSentryGroup;
+import org.apache.sentry.api.service.thrift.TSentryPrivilege;
import org.apache.sentry.core.common.utils.ThriftUtil;
-import org.apache.sentry.service.thrift.ServiceConstants.PrivilegeScope;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
-import org.apache.sentry.service.thrift.Status;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
+import org.apache.sentry.api.common.Status;
import org.junit.BeforeClass;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/log/entity/TestJsonLogEntityFactoryGM.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/log/entity/TestJsonLogEntityFactoryGM.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/log/entity/TestJsonLogEntityFactoryGM.java
index 4f35a44..8623a09 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/log/entity/TestJsonLogEntityFactoryGM.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/log/entity/TestJsonLogEntityFactoryGM.java
@@ -28,24 +28,24 @@ import java.util.Map;
import java.util.Set;
import org.apache.hadoop.conf.Configuration;
-import org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleAddGroupsRequest;
-import org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleAddGroupsResponse;
-import org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleDeleteGroupsRequest;
-import org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleDeleteGroupsResponse;
-import org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleGrantPrivilegeRequest;
-import org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleGrantPrivilegeResponse;
-import org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleRevokePrivilegeRequest;
-import org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleRevokePrivilegeResponse;
-import org.apache.sentry.provider.db.generic.service.thrift.TAuthorizable;
-import org.apache.sentry.provider.db.generic.service.thrift.TCreateSentryRoleRequest;
-import org.apache.sentry.provider.db.generic.service.thrift.TCreateSentryRoleResponse;
-import org.apache.sentry.provider.db.generic.service.thrift.TDropSentryRoleRequest;
-import org.apache.sentry.provider.db.generic.service.thrift.TDropSentryRoleResponse;
-import org.apache.sentry.provider.db.generic.service.thrift.TSentryPrivilege;
+import org.apache.sentry.api.generic.thrift.TAlterSentryRoleAddGroupsRequest;
+import org.apache.sentry.api.generic.thrift.TAlterSentryRoleAddGroupsResponse;
+import org.apache.sentry.api.generic.thrift.TAlterSentryRoleDeleteGroupsRequest;
+import org.apache.sentry.api.generic.thrift.TAlterSentryRoleDeleteGroupsResponse;
+import org.apache.sentry.api.generic.thrift.TAlterSentryRoleGrantPrivilegeRequest;
+import org.apache.sentry.api.generic.thrift.TAlterSentryRoleGrantPrivilegeResponse;
+import org.apache.sentry.api.generic.thrift.TAlterSentryRoleRevokePrivilegeRequest;
+import org.apache.sentry.api.generic.thrift.TAlterSentryRoleRevokePrivilegeResponse;
+import org.apache.sentry.api.generic.thrift.TAuthorizable;
+import org.apache.sentry.api.generic.thrift.TCreateSentryRoleRequest;
+import org.apache.sentry.api.generic.thrift.TCreateSentryRoleResponse;
+import org.apache.sentry.api.generic.thrift.TDropSentryRoleRequest;
+import org.apache.sentry.api.generic.thrift.TDropSentryRoleResponse;
+import org.apache.sentry.api.generic.thrift.TSentryPrivilege;
import org.apache.sentry.provider.db.log.util.Constants;
import org.apache.sentry.core.common.utils.ThriftUtil;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
-import org.apache.sentry.service.thrift.Status;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
+import org.apache.sentry.api.common.Status;
import org.junit.BeforeClass;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/log/util/TestCommandUtil.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/log/util/TestCommandUtil.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/log/util/TestCommandUtil.java
index 8cf0e70..2b2c411 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/log/util/TestCommandUtil.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/log/util/TestCommandUtil.java
@@ -23,12 +23,12 @@ import java.util.List;
import java.util.Set;
import org.apache.sentry.core.model.db.AccessConstants;
-import org.apache.sentry.provider.db.generic.service.thrift.TAuthorizable;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleGrantPrivilegeRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleRevokePrivilegeRequest;
-import org.apache.sentry.provider.db.service.thrift.TSentryGrantOption;
-import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege;
-import org.apache.sentry.service.thrift.ServiceConstants.PrivilegeScope;
+import org.apache.sentry.api.generic.thrift.TAuthorizable;
+import org.apache.sentry.api.common.ApiConstants.PrivilegeScope;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleGrantPrivilegeRequest;
+import org.apache.sentry.api.service.thrift.TAlterSentryRoleRevokePrivilegeRequest;
+import org.apache.sentry.api.service.thrift.TSentryGrantOption;
+import org.apache.sentry.api.service.thrift.TSentryPrivilege;
import org.junit.Assert;
import org.junit.Test;
@@ -308,9 +308,9 @@ public class TestCommandUtil extends Assert {
// generate the command without grant option
@Test
public void testCreateCmdForGrantOrRevokeGMPrivilege1() {
- org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleGrantPrivilegeRequest grantRequest = getGrantGMPrivilegeRequest();
- org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleRevokePrivilegeRequest revokeRequest = getRevokeGMPrivilegeRequest();
- org.apache.sentry.provider.db.generic.service.thrift.TSentryPrivilege privilege = getGMPrivilege();
+ org.apache.sentry.api.generic.thrift.TAlterSentryRoleGrantPrivilegeRequest grantRequest = getGrantGMPrivilegeRequest();
+ org.apache.sentry.api.generic.thrift.TAlterSentryRoleRevokePrivilegeRequest revokeRequest = getRevokeGMPrivilegeRequest();
+ org.apache.sentry.api.generic.thrift.TSentryPrivilege privilege = getGMPrivilege();
grantRequest.setPrivilege(privilege);
revokeRequest.setPrivilege(privilege);
@@ -327,11 +327,11 @@ public class TestCommandUtil extends Assert {
// generate the command with grant option
@Test
public void testCreateCmdForGrantOrRevokeGMPrivilege2() {
- org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleGrantPrivilegeRequest grantRequest = getGrantGMPrivilegeRequest();
- org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleRevokePrivilegeRequest revokeRequest = getRevokeGMPrivilegeRequest();
- org.apache.sentry.provider.db.generic.service.thrift.TSentryPrivilege privilege = getGMPrivilege();
+ org.apache.sentry.api.generic.thrift.TAlterSentryRoleGrantPrivilegeRequest grantRequest = getGrantGMPrivilegeRequest();
+ org.apache.sentry.api.generic.thrift.TAlterSentryRoleRevokePrivilegeRequest revokeRequest = getRevokeGMPrivilegeRequest();
+ org.apache.sentry.api.generic.thrift.TSentryPrivilege privilege = getGMPrivilege();
privilege
- .setGrantOption(org.apache.sentry.provider.db.generic.service.thrift.TSentryGrantOption.TRUE);
+ .setGrantOption(org.apache.sentry.api.generic.thrift.TSentryGrantOption.TRUE);
grantRequest.setPrivilege(privilege);
revokeRequest.setPrivilege(privilege);
@@ -379,14 +379,14 @@ public class TestCommandUtil extends Assert {
return request;
}
- private org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleGrantPrivilegeRequest getGrantGMPrivilegeRequest() {
- org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleGrantPrivilegeRequest request = new org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleGrantPrivilegeRequest();
+ private org.apache.sentry.api.generic.thrift.TAlterSentryRoleGrantPrivilegeRequest getGrantGMPrivilegeRequest() {
+ org.apache.sentry.api.generic.thrift.TAlterSentryRoleGrantPrivilegeRequest request = new org.apache.sentry.api.generic.thrift.TAlterSentryRoleGrantPrivilegeRequest();
request.setRoleName("testRole");
return request;
}
- private org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleRevokePrivilegeRequest getRevokeGMPrivilegeRequest() {
- org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleRevokePrivilegeRequest request = new org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleRevokePrivilegeRequest();
+ private org.apache.sentry.api.generic.thrift.TAlterSentryRoleRevokePrivilegeRequest getRevokeGMPrivilegeRequest() {
+ org.apache.sentry.api.generic.thrift.TAlterSentryRoleRevokePrivilegeRequest request = new org.apache.sentry.api.generic.thrift.TAlterSentryRoleRevokePrivilegeRequest();
request.setRoleName("testRole");
return request;
}
@@ -403,8 +403,8 @@ public class TestCommandUtil extends Assert {
return privilege;
}
- private org.apache.sentry.provider.db.generic.service.thrift.TSentryPrivilege getGMPrivilege() {
- org.apache.sentry.provider.db.generic.service.thrift.TSentryPrivilege privilege = new org.apache.sentry.provider.db.generic.service.thrift.TSentryPrivilege();
+ private org.apache.sentry.api.generic.thrift.TSentryPrivilege getGMPrivilege() {
+ org.apache.sentry.api.generic.thrift.TSentryPrivilege privilege = new org.apache.sentry.api.generic.thrift.TSentryPrivilege();
privilege.setAction("ACTION");
privilege.setComponent("COMPONENT");
List<TAuthorizable> authorizables = new ArrayList<TAuthorizable>();
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
index 4b38635..0c66dd2 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
@@ -54,9 +54,9 @@ import org.apache.sentry.hdfs.UniquePathsUpdate;
import org.apache.sentry.service.thrift.SentryHMSClient;
import org.apache.sentry.service.thrift.HiveConnectionFactory;
import org.apache.sentry.service.thrift.HiveSimpleConnectionFactory;
-import org.apache.sentry.service.thrift.ServiceConstants;
+import org.apache.sentry.service.common.ServiceConstants;
import org.apache.sentry.service.thrift.HMSClient;
-import org.apache.sentry.provider.db.service.thrift.TSentryAuthorizable;
+import org.apache.sentry.api.service.thrift.TSentryAuthorizable;
import static org.apache.sentry.hdfs.ServiceConstants.ServerConfig.SENTRY_SERVICE_FULL_UPDATE_PUBSUB;
import org.junit.Before;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollowerSentryStoreIntegration.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollowerSentryStoreIntegration.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollowerSentryStoreIntegration.java
index 91c90f9..4e8a2e6 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollowerSentryStoreIntegration.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollowerSentryStoreIntegration.java
@@ -33,10 +33,10 @@ import org.apache.hadoop.hive.metastore.messaging.EventMessage;
import org.apache.hadoop.hive.metastore.messaging.EventMessage.EventType;
import org.apache.sentry.binding.metastore.messaging.json.SentryJSONMessageFactory;
-import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege;
+import org.apache.sentry.api.service.thrift.TSentryPrivilege;
import org.apache.sentry.service.thrift.HiveSimpleConnectionFactory;
import org.apache.sentry.provider.file.PolicyFile;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestLeaderStatusMonitor.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestLeaderStatusMonitor.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestLeaderStatusMonitor.java
index 395516c..f6592ec 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestLeaderStatusMonitor.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestLeaderStatusMonitor.java
@@ -25,7 +25,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static java.lang.Thread.sleep;
-import static org.apache.sentry.service.thrift.ServiceConstants.ServerConfig.SENTRY_HA_ZOOKEEPER_QUORUM;
+import static org.apache.sentry.service.common.ServiceConstants.ServerConfig.SENTRY_HA_ZOOKEEPER_QUORUM;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestNotificationProcessor.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestNotificationProcessor.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestNotificationProcessor.java
index 923faff..f227bb4 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestNotificationProcessor.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestNotificationProcessor.java
@@ -33,8 +33,8 @@ import org.apache.hadoop.hive.metastore.api.Table;
import org.apache.hadoop.hive.metastore.messaging.EventMessage;
import org.apache.sentry.binding.metastore.messaging.json.SentryJSONMessageFactory;
import org.apache.sentry.hdfs.UniquePathsUpdate;
-import org.apache.sentry.service.thrift.ServiceConstants;
-import org.apache.sentry.provider.db.service.thrift.TSentryAuthorizable;
+import org.apache.sentry.service.common.ServiceConstants;
+import org.apache.sentry.api.service.thrift.TSentryAuthorizable;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStore.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStore.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStore.java
index 679a097..152c0ce 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStore.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStore.java
@@ -64,16 +64,16 @@ import org.apache.sentry.provider.db.service.model.MSentryPermChange;
import org.apache.sentry.provider.db.service.model.MSentryPathChange;
import org.apache.sentry.provider.db.service.model.MSentryPrivilege;
import org.apache.sentry.provider.db.service.model.MSentryRole;
-import org.apache.sentry.provider.db.service.thrift.TSentryActiveRoleSet;
-import org.apache.sentry.provider.db.service.thrift.TSentryAuthorizable;
-import org.apache.sentry.provider.db.service.thrift.TSentryGrantOption;
-import org.apache.sentry.provider.db.service.thrift.TSentryGroup;
-import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege;
-import org.apache.sentry.provider.db.service.thrift.TSentryRole;
+import org.apache.sentry.api.service.thrift.TSentryActiveRoleSet;
+import org.apache.sentry.api.service.thrift.TSentryAuthorizable;
+import org.apache.sentry.api.service.thrift.TSentryGrantOption;
+import org.apache.sentry.api.service.thrift.TSentryGroup;
+import org.apache.sentry.api.service.thrift.TSentryPrivilege;
+import org.apache.sentry.api.service.thrift.TSentryRole;
import org.apache.sentry.provider.file.PolicyFile;
-import org.apache.sentry.service.thrift.SentryServiceUtil;
-import org.apache.sentry.service.thrift.ServiceConstants;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
+import org.apache.sentry.api.common.SentryServiceUtil;
+import org.apache.sentry.service.common.ServiceConstants;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStoreImportExport.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStoreImportExport.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStoreImportExport.java
index b085ac3..ebc8c31 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStoreImportExport.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStoreImportExport.java
@@ -33,13 +33,13 @@ import org.apache.sentry.provider.db.service.model.MSentryGroup;
import org.apache.sentry.provider.db.service.model.MSentryPrivilege;
import org.apache.sentry.provider.db.service.model.MSentryRole;
import org.apache.sentry.provider.db.service.model.MSentryUser;
-import org.apache.sentry.provider.db.service.thrift.TSentryGrantOption;
-import org.apache.sentry.provider.db.service.thrift.TSentryMappingData;
-import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege;
+import org.apache.sentry.api.common.ApiConstants.PrivilegeScope;
+import org.apache.sentry.api.service.thrift.TSentryGrantOption;
+import org.apache.sentry.api.service.thrift.TSentryMappingData;
+import org.apache.sentry.api.service.thrift.TSentryPrivilege;
import org.apache.sentry.provider.file.PolicyFile;
-import org.apache.sentry.service.thrift.SentryServiceUtil;
-import org.apache.sentry.service.thrift.ServiceConstants.PrivilegeScope;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
+import org.apache.sentry.api.common.SentryServiceUtil;
+import org.apache.sentry.service.common.ServiceConstants.ServerConfig;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
[46/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAuthorizable.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAuthorizable.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAuthorizable.java
deleted file mode 100644
index 0e0cdeb..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TAuthorizable.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/**
- * 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.provider.db.generic.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 TAuthorizable implements org.apache.thrift.TBase<TAuthorizable, TAuthorizable._Fields>, java.io.Serializable, Cloneable, Comparable<TAuthorizable> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAuthorizable");
-
- private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAuthorizableStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAuthorizableTupleSchemeFactory());
- }
-
- private String type; // required
- private String name; // 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 {
- TYPE((short)1, "type"),
- NAME((short)2, "name");
-
- 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: // TYPE
- return TYPE;
- case 2: // NAME
- return NAME;
- 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.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAuthorizable.class, metaDataMap);
- }
-
- public TAuthorizable() {
- }
-
- public TAuthorizable(
- String type,
- String name)
- {
- this();
- this.type = type;
- this.name = name;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAuthorizable(TAuthorizable other) {
- if (other.isSetType()) {
- this.type = other.type;
- }
- if (other.isSetName()) {
- this.name = other.name;
- }
- }
-
- public TAuthorizable deepCopy() {
- return new TAuthorizable(this);
- }
-
- @Override
- public void clear() {
- this.type = null;
- this.name = null;
- }
-
- public String getType() {
- return this.type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public void unsetType() {
- this.type = null;
- }
-
- /** Returns true if field type is set (has been assigned a value) and false otherwise */
- public boolean isSetType() {
- return this.type != null;
- }
-
- public void setTypeIsSet(boolean value) {
- if (!value) {
- this.type = null;
- }
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void unsetName() {
- this.name = null;
- }
-
- /** Returns true if field name is set (has been assigned a value) and false otherwise */
- public boolean isSetName() {
- return this.name != null;
- }
-
- public void setNameIsSet(boolean value) {
- if (!value) {
- this.name = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case TYPE:
- if (value == null) {
- unsetType();
- } else {
- setType((String)value);
- }
- break;
-
- case NAME:
- if (value == null) {
- unsetName();
- } else {
- setName((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case TYPE:
- return getType();
-
- case NAME:
- return getName();
-
- }
- 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 TYPE:
- return isSetType();
- case NAME:
- return isSetName();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAuthorizable)
- return this.equals((TAuthorizable)that);
- return false;
- }
-
- public boolean equals(TAuthorizable that) {
- if (that == null)
- return false;
-
- boolean this_present_type = true && this.isSetType();
- boolean that_present_type = true && that.isSetType();
- if (this_present_type || that_present_type) {
- if (!(this_present_type && that_present_type))
- return false;
- if (!this.type.equals(that.type))
- return false;
- }
-
- boolean this_present_name = true && this.isSetName();
- boolean that_present_name = true && that.isSetName();
- if (this_present_name || that_present_name) {
- if (!(this_present_name && that_present_name))
- return false;
- if (!this.name.equals(that.name))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- List<Object> list = new ArrayList<Object>();
-
- boolean present_type = true && (isSetType());
- list.add(present_type);
- if (present_type)
- list.add(type);
-
- boolean present_name = true && (isSetName());
- list.add(present_name);
- if (present_name)
- list.add(name);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TAuthorizable other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetType()).compareTo(other.isSetType());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetType()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
- 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("TAuthorizable(");
- boolean first = true;
-
- sb.append("type:");
- if (this.type == null) {
- sb.append("null");
- } else {
- sb.append(this.type);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("name:");
- if (this.name == null) {
- sb.append("null");
- } else {
- sb.append(this.name);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetType()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'type' is unset! Struct:" + toString());
- }
-
- if (!isSetName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'name' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TAuthorizableStandardSchemeFactory implements SchemeFactory {
- public TAuthorizableStandardScheme getScheme() {
- return new TAuthorizableStandardScheme();
- }
- }
-
- private static class TAuthorizableStandardScheme extends StandardScheme<TAuthorizable> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAuthorizable 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: // TYPE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.type = iprot.readString();
- struct.setTypeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.name = iprot.readString();
- struct.setNameIsSet(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, TAuthorizable struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.type != null) {
- oprot.writeFieldBegin(TYPE_FIELD_DESC);
- oprot.writeString(struct.type);
- oprot.writeFieldEnd();
- }
- if (struct.name != null) {
- oprot.writeFieldBegin(NAME_FIELD_DESC);
- oprot.writeString(struct.name);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAuthorizableTupleSchemeFactory implements SchemeFactory {
- public TAuthorizableTupleScheme getScheme() {
- return new TAuthorizableTupleScheme();
- }
- }
-
- private static class TAuthorizableTupleScheme extends TupleScheme<TAuthorizable> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAuthorizable struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeString(struct.type);
- oprot.writeString(struct.name);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAuthorizable struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.type = iprot.readString();
- struct.setTypeIsSet(true);
- struct.name = iprot.readString();
- struct.setNameIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TCreateSentryRoleRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TCreateSentryRoleRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TCreateSentryRoleRequest.java
deleted file mode 100644
index e6ed656..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TCreateSentryRoleRequest.java
+++ /dev/null
@@ -1,692 +0,0 @@
-/**
- * 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.provider.db.generic.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 TCreateSentryRoleRequest implements org.apache.thrift.TBase<TCreateSentryRoleRequest, TCreateSentryRoleRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TCreateSentryRoleRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCreateSentryRoleRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TCreateSentryRoleRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TCreateSentryRoleRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private String component; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName"),
- COMPONENT((short)4, "component");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- case 4: // COMPONENT
- return COMPONENT;
- 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TCreateSentryRoleRequest.class, metaDataMap);
- }
-
- public TCreateSentryRoleRequest() {
- this.protocol_version = 2;
-
- }
-
- public TCreateSentryRoleRequest(
- int protocol_version,
- String requestorUserName,
- String roleName,
- String component)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- this.component = component;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TCreateSentryRoleRequest(TCreateSentryRoleRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetComponent()) {
- this.component = other.component;
- }
- }
-
- public TCreateSentryRoleRequest deepCopy() {
- return new TCreateSentryRoleRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.component = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public String getComponent() {
- return this.component;
- }
-
- public void setComponent(String component) {
- this.component = component;
- }
-
- public void unsetComponent() {
- this.component = null;
- }
-
- /** Returns true if field component is set (has been assigned a value) and false otherwise */
- public boolean isSetComponent() {
- return this.component != null;
- }
-
- public void setComponentIsSet(boolean value) {
- if (!value) {
- this.component = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case COMPONENT:
- if (value == null) {
- unsetComponent();
- } else {
- setComponent((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case COMPONENT:
- return getComponent();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case COMPONENT:
- return isSetComponent();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TCreateSentryRoleRequest)
- return this.equals((TCreateSentryRoleRequest)that);
- return false;
- }
-
- public boolean equals(TCreateSentryRoleRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- boolean this_present_component = true && this.isSetComponent();
- boolean that_present_component = true && that.isSetComponent();
- if (this_present_component || that_present_component) {
- if (!(this_present_component && that_present_component))
- return false;
- if (!this.component.equals(that.component))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- list.add(present_roleName);
- if (present_roleName)
- list.add(roleName);
-
- boolean present_component = true && (isSetComponent());
- list.add(present_component);
- if (present_component)
- list.add(component);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TCreateSentryRoleRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetComponent()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
- 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("TCreateSentryRoleRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("component:");
- if (this.component == null) {
- sb.append("null");
- } else {
- sb.append(this.component);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- if (!isSetComponent()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- 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 TCreateSentryRoleRequestStandardSchemeFactory implements SchemeFactory {
- public TCreateSentryRoleRequestStandardScheme getScheme() {
- return new TCreateSentryRoleRequestStandardScheme();
- }
- }
-
- private static class TCreateSentryRoleRequestStandardScheme extends StandardScheme<TCreateSentryRoleRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TCreateSentryRoleRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // COMPONENT
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.component = iprot.readString();
- struct.setComponentIsSet(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, TCreateSentryRoleRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.component != null) {
- oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
- oprot.writeString(struct.component);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TCreateSentryRoleRequestTupleSchemeFactory implements SchemeFactory {
- public TCreateSentryRoleRequestTupleScheme getScheme() {
- return new TCreateSentryRoleRequestTupleScheme();
- }
- }
-
- private static class TCreateSentryRoleRequestTupleScheme extends TupleScheme<TCreateSentryRoleRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- oprot.writeString(struct.component);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TCreateSentryRoleResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TCreateSentryRoleResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TCreateSentryRoleResponse.java
deleted file mode 100644
index dec18a0..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TCreateSentryRoleResponse.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/**
- * 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.provider.db.generic.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 TCreateSentryRoleResponse implements org.apache.thrift.TBase<TCreateSentryRoleResponse, TCreateSentryRoleResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TCreateSentryRoleResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCreateSentryRoleResponse");
-
- 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TCreateSentryRoleResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TCreateSentryRoleResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
-
- 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;
- 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TCreateSentryRoleResponse.class, metaDataMap);
- }
-
- public TCreateSentryRoleResponse() {
- }
-
- public TCreateSentryRoleResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TCreateSentryRoleResponse(TCreateSentryRoleResponse other) {
- if (other.isSetStatus()) {
- this.status = other.status;
- }
- }
-
- public TCreateSentryRoleResponse deepCopy() {
- return new TCreateSentryRoleResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- 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();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TCreateSentryRoleResponse)
- return this.equals((TCreateSentryRoleResponse)that);
- return false;
- }
-
- public boolean equals(TCreateSentryRoleResponse 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;
- }
-
- 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);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TCreateSentryRoleResponse 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;
- }
- }
- 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("TCreateSentryRoleResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- 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());
- }
-
- // check for sub-struct validity
- }
-
- 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 TCreateSentryRoleResponseStandardSchemeFactory implements SchemeFactory {
- public TCreateSentryRoleResponseStandardScheme getScheme() {
- return new TCreateSentryRoleResponseStandardScheme();
- }
- }
-
- private static class TCreateSentryRoleResponseStandardScheme extends StandardScheme<TCreateSentryRoleResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TCreateSentryRoleResponse 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;
- 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, TCreateSentryRoleResponse 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.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TCreateSentryRoleResponseTupleSchemeFactory implements SchemeFactory {
- public TCreateSentryRoleResponseTupleScheme getScheme() {
- return new TCreateSentryRoleResponseTupleScheme();
- }
- }
-
- private static class TCreateSentryRoleResponseTupleScheme extends TupleScheme<TCreateSentryRoleResponse> {
-
- @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 read(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleResponse 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);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TDropPrivilegesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TDropPrivilegesRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TDropPrivilegesRequest.java
deleted file mode 100644
index a7ee9c7..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/generic/service/thrift/TDropPrivilegesRequest.java
+++ /dev/null
@@ -1,697 +0,0 @@
-/**
- * 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.provider.db.generic.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 TDropPrivilegesRequest implements org.apache.thrift.TBase<TDropPrivilegesRequest, TDropPrivilegesRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TDropPrivilegesRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropPrivilegesRequest");
-
- 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField PRIVILEGE_FIELD_DESC = new org.apache.thrift.protocol.TField("privilege", org.apache.thrift.protocol.TType.STRUCT, (short)3);
- private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)4);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TDropPrivilegesRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TDropPrivilegesRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private TSentryPrivilege privilege; // required
- private String component; // 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"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- PRIVILEGE((short)3, "privilege"),
- COMPONENT((short)4, "component");
-
- 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: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // PRIVILEGE
- return PRIVILEGE;
- case 4: // COMPONENT
- return COMPONENT;
- 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.PRIVILEGE, new org.apache.thrift.meta_data.FieldMetaData("privilege", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class)));
- tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropPrivilegesRequest.class, metaDataMap);
- }
-
- public TDropPrivilegesRequest() {
- this.protocol_version = 2;
-
- }
-
- public TDropPrivilegesRequest(
- int protocol_version,
- String requestorUserName,
- TSentryPrivilege privilege,
- String component)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.privilege = privilege;
- this.component = component;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TDropPrivilegesRequest(TDropPrivilegesRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetPrivilege()) {
- this.privilege = new TSentryPrivilege(other.privilege);
- }
- if (other.isSetComponent()) {
- this.component = other.component;
- }
- }
-
- public TDropPrivilegesRequest deepCopy() {
- return new TDropPrivilegesRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.requestorUserName = null;
- this.privilege = null;
- this.component = 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 String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public TSentryPrivilege getPrivilege() {
- return this.privilege;
- }
-
- public void setPrivilege(TSentryPrivilege privilege) {
- this.privilege = privilege;
- }
-
- public void unsetPrivilege() {
- this.privilege = null;
- }
-
- /** Returns true if field privilege is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivilege() {
- return this.privilege != null;
- }
-
- public void setPrivilegeIsSet(boolean value) {
- if (!value) {
- this.privilege = null;
- }
- }
-
- public String getComponent() {
- return this.component;
- }
-
- public void setComponent(String component) {
- this.component = component;
- }
-
- public void unsetComponent() {
- this.component = null;
- }
-
- /** Returns true if field component is set (has been assigned a value) and false otherwise */
- public boolean isSetComponent() {
- return this.component != null;
- }
-
- public void setComponentIsSet(boolean value) {
- if (!value) {
- this.component = 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 REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case PRIVILEGE:
- if (value == null) {
- unsetPrivilege();
- } else {
- setPrivilege((TSentryPrivilege)value);
- }
- break;
-
- case COMPONENT:
- if (value == null) {
- unsetComponent();
- } else {
- setComponent((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case PRIVILEGE:
- return getPrivilege();
-
- case COMPONENT:
- return getComponent();
-
- }
- 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 REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case PRIVILEGE:
- return isSetPrivilege();
- case COMPONENT:
- return isSetComponent();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TDropPrivilegesRequest)
- return this.equals((TDropPrivilegesRequest)that);
- return false;
- }
-
- public boolean equals(TDropPrivilegesRequest 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_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_privilege = true && this.isSetPrivilege();
- boolean that_present_privilege = true && that.isSetPrivilege();
- if (this_present_privilege || that_present_privilege) {
- if (!(this_present_privilege && that_present_privilege))
- return false;
- if (!this.privilege.equals(that.privilege))
- return false;
- }
-
- boolean this_present_component = true && this.isSetComponent();
- boolean that_present_component = true && that.isSetComponent();
- if (this_present_component || that_present_component) {
- if (!(this_present_component && that_present_component))
- return false;
- if (!this.component.equals(that.component))
- 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_requestorUserName = true && (isSetRequestorUserName());
- list.add(present_requestorUserName);
- if (present_requestorUserName)
- list.add(requestorUserName);
-
- boolean present_privilege = true && (isSetPrivilege());
- list.add(present_privilege);
- if (present_privilege)
- list.add(privilege);
-
- boolean present_component = true && (isSetComponent());
- list.add(present_component);
- if (present_component)
- list.add(component);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TDropPrivilegesRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetPrivilege()).compareTo(other.isSetPrivilege());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivilege()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilege, other.privilege);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetComponent()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
- 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("TDropPrivilegesRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("privilege:");
- if (this.privilege == null) {
- sb.append("null");
- } else {
- sb.append(this.privilege);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("component:");
- if (this.component == null) {
- sb.append("null");
- } else {
- sb.append(this.component);
- }
- 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 (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetPrivilege()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilege' is unset! Struct:" + toString());
- }
-
- if (!isSetComponent()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (privilege != null) {
- privilege.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 TDropPrivilegesRequestStandardSchemeFactory implements SchemeFactory {
- public TDropPrivilegesRequestStandardScheme getScheme() {
- return new TDropPrivilegesRequestStandardScheme();
- }
- }
-
- private static class TDropPrivilegesRequestStandardScheme extends StandardScheme<TDropPrivilegesRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TDropPrivilegesRequest 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: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // PRIVILEGE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.privilege = new TSentryPrivilege();
- struct.privilege.read(iprot);
- struct.setPrivilegeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // COMPONENT
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.component = iprot.readString();
- struct.setComponentIsSet(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, TDropPrivilegesRequest 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();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.privilege != null) {
- oprot.writeFieldBegin(PRIVILEGE_FIELD_DESC);
- struct.privilege.write(oprot);
- oprot.writeFieldEnd();
- }
- if (struct.component != null) {
- oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
- oprot.writeString(struct.component);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TDropPrivilegesRequestTupleSchemeFactory implements SchemeFactory {
- public TDropPrivilegesRequestTupleScheme getScheme() {
- return new TDropPrivilegesRequestTupleScheme();
- }
- }
-
- private static class TDropPrivilegesRequestTupleScheme extends TupleScheme<TDropPrivilegesRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- struct.privilege.write(oprot);
- oprot.writeString(struct.component);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.privilege = new TSentryPrivilege();
- struct.privilege.read(iprot);
- struct.setPrivilegeIsSet(true);
- struct.component = iprot.readString();
- struct.setComponentIsSet(true);
- }
- }
-
-}
-
[33/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesByAuthResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesByAuthResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesByAuthResponse.java
deleted file mode 100644
index d87300a..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesByAuthResponse.java
+++ /dev/null
@@ -1,571 +0,0 @@
-/**
- * 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.provider.db.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 TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TBase<TListSentryPrivilegesByAuthResponse, TListSentryPrivilegesByAuthResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesByAuthResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesByAuthResponse");
-
- 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 PRIVILEGES_MAP_BY_AUTH_FIELD_DESC = new org.apache.thrift.protocol.TField("privilegesMapByAuth", org.apache.thrift.protocol.TType.MAP, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryPrivilegesByAuthResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryPrivilegesByAuthResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
- private Map<TSentryAuthorizable,TSentryPrivilegeMap> privilegesMapByAuth; // optional
-
- /** 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"),
- PRIVILEGES_MAP_BY_AUTH((short)2, "privilegesMapByAuth");
-
- 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: // PRIVILEGES_MAP_BY_AUTH
- return PRIVILEGES_MAP_BY_AUTH;
- 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 _Fields optionals[] = {_Fields.PRIVILEGES_MAP_BY_AUTH};
- 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.PRIVILEGES_MAP_BY_AUTH, new org.apache.thrift.meta_data.FieldMetaData("privilegesMapByAuth", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class),
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilegeMap.class))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesByAuthResponse.class, metaDataMap);
- }
-
- public TListSentryPrivilegesByAuthResponse() {
- }
-
- public TListSentryPrivilegesByAuthResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryPrivilegesByAuthResponse(TListSentryPrivilegesByAuthResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- if (other.isSetPrivilegesMapByAuth()) {
- Map<TSentryAuthorizable,TSentryPrivilegeMap> __this__privilegesMapByAuth = new HashMap<TSentryAuthorizable,TSentryPrivilegeMap>(other.privilegesMapByAuth.size());
- for (Map.Entry<TSentryAuthorizable, TSentryPrivilegeMap> other_element : other.privilegesMapByAuth.entrySet()) {
-
- TSentryAuthorizable other_element_key = other_element.getKey();
- TSentryPrivilegeMap other_element_value = other_element.getValue();
-
- TSentryAuthorizable __this__privilegesMapByAuth_copy_key = new TSentryAuthorizable(other_element_key);
-
- TSentryPrivilegeMap __this__privilegesMapByAuth_copy_value = new TSentryPrivilegeMap(other_element_value);
-
- __this__privilegesMapByAuth.put(__this__privilegesMapByAuth_copy_key, __this__privilegesMapByAuth_copy_value);
- }
- this.privilegesMapByAuth = __this__privilegesMapByAuth;
- }
- }
-
- public TListSentryPrivilegesByAuthResponse deepCopy() {
- return new TListSentryPrivilegesByAuthResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- this.privilegesMapByAuth = null;
- }
-
- 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 int getPrivilegesMapByAuthSize() {
- return (this.privilegesMapByAuth == null) ? 0 : this.privilegesMapByAuth.size();
- }
-
- public void putToPrivilegesMapByAuth(TSentryAuthorizable key, TSentryPrivilegeMap val) {
- if (this.privilegesMapByAuth == null) {
- this.privilegesMapByAuth = new HashMap<TSentryAuthorizable,TSentryPrivilegeMap>();
- }
- this.privilegesMapByAuth.put(key, val);
- }
-
- public Map<TSentryAuthorizable,TSentryPrivilegeMap> getPrivilegesMapByAuth() {
- return this.privilegesMapByAuth;
- }
-
- public void setPrivilegesMapByAuth(Map<TSentryAuthorizable,TSentryPrivilegeMap> privilegesMapByAuth) {
- this.privilegesMapByAuth = privilegesMapByAuth;
- }
-
- public void unsetPrivilegesMapByAuth() {
- this.privilegesMapByAuth = null;
- }
-
- /** Returns true if field privilegesMapByAuth is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivilegesMapByAuth() {
- return this.privilegesMapByAuth != null;
- }
-
- public void setPrivilegesMapByAuthIsSet(boolean value) {
- if (!value) {
- this.privilegesMapByAuth = null;
- }
- }
-
- 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 PRIVILEGES_MAP_BY_AUTH:
- if (value == null) {
- unsetPrivilegesMapByAuth();
- } else {
- setPrivilegesMapByAuth((Map<TSentryAuthorizable,TSentryPrivilegeMap>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- case PRIVILEGES_MAP_BY_AUTH:
- return getPrivilegesMapByAuth();
-
- }
- 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 PRIVILEGES_MAP_BY_AUTH:
- return isSetPrivilegesMapByAuth();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryPrivilegesByAuthResponse)
- return this.equals((TListSentryPrivilegesByAuthResponse)that);
- return false;
- }
-
- public boolean equals(TListSentryPrivilegesByAuthResponse 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_privilegesMapByAuth = true && this.isSetPrivilegesMapByAuth();
- boolean that_present_privilegesMapByAuth = true && that.isSetPrivilegesMapByAuth();
- if (this_present_privilegesMapByAuth || that_present_privilegesMapByAuth) {
- if (!(this_present_privilegesMapByAuth && that_present_privilegesMapByAuth))
- return false;
- if (!this.privilegesMapByAuth.equals(that.privilegesMapByAuth))
- 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_privilegesMapByAuth = true && (isSetPrivilegesMapByAuth());
- list.add(present_privilegesMapByAuth);
- if (present_privilegesMapByAuth)
- list.add(privilegesMapByAuth);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TListSentryPrivilegesByAuthResponse 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(isSetPrivilegesMapByAuth()).compareTo(other.isSetPrivilegesMapByAuth());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivilegesMapByAuth()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilegesMapByAuth, other.privilegesMapByAuth);
- 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("TListSentryPrivilegesByAuthResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- if (isSetPrivilegesMapByAuth()) {
- if (!first) sb.append(", ");
- sb.append("privilegesMapByAuth:");
- if (this.privilegesMapByAuth == null) {
- sb.append("null");
- } else {
- sb.append(this.privilegesMapByAuth);
- }
- 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());
- }
-
- // 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 {
- 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 TListSentryPrivilegesByAuthResponseStandardSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesByAuthResponseStandardScheme getScheme() {
- return new TListSentryPrivilegesByAuthResponseStandardScheme();
- }
- }
-
- private static class TListSentryPrivilegesByAuthResponseStandardScheme extends StandardScheme<TListSentryPrivilegesByAuthResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesByAuthResponse 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: // PRIVILEGES_MAP_BY_AUTH
- if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
- {
- org.apache.thrift.protocol.TMap _map146 = iprot.readMapBegin();
- struct.privilegesMapByAuth = new HashMap<TSentryAuthorizable,TSentryPrivilegeMap>(2*_map146.size);
- TSentryAuthorizable _key147;
- TSentryPrivilegeMap _val148;
- for (int _i149 = 0; _i149 < _map146.size; ++_i149)
- {
- _key147 = new TSentryAuthorizable();
- _key147.read(iprot);
- _val148 = new TSentryPrivilegeMap();
- _val148.read(iprot);
- struct.privilegesMapByAuth.put(_key147, _val148);
- }
- iprot.readMapEnd();
- }
- struct.setPrivilegesMapByAuthIsSet(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, TListSentryPrivilegesByAuthResponse 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();
- }
- if (struct.privilegesMapByAuth != null) {
- if (struct.isSetPrivilegesMapByAuth()) {
- oprot.writeFieldBegin(PRIVILEGES_MAP_BY_AUTH_FIELD_DESC);
- {
- oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT, org.apache.thrift.protocol.TType.STRUCT, struct.privilegesMapByAuth.size()));
- for (Map.Entry<TSentryAuthorizable, TSentryPrivilegeMap> _iter150 : struct.privilegesMapByAuth.entrySet())
- {
- _iter150.getKey().write(oprot);
- _iter150.getValue().write(oprot);
- }
- oprot.writeMapEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryPrivilegesByAuthResponseTupleSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesByAuthResponseTupleScheme getScheme() {
- return new TListSentryPrivilegesByAuthResponseTupleScheme();
- }
- }
-
- private static class TListSentryPrivilegesByAuthResponseTupleScheme extends TupleScheme<TListSentryPrivilegesByAuthResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesByAuthResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- BitSet optionals = new BitSet();
- if (struct.isSetPrivilegesMapByAuth()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetPrivilegesMapByAuth()) {
- {
- oprot.writeI32(struct.privilegesMapByAuth.size());
- for (Map.Entry<TSentryAuthorizable, TSentryPrivilegeMap> _iter151 : struct.privilegesMapByAuth.entrySet())
- {
- _iter151.getKey().write(oprot);
- _iter151.getValue().write(oprot);
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesByAuthResponse 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);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- {
- org.apache.thrift.protocol.TMap _map152 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.privilegesMapByAuth = new HashMap<TSentryAuthorizable,TSentryPrivilegeMap>(2*_map152.size);
- TSentryAuthorizable _key153;
- TSentryPrivilegeMap _val154;
- for (int _i155 = 0; _i155 < _map152.size; ++_i155)
- {
- _key153 = new TSentryAuthorizable();
- _key153.read(iprot);
- _val154 = new TSentryPrivilegeMap();
- _val154.read(iprot);
- struct.privilegesMapByAuth.put(_key153, _val154);
- }
- }
- struct.setPrivilegesMapByAuthIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderRequest.java
deleted file mode 100644
index 3c860e4..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderRequest.java
+++ /dev/null
@@ -1,915 +0,0 @@
-/**
- * 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.provider.db.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 TListSentryPrivilegesForProviderRequest implements org.apache.thrift.TBase<TListSentryPrivilegesForProviderRequest, TListSentryPrivilegesForProviderRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesForProviderRequest> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesForProviderRequest");
-
- 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 GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_SET_FIELD_DESC = new org.apache.thrift.protocol.TField("roleSet", org.apache.thrift.protocol.TType.STRUCT, (short)3);
- private static final org.apache.thrift.protocol.TField AUTHORIZABLE_HIERARCHY_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizableHierarchy", org.apache.thrift.protocol.TType.STRUCT, (short)4);
- private static final org.apache.thrift.protocol.TField USERS_FIELD_DESC = new org.apache.thrift.protocol.TField("users", org.apache.thrift.protocol.TType.SET, (short)5);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryPrivilegesForProviderRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryPrivilegesForProviderRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private Set<String> groups; // required
- private TSentryActiveRoleSet roleSet; // required
- private TSentryAuthorizable authorizableHierarchy; // optional
- private Set<String> users; // optional
-
- /** 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"),
- GROUPS((short)2, "groups"),
- ROLE_SET((short)3, "roleSet"),
- AUTHORIZABLE_HIERARCHY((short)4, "authorizableHierarchy"),
- USERS((short)5, "users");
-
- 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: // GROUPS
- return GROUPS;
- case 3: // ROLE_SET
- return ROLE_SET;
- case 4: // AUTHORIZABLE_HIERARCHY
- return AUTHORIZABLE_HIERARCHY;
- case 5: // USERS
- return USERS;
- 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 byte __isset_bitfield = 0;
- private static final _Fields optionals[] = {_Fields.AUTHORIZABLE_HIERARCHY,_Fields.USERS};
- 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.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- tmpMap.put(_Fields.ROLE_SET, new org.apache.thrift.meta_data.FieldMetaData("roleSet", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryActiveRoleSet.class)));
- tmpMap.put(_Fields.AUTHORIZABLE_HIERARCHY, new org.apache.thrift.meta_data.FieldMetaData("authorizableHierarchy", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class)));
- tmpMap.put(_Fields.USERS, new org.apache.thrift.meta_data.FieldMetaData("users", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesForProviderRequest.class, metaDataMap);
- }
-
- public TListSentryPrivilegesForProviderRequest() {
- this.protocol_version = 2;
-
- }
-
- public TListSentryPrivilegesForProviderRequest(
- int protocol_version,
- Set<String> groups,
- TSentryActiveRoleSet roleSet)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.groups = groups;
- this.roleSet = roleSet;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryPrivilegesForProviderRequest(TListSentryPrivilegesForProviderRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetGroups()) {
- Set<String> __this__groups = new HashSet<String>(other.groups);
- this.groups = __this__groups;
- }
- if (other.isSetRoleSet()) {
- this.roleSet = new TSentryActiveRoleSet(other.roleSet);
- }
- if (other.isSetAuthorizableHierarchy()) {
- this.authorizableHierarchy = new TSentryAuthorizable(other.authorizableHierarchy);
- }
- if (other.isSetUsers()) {
- Set<String> __this__users = new HashSet<String>(other.users);
- this.users = __this__users;
- }
- }
-
- public TListSentryPrivilegesForProviderRequest deepCopy() {
- return new TListSentryPrivilegesForProviderRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 2;
-
- this.groups = null;
- this.roleSet = null;
- this.authorizableHierarchy = null;
- this.users = 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 int getGroupsSize() {
- return (this.groups == null) ? 0 : this.groups.size();
- }
-
- public java.util.Iterator<String> getGroupsIterator() {
- return (this.groups == null) ? null : this.groups.iterator();
- }
-
- public void addToGroups(String elem) {
- if (this.groups == null) {
- this.groups = new HashSet<String>();
- }
- this.groups.add(elem);
- }
-
- public Set<String> getGroups() {
- return this.groups;
- }
-
- public void setGroups(Set<String> groups) {
- this.groups = groups;
- }
-
- public void unsetGroups() {
- this.groups = null;
- }
-
- /** Returns true if field groups is set (has been assigned a value) and false otherwise */
- public boolean isSetGroups() {
- return this.groups != null;
- }
-
- public void setGroupsIsSet(boolean value) {
- if (!value) {
- this.groups = null;
- }
- }
-
- public TSentryActiveRoleSet getRoleSet() {
- return this.roleSet;
- }
-
- public void setRoleSet(TSentryActiveRoleSet roleSet) {
- this.roleSet = roleSet;
- }
-
- public void unsetRoleSet() {
- this.roleSet = null;
- }
-
- /** Returns true if field roleSet is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleSet() {
- return this.roleSet != null;
- }
-
- public void setRoleSetIsSet(boolean value) {
- if (!value) {
- this.roleSet = null;
- }
- }
-
- public TSentryAuthorizable getAuthorizableHierarchy() {
- return this.authorizableHierarchy;
- }
-
- public void setAuthorizableHierarchy(TSentryAuthorizable authorizableHierarchy) {
- this.authorizableHierarchy = authorizableHierarchy;
- }
-
- public void unsetAuthorizableHierarchy() {
- this.authorizableHierarchy = null;
- }
-
- /** Returns true if field authorizableHierarchy is set (has been assigned a value) and false otherwise */
- public boolean isSetAuthorizableHierarchy() {
- return this.authorizableHierarchy != null;
- }
-
- public void setAuthorizableHierarchyIsSet(boolean value) {
- if (!value) {
- this.authorizableHierarchy = null;
- }
- }
-
- public int getUsersSize() {
- return (this.users == null) ? 0 : this.users.size();
- }
-
- public java.util.Iterator<String> getUsersIterator() {
- return (this.users == null) ? null : this.users.iterator();
- }
-
- public void addToUsers(String elem) {
- if (this.users == null) {
- this.users = new HashSet<String>();
- }
- this.users.add(elem);
- }
-
- public Set<String> getUsers() {
- return this.users;
- }
-
- public void setUsers(Set<String> users) {
- this.users = users;
- }
-
- public void unsetUsers() {
- this.users = null;
- }
-
- /** Returns true if field users is set (has been assigned a value) and false otherwise */
- public boolean isSetUsers() {
- return this.users != null;
- }
-
- public void setUsersIsSet(boolean value) {
- if (!value) {
- this.users = 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 GROUPS:
- if (value == null) {
- unsetGroups();
- } else {
- setGroups((Set<String>)value);
- }
- break;
-
- case ROLE_SET:
- if (value == null) {
- unsetRoleSet();
- } else {
- setRoleSet((TSentryActiveRoleSet)value);
- }
- break;
-
- case AUTHORIZABLE_HIERARCHY:
- if (value == null) {
- unsetAuthorizableHierarchy();
- } else {
- setAuthorizableHierarchy((TSentryAuthorizable)value);
- }
- break;
-
- case USERS:
- if (value == null) {
- unsetUsers();
- } else {
- setUsers((Set<String>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return getProtocol_version();
-
- case GROUPS:
- return getGroups();
-
- case ROLE_SET:
- return getRoleSet();
-
- case AUTHORIZABLE_HIERARCHY:
- return getAuthorizableHierarchy();
-
- case USERS:
- return getUsers();
-
- }
- 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 GROUPS:
- return isSetGroups();
- case ROLE_SET:
- return isSetRoleSet();
- case AUTHORIZABLE_HIERARCHY:
- return isSetAuthorizableHierarchy();
- case USERS:
- return isSetUsers();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryPrivilegesForProviderRequest)
- return this.equals((TListSentryPrivilegesForProviderRequest)that);
- return false;
- }
-
- public boolean equals(TListSentryPrivilegesForProviderRequest 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_groups = true && this.isSetGroups();
- boolean that_present_groups = true && that.isSetGroups();
- if (this_present_groups || that_present_groups) {
- if (!(this_present_groups && that_present_groups))
- return false;
- if (!this.groups.equals(that.groups))
- return false;
- }
-
- boolean this_present_roleSet = true && this.isSetRoleSet();
- boolean that_present_roleSet = true && that.isSetRoleSet();
- if (this_present_roleSet || that_present_roleSet) {
- if (!(this_present_roleSet && that_present_roleSet))
- return false;
- if (!this.roleSet.equals(that.roleSet))
- return false;
- }
-
- boolean this_present_authorizableHierarchy = true && this.isSetAuthorizableHierarchy();
- boolean that_present_authorizableHierarchy = true && that.isSetAuthorizableHierarchy();
- if (this_present_authorizableHierarchy || that_present_authorizableHierarchy) {
- if (!(this_present_authorizableHierarchy && that_present_authorizableHierarchy))
- return false;
- if (!this.authorizableHierarchy.equals(that.authorizableHierarchy))
- return false;
- }
-
- boolean this_present_users = true && this.isSetUsers();
- boolean that_present_users = true && that.isSetUsers();
- if (this_present_users || that_present_users) {
- if (!(this_present_users && that_present_users))
- return false;
- if (!this.users.equals(that.users))
- 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_groups = true && (isSetGroups());
- list.add(present_groups);
- if (present_groups)
- list.add(groups);
-
- boolean present_roleSet = true && (isSetRoleSet());
- list.add(present_roleSet);
- if (present_roleSet)
- list.add(roleSet);
-
- boolean present_authorizableHierarchy = true && (isSetAuthorizableHierarchy());
- list.add(present_authorizableHierarchy);
- if (present_authorizableHierarchy)
- list.add(authorizableHierarchy);
-
- boolean present_users = true && (isSetUsers());
- list.add(present_users);
- if (present_users)
- list.add(users);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TListSentryPrivilegesForProviderRequest 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(isSetGroups()).compareTo(other.isSetGroups());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroups()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, other.groups);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleSet()).compareTo(other.isSetRoleSet());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleSet()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleSet, other.roleSet);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetAuthorizableHierarchy()).compareTo(other.isSetAuthorizableHierarchy());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAuthorizableHierarchy()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizableHierarchy, other.authorizableHierarchy);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetUsers()).compareTo(other.isSetUsers());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetUsers()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.users, other.users);
- 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("TListSentryPrivilegesForProviderRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("groups:");
- if (this.groups == null) {
- sb.append("null");
- } else {
- sb.append(this.groups);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleSet:");
- if (this.roleSet == null) {
- sb.append("null");
- } else {
- sb.append(this.roleSet);
- }
- first = false;
- if (isSetAuthorizableHierarchy()) {
- if (!first) sb.append(", ");
- sb.append("authorizableHierarchy:");
- if (this.authorizableHierarchy == null) {
- sb.append("null");
- } else {
- sb.append(this.authorizableHierarchy);
- }
- first = false;
- }
- if (isSetUsers()) {
- if (!first) sb.append(", ");
- sb.append("users:");
- if (this.users == null) {
- sb.append("null");
- } else {
- sb.append(this.users);
- }
- 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 (!isSetGroups()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'groups' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleSet()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleSet' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (roleSet != null) {
- roleSet.validate();
- }
- if (authorizableHierarchy != null) {
- authorizableHierarchy.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 TListSentryPrivilegesForProviderRequestStandardSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesForProviderRequestStandardScheme getScheme() {
- return new TListSentryPrivilegesForProviderRequestStandardScheme();
- }
- }
-
- private static class TListSentryPrivilegesForProviderRequestStandardScheme extends StandardScheme<TListSentryPrivilegesForProviderRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesForProviderRequest 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: // GROUPS
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set88 = iprot.readSetBegin();
- struct.groups = new HashSet<String>(2*_set88.size);
- String _elem89;
- for (int _i90 = 0; _i90 < _set88.size; ++_i90)
- {
- _elem89 = iprot.readString();
- struct.groups.add(_elem89);
- }
- iprot.readSetEnd();
- }
- struct.setGroupsIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_SET
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.roleSet = new TSentryActiveRoleSet();
- struct.roleSet.read(iprot);
- struct.setRoleSetIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // AUTHORIZABLE_HIERARCHY
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.authorizableHierarchy = new TSentryAuthorizable();
- struct.authorizableHierarchy.read(iprot);
- struct.setAuthorizableHierarchyIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // USERS
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set91 = iprot.readSetBegin();
- struct.users = new HashSet<String>(2*_set91.size);
- String _elem92;
- for (int _i93 = 0; _i93 < _set91.size; ++_i93)
- {
- _elem92 = iprot.readString();
- struct.users.add(_elem92);
- }
- iprot.readSetEnd();
- }
- struct.setUsersIsSet(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, TListSentryPrivilegesForProviderRequest 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();
- if (struct.groups != null) {
- oprot.writeFieldBegin(GROUPS_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.groups.size()));
- for (String _iter94 : struct.groups)
- {
- oprot.writeString(_iter94);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- if (struct.roleSet != null) {
- oprot.writeFieldBegin(ROLE_SET_FIELD_DESC);
- struct.roleSet.write(oprot);
- oprot.writeFieldEnd();
- }
- if (struct.authorizableHierarchy != null) {
- if (struct.isSetAuthorizableHierarchy()) {
- oprot.writeFieldBegin(AUTHORIZABLE_HIERARCHY_FIELD_DESC);
- struct.authorizableHierarchy.write(oprot);
- oprot.writeFieldEnd();
- }
- }
- if (struct.users != null) {
- if (struct.isSetUsers()) {
- oprot.writeFieldBegin(USERS_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.users.size()));
- for (String _iter95 : struct.users)
- {
- oprot.writeString(_iter95);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryPrivilegesForProviderRequestTupleSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesForProviderRequestTupleScheme getScheme() {
- return new TListSentryPrivilegesForProviderRequestTupleScheme();
- }
- }
-
- private static class TListSentryPrivilegesForProviderRequestTupleScheme extends TupleScheme<TListSentryPrivilegesForProviderRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- {
- oprot.writeI32(struct.groups.size());
- for (String _iter96 : struct.groups)
- {
- oprot.writeString(_iter96);
- }
- }
- struct.roleSet.write(oprot);
- BitSet optionals = new BitSet();
- if (struct.isSetAuthorizableHierarchy()) {
- optionals.set(0);
- }
- if (struct.isSetUsers()) {
- optionals.set(1);
- }
- oprot.writeBitSet(optionals, 2);
- if (struct.isSetAuthorizableHierarchy()) {
- struct.authorizableHierarchy.write(oprot);
- }
- if (struct.isSetUsers()) {
- {
- oprot.writeI32(struct.users.size());
- for (String _iter97 : struct.users)
- {
- oprot.writeString(_iter97);
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set98 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.groups = new HashSet<String>(2*_set98.size);
- String _elem99;
- for (int _i100 = 0; _i100 < _set98.size; ++_i100)
- {
- _elem99 = iprot.readString();
- struct.groups.add(_elem99);
- }
- }
- struct.setGroupsIsSet(true);
- struct.roleSet = new TSentryActiveRoleSet();
- struct.roleSet.read(iprot);
- struct.setRoleSetIsSet(true);
- BitSet incoming = iprot.readBitSet(2);
- if (incoming.get(0)) {
- struct.authorizableHierarchy = new TSentryAuthorizable();
- struct.authorizableHierarchy.read(iprot);
- struct.setAuthorizableHierarchyIsSet(true);
- }
- if (incoming.get(1)) {
- {
- org.apache.thrift.protocol.TSet _set101 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.users = new HashSet<String>(2*_set101.size);
- String _elem102;
- for (int _i103 = 0; _i103 < _set101.size; ++_i103)
- {
- _elem102 = iprot.readString();
- struct.users.add(_elem102);
- }
- }
- struct.setUsersIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderResponse.java
deleted file mode 100644
index 3c43e70..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderResponse.java
+++ /dev/null
@@ -1,544 +0,0 @@
-/**
- * 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.provider.db.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 TListSentryPrivilegesForProviderResponse implements org.apache.thrift.TBase<TListSentryPrivilegesForProviderResponse, TListSentryPrivilegesForProviderResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesForProviderResponse> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesForProviderResponse");
-
- 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 PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryPrivilegesForProviderResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryPrivilegesForProviderResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
- private Set<String> privileges; // 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"),
- PRIVILEGES((short)2, "privileges");
-
- 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: // PRIVILEGES
- return PRIVILEGES;
- 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.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.PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("privileges", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesForProviderResponse.class, metaDataMap);
- }
-
- public TListSentryPrivilegesForProviderResponse() {
- }
-
- public TListSentryPrivilegesForProviderResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status,
- Set<String> privileges)
- {
- this();
- this.status = status;
- this.privileges = privileges;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryPrivilegesForProviderResponse(TListSentryPrivilegesForProviderResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- if (other.isSetPrivileges()) {
- Set<String> __this__privileges = new HashSet<String>(other.privileges);
- this.privileges = __this__privileges;
- }
- }
-
- public TListSentryPrivilegesForProviderResponse deepCopy() {
- return new TListSentryPrivilegesForProviderResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- this.privileges = null;
- }
-
- 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 int getPrivilegesSize() {
- return (this.privileges == null) ? 0 : this.privileges.size();
- }
-
- public java.util.Iterator<String> getPrivilegesIterator() {
- return (this.privileges == null) ? null : this.privileges.iterator();
- }
-
- public void addToPrivileges(String elem) {
- if (this.privileges == null) {
- this.privileges = new HashSet<String>();
- }
- this.privileges.add(elem);
- }
-
- public Set<String> getPrivileges() {
- return this.privileges;
- }
-
- public void setPrivileges(Set<String> privileges) {
- this.privileges = privileges;
- }
-
- public void unsetPrivileges() {
- this.privileges = null;
- }
-
- /** Returns true if field privileges is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivileges() {
- return this.privileges != null;
- }
-
- public void setPrivilegesIsSet(boolean value) {
- if (!value) {
- this.privileges = null;
- }
- }
-
- 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 PRIVILEGES:
- if (value == null) {
- unsetPrivileges();
- } else {
- setPrivileges((Set<String>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- case PRIVILEGES:
- return getPrivileges();
-
- }
- 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 PRIVILEGES:
- return isSetPrivileges();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryPrivilegesForProviderResponse)
- return this.equals((TListSentryPrivilegesForProviderResponse)that);
- return false;
- }
-
- public boolean equals(TListSentryPrivilegesForProviderResponse 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_privileges = true && this.isSetPrivileges();
- boolean that_present_privileges = true && that.isSetPrivileges();
- if (this_present_privileges || that_present_privileges) {
- if (!(this_present_privileges && that_present_privileges))
- return false;
- if (!this.privileges.equals(that.privileges))
- 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_privileges = true && (isSetPrivileges());
- list.add(present_privileges);
- if (present_privileges)
- list.add(privileges);
-
- return list.hashCode();
- }
-
- @Override
- public int compareTo(TListSentryPrivilegesForProviderResponse 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(isSetPrivileges()).compareTo(other.isSetPrivileges());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivileges()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, other.privileges);
- 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("TListSentryPrivilegesForProviderResponse(");
- 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("privileges:");
- if (this.privileges == null) {
- sb.append("null");
- } else {
- sb.append(this.privileges);
- }
- 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 (!isSetPrivileges()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'privileges' 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 {
- 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 TListSentryPrivilegesForProviderResponseStandardSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesForProviderResponseStandardScheme getScheme() {
- return new TListSentryPrivilegesForProviderResponseStandardScheme();
- }
- }
-
- private static class TListSentryPrivilegesForProviderResponseStandardScheme extends StandardScheme<TListSentryPrivilegesForProviderResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesForProviderResponse 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: // PRIVILEGES
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set104 = iprot.readSetBegin();
- struct.privileges = new HashSet<String>(2*_set104.size);
- String _elem105;
- for (int _i106 = 0; _i106 < _set104.size; ++_i106)
- {
- _elem105 = iprot.readString();
- struct.privileges.add(_elem105);
- }
- iprot.readSetEnd();
- }
- struct.setPrivilegesIsSet(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, TListSentryPrivilegesForProviderResponse 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();
- }
- if (struct.privileges != null) {
- oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.privileges.size()));
- for (String _iter107 : struct.privileges)
- {
- oprot.writeString(_iter107);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryPrivilegesForProviderResponseTupleSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesForProviderResponseTupleScheme getScheme() {
- return new TListSentryPrivilegesForProviderResponseTupleScheme();
- }
- }
-
- private static class TListSentryPrivilegesForProviderResponseTupleScheme extends TupleScheme<TListSentryPrivilegesForProviderResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- {
- oprot.writeI32(struct.privileges.size());
- for (String _iter108 : struct.privileges)
- {
- oprot.writeString(_iter108);
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderResponse 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);
- {
- org.apache.thrift.protocol.TSet _set109 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.privileges = new HashSet<String>(2*_set109.size);
- String _elem110;
- for (int _i111 = 0; _i111 < _set109.size; ++_i111)
- {
- _elem110 = iprot.readString();
- struct.privileges.add(_elem110);
- }
- }
- struct.setPrivilegesIsSet(true);
- }
- }
-
-}
-
[02/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryRolesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryRolesResponse.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryRolesResponse.java
new file mode 100644
index 0000000..020a0d8
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TListSentryRolesResponse.java
@@ -0,0 +1,555 @@
+/**
+ * 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.generic.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 TListSentryRolesResponse implements org.apache.thrift.TBase<TListSentryRolesResponse, TListSentryRolesResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryRolesResponse> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryRolesResponse");
+
+ 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 ROLES_FIELD_DESC = new org.apache.thrift.protocol.TField("roles", org.apache.thrift.protocol.TType.SET, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TListSentryRolesResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TListSentryRolesResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
+ private Set<TSentryRole> roles; // optional
+
+ /** 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"),
+ ROLES((short)2, "roles");
+
+ 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: // ROLES
+ return ROLES;
+ 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 _Fields optionals[] = {_Fields.ROLES};
+ 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.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
+ tmpMap.put(_Fields.ROLES, new org.apache.thrift.meta_data.FieldMetaData("roles", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryRole.class))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryRolesResponse.class, metaDataMap);
+ }
+
+ public TListSentryRolesResponse() {
+ }
+
+ public TListSentryRolesResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TListSentryRolesResponse(TListSentryRolesResponse other) {
+ if (other.isSetStatus()) {
+ this.status = other.status;
+ }
+ if (other.isSetRoles()) {
+ Set<TSentryRole> __this__roles = new HashSet<TSentryRole>(other.roles.size());
+ for (TSentryRole other_element : other.roles) {
+ __this__roles.add(new TSentryRole(other_element));
+ }
+ this.roles = __this__roles;
+ }
+ }
+
+ public TListSentryRolesResponse deepCopy() {
+ return new TListSentryRolesResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ this.roles = null;
+ }
+
+ 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 int getRolesSize() {
+ return (this.roles == null) ? 0 : this.roles.size();
+ }
+
+ public java.util.Iterator<TSentryRole> getRolesIterator() {
+ return (this.roles == null) ? null : this.roles.iterator();
+ }
+
+ public void addToRoles(TSentryRole elem) {
+ if (this.roles == null) {
+ this.roles = new HashSet<TSentryRole>();
+ }
+ this.roles.add(elem);
+ }
+
+ public Set<TSentryRole> getRoles() {
+ return this.roles;
+ }
+
+ public void setRoles(Set<TSentryRole> roles) {
+ this.roles = roles;
+ }
+
+ public void unsetRoles() {
+ this.roles = null;
+ }
+
+ /** Returns true if field roles is set (has been assigned a value) and false otherwise */
+ public boolean isSetRoles() {
+ return this.roles != null;
+ }
+
+ public void setRolesIsSet(boolean value) {
+ if (!value) {
+ this.roles = null;
+ }
+ }
+
+ 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 ROLES:
+ if (value == null) {
+ unsetRoles();
+ } else {
+ setRoles((Set<TSentryRole>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ case ROLES:
+ return getRoles();
+
+ }
+ 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 ROLES:
+ return isSetRoles();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TListSentryRolesResponse)
+ return this.equals((TListSentryRolesResponse)that);
+ return false;
+ }
+
+ public boolean equals(TListSentryRolesResponse 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_roles = true && this.isSetRoles();
+ boolean that_present_roles = true && that.isSetRoles();
+ if (this_present_roles || that_present_roles) {
+ if (!(this_present_roles && that_present_roles))
+ return false;
+ if (!this.roles.equals(that.roles))
+ 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_roles = true && (isSetRoles());
+ list.add(present_roles);
+ if (present_roles)
+ list.add(roles);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TListSentryRolesResponse 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(isSetRoles()).compareTo(other.isSetRoles());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoles()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roles, other.roles);
+ 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("TListSentryRolesResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ first = false;
+ if (isSetRoles()) {
+ if (!first) sb.append(", ");
+ sb.append("roles:");
+ if (this.roles == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roles);
+ }
+ 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());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TListSentryRolesResponseStandardSchemeFactory implements SchemeFactory {
+ public TListSentryRolesResponseStandardScheme getScheme() {
+ return new TListSentryRolesResponseStandardScheme();
+ }
+ }
+
+ private static class TListSentryRolesResponseStandardScheme extends StandardScheme<TListSentryRolesResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryRolesResponse 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: // ROLES
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set32 = iprot.readSetBegin();
+ struct.roles = new HashSet<TSentryRole>(2*_set32.size);
+ TSentryRole _elem33;
+ for (int _i34 = 0; _i34 < _set32.size; ++_i34)
+ {
+ _elem33 = new TSentryRole();
+ _elem33.read(iprot);
+ struct.roles.add(_elem33);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setRolesIsSet(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, TListSentryRolesResponse 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();
+ }
+ if (struct.roles != null) {
+ if (struct.isSetRoles()) {
+ oprot.writeFieldBegin(ROLES_FIELD_DESC);
+ {
+ oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.roles.size()));
+ for (TSentryRole _iter35 : struct.roles)
+ {
+ _iter35.write(oprot);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TListSentryRolesResponseTupleSchemeFactory implements SchemeFactory {
+ public TListSentryRolesResponseTupleScheme getScheme() {
+ return new TListSentryRolesResponseTupleScheme();
+ }
+ }
+
+ private static class TListSentryRolesResponseTupleScheme extends TupleScheme<TListSentryRolesResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ struct.status.write(oprot);
+ BitSet optionals = new BitSet();
+ if (struct.isSetRoles()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetRoles()) {
+ {
+ oprot.writeI32(struct.roles.size());
+ for (TSentryRole _iter36 : struct.roles)
+ {
+ _iter36.write(oprot);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesResponse 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);
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TSet _set37 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.roles = new HashSet<TSentryRole>(2*_set37.size);
+ TSentryRole _elem38;
+ for (int _i39 = 0; _i39 < _set37.size; ++_i39)
+ {
+ _elem38 = new TSentryRole();
+ _elem38.read(iprot);
+ struct.roles.add(_elem38);
+ }
+ }
+ struct.setRolesIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TRenamePrivilegesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TRenamePrivilegesRequest.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TRenamePrivilegesRequest.java
new file mode 100644
index 0000000..e3f6312
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TRenamePrivilegesRequest.java
@@ -0,0 +1,1002 @@
+/**
+ * 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.generic.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 TRenamePrivilegesRequest implements org.apache.thrift.TBase<TRenamePrivilegesRequest, TRenamePrivilegesRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TRenamePrivilegesRequest> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRenamePrivilegesRequest");
+
+ 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 REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField COMPONENT_FIELD_DESC = new org.apache.thrift.protocol.TField("component", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField SERVICE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("serviceName", org.apache.thrift.protocol.TType.STRING, (short)4);
+ private static final org.apache.thrift.protocol.TField OLD_AUTHORIZABLES_FIELD_DESC = new org.apache.thrift.protocol.TField("oldAuthorizables", org.apache.thrift.protocol.TType.LIST, (short)5);
+ private static final org.apache.thrift.protocol.TField NEW_AUTHORIZABLES_FIELD_DESC = new org.apache.thrift.protocol.TField("newAuthorizables", org.apache.thrift.protocol.TType.LIST, (short)6);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TRenamePrivilegesRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TRenamePrivilegesRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String component; // required
+ private String serviceName; // required
+ private List<TAuthorizable> oldAuthorizables; // required
+ private List<TAuthorizable> newAuthorizables; // 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"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ COMPONENT((short)3, "component"),
+ SERVICE_NAME((short)4, "serviceName"),
+ OLD_AUTHORIZABLES((short)5, "oldAuthorizables"),
+ NEW_AUTHORIZABLES((short)6, "newAuthorizables");
+
+ 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: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // COMPONENT
+ return COMPONENT;
+ case 4: // SERVICE_NAME
+ return SERVICE_NAME;
+ case 5: // OLD_AUTHORIZABLES
+ return OLD_AUTHORIZABLES;
+ case 6: // NEW_AUTHORIZABLES
+ return NEW_AUTHORIZABLES;
+ 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 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.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.COMPONENT, new org.apache.thrift.meta_data.FieldMetaData("component", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.SERVICE_NAME, new org.apache.thrift.meta_data.FieldMetaData("serviceName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.OLD_AUTHORIZABLES, new org.apache.thrift.meta_data.FieldMetaData("oldAuthorizables", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAuthorizable.class))));
+ tmpMap.put(_Fields.NEW_AUTHORIZABLES, new org.apache.thrift.meta_data.FieldMetaData("newAuthorizables", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAuthorizable.class))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TRenamePrivilegesRequest.class, metaDataMap);
+ }
+
+ public TRenamePrivilegesRequest() {
+ this.protocol_version = 2;
+
+ }
+
+ public TRenamePrivilegesRequest(
+ int protocol_version,
+ String requestorUserName,
+ String component,
+ String serviceName,
+ List<TAuthorizable> oldAuthorizables,
+ List<TAuthorizable> newAuthorizables)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.component = component;
+ this.serviceName = serviceName;
+ this.oldAuthorizables = oldAuthorizables;
+ this.newAuthorizables = newAuthorizables;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TRenamePrivilegesRequest(TRenamePrivilegesRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetComponent()) {
+ this.component = other.component;
+ }
+ if (other.isSetServiceName()) {
+ this.serviceName = other.serviceName;
+ }
+ if (other.isSetOldAuthorizables()) {
+ List<TAuthorizable> __this__oldAuthorizables = new ArrayList<TAuthorizable>(other.oldAuthorizables.size());
+ for (TAuthorizable other_element : other.oldAuthorizables) {
+ __this__oldAuthorizables.add(new TAuthorizable(other_element));
+ }
+ this.oldAuthorizables = __this__oldAuthorizables;
+ }
+ if (other.isSetNewAuthorizables()) {
+ List<TAuthorizable> __this__newAuthorizables = new ArrayList<TAuthorizable>(other.newAuthorizables.size());
+ for (TAuthorizable other_element : other.newAuthorizables) {
+ __this__newAuthorizables.add(new TAuthorizable(other_element));
+ }
+ this.newAuthorizables = __this__newAuthorizables;
+ }
+ }
+
+ public TRenamePrivilegesRequest deepCopy() {
+ return new TRenamePrivilegesRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 2;
+
+ this.requestorUserName = null;
+ this.component = null;
+ this.serviceName = null;
+ this.oldAuthorizables = null;
+ this.newAuthorizables = 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 String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public String getComponent() {
+ return this.component;
+ }
+
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ public void unsetComponent() {
+ this.component = null;
+ }
+
+ /** Returns true if field component is set (has been assigned a value) and false otherwise */
+ public boolean isSetComponent() {
+ return this.component != null;
+ }
+
+ public void setComponentIsSet(boolean value) {
+ if (!value) {
+ this.component = null;
+ }
+ }
+
+ public String getServiceName() {
+ return this.serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public void unsetServiceName() {
+ this.serviceName = null;
+ }
+
+ /** Returns true if field serviceName is set (has been assigned a value) and false otherwise */
+ public boolean isSetServiceName() {
+ return this.serviceName != null;
+ }
+
+ public void setServiceNameIsSet(boolean value) {
+ if (!value) {
+ this.serviceName = null;
+ }
+ }
+
+ public int getOldAuthorizablesSize() {
+ return (this.oldAuthorizables == null) ? 0 : this.oldAuthorizables.size();
+ }
+
+ public java.util.Iterator<TAuthorizable> getOldAuthorizablesIterator() {
+ return (this.oldAuthorizables == null) ? null : this.oldAuthorizables.iterator();
+ }
+
+ public void addToOldAuthorizables(TAuthorizable elem) {
+ if (this.oldAuthorizables == null) {
+ this.oldAuthorizables = new ArrayList<TAuthorizable>();
+ }
+ this.oldAuthorizables.add(elem);
+ }
+
+ public List<TAuthorizable> getOldAuthorizables() {
+ return this.oldAuthorizables;
+ }
+
+ public void setOldAuthorizables(List<TAuthorizable> oldAuthorizables) {
+ this.oldAuthorizables = oldAuthorizables;
+ }
+
+ public void unsetOldAuthorizables() {
+ this.oldAuthorizables = null;
+ }
+
+ /** Returns true if field oldAuthorizables is set (has been assigned a value) and false otherwise */
+ public boolean isSetOldAuthorizables() {
+ return this.oldAuthorizables != null;
+ }
+
+ public void setOldAuthorizablesIsSet(boolean value) {
+ if (!value) {
+ this.oldAuthorizables = null;
+ }
+ }
+
+ public int getNewAuthorizablesSize() {
+ return (this.newAuthorizables == null) ? 0 : this.newAuthorizables.size();
+ }
+
+ public java.util.Iterator<TAuthorizable> getNewAuthorizablesIterator() {
+ return (this.newAuthorizables == null) ? null : this.newAuthorizables.iterator();
+ }
+
+ public void addToNewAuthorizables(TAuthorizable elem) {
+ if (this.newAuthorizables == null) {
+ this.newAuthorizables = new ArrayList<TAuthorizable>();
+ }
+ this.newAuthorizables.add(elem);
+ }
+
+ public List<TAuthorizable> getNewAuthorizables() {
+ return this.newAuthorizables;
+ }
+
+ public void setNewAuthorizables(List<TAuthorizable> newAuthorizables) {
+ this.newAuthorizables = newAuthorizables;
+ }
+
+ public void unsetNewAuthorizables() {
+ this.newAuthorizables = null;
+ }
+
+ /** Returns true if field newAuthorizables is set (has been assigned a value) and false otherwise */
+ public boolean isSetNewAuthorizables() {
+ return this.newAuthorizables != null;
+ }
+
+ public void setNewAuthorizablesIsSet(boolean value) {
+ if (!value) {
+ this.newAuthorizables = 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 REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case COMPONENT:
+ if (value == null) {
+ unsetComponent();
+ } else {
+ setComponent((String)value);
+ }
+ break;
+
+ case SERVICE_NAME:
+ if (value == null) {
+ unsetServiceName();
+ } else {
+ setServiceName((String)value);
+ }
+ break;
+
+ case OLD_AUTHORIZABLES:
+ if (value == null) {
+ unsetOldAuthorizables();
+ } else {
+ setOldAuthorizables((List<TAuthorizable>)value);
+ }
+ break;
+
+ case NEW_AUTHORIZABLES:
+ if (value == null) {
+ unsetNewAuthorizables();
+ } else {
+ setNewAuthorizables((List<TAuthorizable>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return getProtocol_version();
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case COMPONENT:
+ return getComponent();
+
+ case SERVICE_NAME:
+ return getServiceName();
+
+ case OLD_AUTHORIZABLES:
+ return getOldAuthorizables();
+
+ case NEW_AUTHORIZABLES:
+ return getNewAuthorizables();
+
+ }
+ 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 REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case COMPONENT:
+ return isSetComponent();
+ case SERVICE_NAME:
+ return isSetServiceName();
+ case OLD_AUTHORIZABLES:
+ return isSetOldAuthorizables();
+ case NEW_AUTHORIZABLES:
+ return isSetNewAuthorizables();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TRenamePrivilegesRequest)
+ return this.equals((TRenamePrivilegesRequest)that);
+ return false;
+ }
+
+ public boolean equals(TRenamePrivilegesRequest 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_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_component = true && this.isSetComponent();
+ boolean that_present_component = true && that.isSetComponent();
+ if (this_present_component || that_present_component) {
+ if (!(this_present_component && that_present_component))
+ return false;
+ if (!this.component.equals(that.component))
+ return false;
+ }
+
+ boolean this_present_serviceName = true && this.isSetServiceName();
+ boolean that_present_serviceName = true && that.isSetServiceName();
+ if (this_present_serviceName || that_present_serviceName) {
+ if (!(this_present_serviceName && that_present_serviceName))
+ return false;
+ if (!this.serviceName.equals(that.serviceName))
+ return false;
+ }
+
+ boolean this_present_oldAuthorizables = true && this.isSetOldAuthorizables();
+ boolean that_present_oldAuthorizables = true && that.isSetOldAuthorizables();
+ if (this_present_oldAuthorizables || that_present_oldAuthorizables) {
+ if (!(this_present_oldAuthorizables && that_present_oldAuthorizables))
+ return false;
+ if (!this.oldAuthorizables.equals(that.oldAuthorizables))
+ return false;
+ }
+
+ boolean this_present_newAuthorizables = true && this.isSetNewAuthorizables();
+ boolean that_present_newAuthorizables = true && that.isSetNewAuthorizables();
+ if (this_present_newAuthorizables || that_present_newAuthorizables) {
+ if (!(this_present_newAuthorizables && that_present_newAuthorizables))
+ return false;
+ if (!this.newAuthorizables.equals(that.newAuthorizables))
+ 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_requestorUserName = true && (isSetRequestorUserName());
+ list.add(present_requestorUserName);
+ if (present_requestorUserName)
+ list.add(requestorUserName);
+
+ boolean present_component = true && (isSetComponent());
+ list.add(present_component);
+ if (present_component)
+ list.add(component);
+
+ boolean present_serviceName = true && (isSetServiceName());
+ list.add(present_serviceName);
+ if (present_serviceName)
+ list.add(serviceName);
+
+ boolean present_oldAuthorizables = true && (isSetOldAuthorizables());
+ list.add(present_oldAuthorizables);
+ if (present_oldAuthorizables)
+ list.add(oldAuthorizables);
+
+ boolean present_newAuthorizables = true && (isSetNewAuthorizables());
+ list.add(present_newAuthorizables);
+ if (present_newAuthorizables)
+ list.add(newAuthorizables);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TRenamePrivilegesRequest 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(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetComponent()).compareTo(other.isSetComponent());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetComponent()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.component, other.component);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetServiceName()).compareTo(other.isSetServiceName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetServiceName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serviceName, other.serviceName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetOldAuthorizables()).compareTo(other.isSetOldAuthorizables());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetOldAuthorizables()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.oldAuthorizables, other.oldAuthorizables);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetNewAuthorizables()).compareTo(other.isSetNewAuthorizables());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetNewAuthorizables()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.newAuthorizables, other.newAuthorizables);
+ 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("TRenamePrivilegesRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("component:");
+ if (this.component == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.component);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("serviceName:");
+ if (this.serviceName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.serviceName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("oldAuthorizables:");
+ if (this.oldAuthorizables == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.oldAuthorizables);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("newAuthorizables:");
+ if (this.newAuthorizables == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.newAuthorizables);
+ }
+ 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 (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetComponent()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'component' is unset! Struct:" + toString());
+ }
+
+ if (!isSetServiceName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'serviceName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetOldAuthorizables()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'oldAuthorizables' is unset! Struct:" + toString());
+ }
+
+ if (!isSetNewAuthorizables()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'newAuthorizables' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TRenamePrivilegesRequestStandardSchemeFactory implements SchemeFactory {
+ public TRenamePrivilegesRequestStandardScheme getScheme() {
+ return new TRenamePrivilegesRequestStandardScheme();
+ }
+ }
+
+ private static class TRenamePrivilegesRequestStandardScheme extends StandardScheme<TRenamePrivilegesRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TRenamePrivilegesRequest 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: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // COMPONENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // SERVICE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.serviceName = iprot.readString();
+ struct.setServiceNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 5: // OLD_AUTHORIZABLES
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list56 = iprot.readListBegin();
+ struct.oldAuthorizables = new ArrayList<TAuthorizable>(_list56.size);
+ TAuthorizable _elem57;
+ for (int _i58 = 0; _i58 < _list56.size; ++_i58)
+ {
+ _elem57 = new TAuthorizable();
+ _elem57.read(iprot);
+ struct.oldAuthorizables.add(_elem57);
+ }
+ iprot.readListEnd();
+ }
+ struct.setOldAuthorizablesIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 6: // NEW_AUTHORIZABLES
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list59 = iprot.readListBegin();
+ struct.newAuthorizables = new ArrayList<TAuthorizable>(_list59.size);
+ TAuthorizable _elem60;
+ for (int _i61 = 0; _i61 < _list59.size; ++_i61)
+ {
+ _elem60 = new TAuthorizable();
+ _elem60.read(iprot);
+ struct.newAuthorizables.add(_elem60);
+ }
+ iprot.readListEnd();
+ }
+ struct.setNewAuthorizablesIsSet(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, TRenamePrivilegesRequest 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();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.component != null) {
+ oprot.writeFieldBegin(COMPONENT_FIELD_DESC);
+ oprot.writeString(struct.component);
+ oprot.writeFieldEnd();
+ }
+ if (struct.serviceName != null) {
+ oprot.writeFieldBegin(SERVICE_NAME_FIELD_DESC);
+ oprot.writeString(struct.serviceName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.oldAuthorizables != null) {
+ oprot.writeFieldBegin(OLD_AUTHORIZABLES_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.oldAuthorizables.size()));
+ for (TAuthorizable _iter62 : struct.oldAuthorizables)
+ {
+ _iter62.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.newAuthorizables != null) {
+ oprot.writeFieldBegin(NEW_AUTHORIZABLES_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.newAuthorizables.size()));
+ for (TAuthorizable _iter63 : struct.newAuthorizables)
+ {
+ _iter63.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TRenamePrivilegesRequestTupleSchemeFactory implements SchemeFactory {
+ public TRenamePrivilegesRequestTupleScheme getScheme() {
+ return new TRenamePrivilegesRequestTupleScheme();
+ }
+ }
+
+ private static class TRenamePrivilegesRequestTupleScheme extends TupleScheme<TRenamePrivilegesRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeString(struct.component);
+ oprot.writeString(struct.serviceName);
+ {
+ oprot.writeI32(struct.oldAuthorizables.size());
+ for (TAuthorizable _iter64 : struct.oldAuthorizables)
+ {
+ _iter64.write(oprot);
+ }
+ }
+ {
+ oprot.writeI32(struct.newAuthorizables.size());
+ for (TAuthorizable _iter65 : struct.newAuthorizables)
+ {
+ _iter65.write(oprot);
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.component = iprot.readString();
+ struct.setComponentIsSet(true);
+ struct.serviceName = iprot.readString();
+ struct.setServiceNameIsSet(true);
+ {
+ org.apache.thrift.protocol.TList _list66 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.oldAuthorizables = new ArrayList<TAuthorizable>(_list66.size);
+ TAuthorizable _elem67;
+ for (int _i68 = 0; _i68 < _list66.size; ++_i68)
+ {
+ _elem67 = new TAuthorizable();
+ _elem67.read(iprot);
+ struct.oldAuthorizables.add(_elem67);
+ }
+ }
+ struct.setOldAuthorizablesIsSet(true);
+ {
+ org.apache.thrift.protocol.TList _list69 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.newAuthorizables = new ArrayList<TAuthorizable>(_list69.size);
+ TAuthorizable _elem70;
+ for (int _i71 = 0; _i71 < _list69.size; ++_i71)
+ {
+ _elem70 = new TAuthorizable();
+ _elem70.read(iprot);
+ struct.newAuthorizables.add(_elem70);
+ }
+ }
+ struct.setNewAuthorizablesIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TRenamePrivilegesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TRenamePrivilegesResponse.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TRenamePrivilegesResponse.java
new file mode 100644
index 0000000..dc2f21f
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TRenamePrivilegesResponse.java
@@ -0,0 +1,391 @@
+/**
+ * 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.generic.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 TRenamePrivilegesResponse implements org.apache.thrift.TBase<TRenamePrivilegesResponse, TRenamePrivilegesResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TRenamePrivilegesResponse> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRenamePrivilegesResponse");
+
+ 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TRenamePrivilegesResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TRenamePrivilegesResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // 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");
+
+ 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;
+ 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TRenamePrivilegesResponse.class, metaDataMap);
+ }
+
+ public TRenamePrivilegesResponse() {
+ }
+
+ public TRenamePrivilegesResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TRenamePrivilegesResponse(TRenamePrivilegesResponse other) {
+ if (other.isSetStatus()) {
+ this.status = other.status;
+ }
+ }
+
+ public TRenamePrivilegesResponse deepCopy() {
+ return new TRenamePrivilegesResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ }
+
+ 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 void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ }
+ 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();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TRenamePrivilegesResponse)
+ return this.equals((TRenamePrivilegesResponse)that);
+ return false;
+ }
+
+ public boolean equals(TRenamePrivilegesResponse 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;
+ }
+
+ 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);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TRenamePrivilegesResponse 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;
+ }
+ }
+ 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("TRenamePrivilegesResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ 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());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TRenamePrivilegesResponseStandardSchemeFactory implements SchemeFactory {
+ public TRenamePrivilegesResponseStandardScheme getScheme() {
+ return new TRenamePrivilegesResponseStandardScheme();
+ }
+ }
+
+ private static class TRenamePrivilegesResponseStandardScheme extends StandardScheme<TRenamePrivilegesResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TRenamePrivilegesResponse 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;
+ 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, TRenamePrivilegesResponse 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.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TRenamePrivilegesResponseTupleSchemeFactory implements SchemeFactory {
+ public TRenamePrivilegesResponseTupleScheme getScheme() {
+ return new TRenamePrivilegesResponseTupleScheme();
+ }
+ }
+
+ private static class TRenamePrivilegesResponseTupleScheme extends TupleScheme<TRenamePrivilegesResponse> {
+
+ @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 read(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesResponse 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);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TSentryActiveRoleSet.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TSentryActiveRoleSet.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TSentryActiveRoleSet.java
new file mode 100644
index 0000000..7c2a6a9
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TSentryActiveRoleSet.java
@@ -0,0 +1,537 @@
+/**
+ * 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.generic.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 TSentryActiveRoleSet implements org.apache.thrift.TBase<TSentryActiveRoleSet, TSentryActiveRoleSet._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryActiveRoleSet> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryActiveRoleSet");
+
+ private static final org.apache.thrift.protocol.TField ALL_FIELD_DESC = new org.apache.thrift.protocol.TField("all", org.apache.thrift.protocol.TType.BOOL, (short)1);
+ private static final org.apache.thrift.protocol.TField ROLES_FIELD_DESC = new org.apache.thrift.protocol.TField("roles", org.apache.thrift.protocol.TType.SET, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TSentryActiveRoleSetStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TSentryActiveRoleSetTupleSchemeFactory());
+ }
+
+ private boolean all; // required
+ private Set<String> roles; // 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 {
+ ALL((short)1, "all"),
+ ROLES((short)2, "roles");
+
+ 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: // ALL
+ return ALL;
+ case 2: // ROLES
+ return ROLES;
+ 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 __ALL_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.ALL, new org.apache.thrift.meta_data.FieldMetaData("all", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ tmpMap.put(_Fields.ROLES, new org.apache.thrift.meta_data.FieldMetaData("roles", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryActiveRoleSet.class, metaDataMap);
+ }
+
+ public TSentryActiveRoleSet() {
+ }
+
+ public TSentryActiveRoleSet(
+ boolean all,
+ Set<String> roles)
+ {
+ this();
+ this.all = all;
+ setAllIsSet(true);
+ this.roles = roles;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TSentryActiveRoleSet(TSentryActiveRoleSet other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.all = other.all;
+ if (other.isSetRoles()) {
+ Set<String> __this__roles = new HashSet<String>(other.roles);
+ this.roles = __this__roles;
+ }
+ }
+
+ public TSentryActiveRoleSet deepCopy() {
+ return new TSentryActiveRoleSet(this);
+ }
+
+ @Override
+ public void clear() {
+ setAllIsSet(false);
+ this.all = false;
+ this.roles = null;
+ }
+
+ public boolean isAll() {
+ return this.all;
+ }
+
+ public void setAll(boolean all) {
+ this.all = all;
+ setAllIsSet(true);
+ }
+
+ public void unsetAll() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ALL_ISSET_ID);
+ }
+
+ /** Returns true if field all is set (has been assigned a value) and false otherwise */
+ public boolean isSetAll() {
+ return EncodingUtils.testBit(__isset_bitfield, __ALL_ISSET_ID);
+ }
+
+ public void setAllIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ALL_ISSET_ID, value);
+ }
+
+ public int getRolesSize() {
+ return (this.roles == null) ? 0 : this.roles.size();
+ }
+
+ public java.util.Iterator<String> getRolesIterator() {
+ return (this.roles == null) ? null : this.roles.iterator();
+ }
+
+ public void addToRoles(String elem) {
+ if (this.roles == null) {
+ this.roles = new HashSet<String>();
+ }
+ this.roles.add(elem);
+ }
+
+ public Set<String> getRoles() {
+ return this.roles;
+ }
+
+ public void setRoles(Set<String> roles) {
+ this.roles = roles;
+ }
+
+ public void unsetRoles() {
+ this.roles = null;
+ }
+
+ /** Returns true if field roles is set (has been assigned a value) and false otherwise */
+ public boolean isSetRoles() {
+ return this.roles != null;
+ }
+
+ public void setRolesIsSet(boolean value) {
+ if (!value) {
+ this.roles = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case ALL:
+ if (value == null) {
+ unsetAll();
+ } else {
+ setAll((Boolean)value);
+ }
+ break;
+
+ case ROLES:
+ if (value == null) {
+ unsetRoles();
+ } else {
+ setRoles((Set<String>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case ALL:
+ return isAll();
+
+ case ROLES:
+ return getRoles();
+
+ }
+ 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 ALL:
+ return isSetAll();
+ case ROLES:
+ return isSetRoles();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TSentryActiveRoleSet)
+ return this.equals((TSentryActiveRoleSet)that);
+ return false;
+ }
+
+ public boolean equals(TSentryActiveRoleSet that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_all = true;
+ boolean that_present_all = true;
+ if (this_present_all || that_present_all) {
+ if (!(this_present_all && that_present_all))
+ return false;
+ if (this.all != that.all)
+ return false;
+ }
+
+ boolean this_present_roles = true && this.isSetRoles();
+ boolean that_present_roles = true && that.isSetRoles();
+ if (this_present_roles || that_present_roles) {
+ if (!(this_present_roles && that_present_roles))
+ return false;
+ if (!this.roles.equals(that.roles))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ List<Object> list = new ArrayList<Object>();
+
+ boolean present_all = true;
+ list.add(present_all);
+ if (present_all)
+ list.add(all);
+
+ boolean present_roles = true && (isSetRoles());
+ list.add(present_roles);
+ if (present_roles)
+ list.add(roles);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(TSentryActiveRoleSet other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetAll()).compareTo(other.isSetAll());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAll()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.all, other.all);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoles()).compareTo(other.isSetRoles());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoles()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roles, other.roles);
+ 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("TSentryActiveRoleSet(");
+ boolean first = true;
+
+ sb.append("all:");
+ sb.append(this.all);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("roles:");
+ if (this.roles == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roles);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetAll()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'all' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRoles()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'roles' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ }
+
+ 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 TSentryActiveRoleSetStandardSchemeFactory implements SchemeFactory {
+ public TSentryActiveRoleSetStandardScheme getScheme() {
+ return new TSentryActiveRoleSetStandardScheme();
+ }
+ }
+
+ private static class TSentryActiveRoleSetStandardScheme extends StandardScheme<TSentryActiveRoleSet> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryActiveRoleSet 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: // ALL
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.all = iprot.readBool();
+ struct.setAllIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // ROLES
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set72 = iprot.readSetBegin();
+ struct.roles = new HashSet<String>(2*_set72.size);
+ String _elem73;
+ for (int _i74 = 0; _i74 < _set72.size; ++_i74)
+ {
+ _elem73 = iprot.readString();
+ struct.roles.add(_elem73);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setRolesIsSet(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, TSentryActiveRoleSet struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(ALL_FIELD_DESC);
+ oprot.writeBool(struct.all);
+ oprot.writeFieldEnd();
+ if (struct.roles != null) {
+ oprot.writeFieldBegin(ROLES_FIELD_DESC);
+ {
+ oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.roles.size()));
+ for (String _iter75 : struct.roles)
+ {
+ oprot.writeString(_iter75);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TSentryActiveRoleSetTupleSchemeFactory implements SchemeFactory {
+ public TSentryActiveRoleSetTupleScheme getScheme() {
+ return new TSentryActiveRoleSetTupleScheme();
+ }
+ }
+
+ private static class TSentryActiveRoleSetTupleScheme extends TupleScheme<TSentryActiveRoleSet> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TSentryActiveRoleSet struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeBool(struct.all);
+ {
+ oprot.writeI32(struct.roles.size());
+ for (String _iter76 : struct.roles)
+ {
+ oprot.writeString(_iter76);
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TSentryActiveRoleSet struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.all = iprot.readBool();
+ struct.setAllIsSet(true);
+ {
+ org.apache.thrift.protocol.TSet _set77 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.roles = new HashSet<String>(2*_set77.size);
+ String _elem78;
+ for (int _i79 = 0; _i79 < _set77.size; ++_i79)
+ {
+ _elem78 = iprot.readString();
+ struct.roles.add(_elem78);
+ }
+ }
+ struct.setRolesIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TSentryGrantOption.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TSentryGrantOption.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TSentryGrantOption.java
new file mode 100644
index 0000000..e44b39b
--- /dev/null
+++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/generic/thrift/TSentryGrantOption.java
@@ -0,0 +1,48 @@
+/**
+ * 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.generic.thrift;
+
+
+import java.util.Map;
+import java.util.HashMap;
+import org.apache.thrift.TEnum;
+
+public enum TSentryGrantOption implements org.apache.thrift.TEnum {
+ TRUE(1),
+ FALSE(0),
+ UNSET(-1);
+
+ private final int value;
+
+ private TSentryGrantOption(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 TSentryGrantOption findByValue(int value) {
+ switch (value) {
+ case 1:
+ return TRUE;
+ case 0:
+ return FALSE;
+ case -1:
+ return UNSET;
+ default:
+ return null;
+ }
+ }
+}
[11/51] [partial] sentry git commit: SENTRY-2206: Refactor out sentry
api from sentry-provider-db to own module (Steve Moist,
reviewed by Sergio Pena)
Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/sentry/blob/af8ea0ac/sentry-service/sentry-service-api/pom.xml
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-api/pom.xml b/sentry-service/sentry-service-api/pom.xml
new file mode 100644
index 0000000..ba7a7ce
--- /dev/null
+++ b/sentry-service/sentry-service-api/pom.xml
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>sentry-service</artifactId>
+ <groupId>org.apache.sentry</groupId>
+ <version>2.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>sentry-service-api</artifactId>
+ <name>Sentry Service API</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-common</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-core-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-core-model-db</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-binding-hive-conf</artifactId>
+ <version>2.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-provider-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-core-model-kafka</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-core-model-solr</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-core-model-sqoop</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-core-model-indexer</artifactId>
+ </dependency>
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/gen/thrift/gen-javabean</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <sourcepath>${project.build.sourceDirectory}:${basedir}/src/gen/thrift/gen-javabean</sourcepath>
+ <sourceFileExcludes>
+ <exclude>${project.build.sourceDirectory}:${basedir}/src/gen/thrift/gen-javabean</exclude>
+ </sourceFileExcludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <profiles>
+ <profile>
+ <id>thriftif</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-thrift-sources</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <target>
+ <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask"
+ classpathref="maven.plugin.classpath" />
+ <property name="thrift.args" value="-I ${thrift.home} --gen java:beans,hashcode,generated_annotations=undated"/>
+ <property name="thrift.gen.dir" value="${basedir}/src/gen/thrift"/>
+ <delete dir="${thrift.gen.dir}"/>
+ <mkdir dir="${thrift.gen.dir}"/>
+ <for param="thrift.file">
+ <path>
+ <fileset dir="${basedir}/src/main/resources/" includes="**/*.thrift" />
+ </path>
+ <sequential>
+ <echo message="Generating Thrift code for @{thrift.file}"/>
+ <exec executable="${thrift.home}/bin/thrift" failonerror="true" dir=".">
+ <arg line="${thrift.args} -I ${basedir}/src/main/resources/ -o ${thrift.gen.dir} @{thrift.file} " />
+ </exec>
+ </sequential>
+ </for>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>enforce-property</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireProperty>
+ <property>thrift.home</property>
+ </requireProperty>
+ </rules>
+ <fail>true</fail>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
\ No newline at end of file