You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by br...@apache.org on 2013/12/27 19:51:51 UTC
[1/7] SENTRY-76 - Create basic thrift infrastructure for policy
service (Shreepadma via Brock)
Updated Branches:
refs/heads/db_policy_store b9aa0b7a0 -> c6bec1679
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryPolicyStore.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryPolicyStore.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryPolicyStore.java
new file mode 100644
index 0000000..2d49e2d
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryPolicyStore.java
@@ -0,0 +1,406 @@
+/**
+ * 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.persistent;
+
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hive.metastore.ObjectStore;
+import org.apache.sentry.policystore.api.TSentryAlreadyExistsException;
+import org.apache.sentry.policystore.api.TSentryNoSuchObjectException;
+import org.apache.sentry.policystore.api.TSentryPrivilege;
+import org.apache.sentry.policystore.api.TSentryRole;
+import org.apache.sentry.provider.db.service.model.*;
+
+import javax.jdo.JDODataStoreException;
+import javax.jdo.JDOHelper;
+import javax.jdo.JDOObjectNotFoundException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+import javax.jdo.datastore.DataStoreCache;
+import javax.jdo.identity.IntIdentity;
+import org.apache.hadoop.hive.conf.HiveConf;
+
+public class SentryPolicyStore {
+
+ private static Properties prop = null;
+ private static PersistenceManagerFactory pmf = null;
+
+ private static Lock pmfPropLock = new ReentrantLock();
+ private static final Log LOG = LogFactory.getLog(SentryPolicyStore.class.getName());
+
+ private boolean isInitialized = false;
+ private PersistenceManager pm = null;
+ int openTrasactionCalls = 0;
+ private Transaction currentTransaction = null;
+ private TXN_STATUS transactionStatus = TXN_STATUS.NO_STATE;
+ private final AtomicBoolean isSchemaVerified = new AtomicBoolean(false);
+
+ private static enum TXN_STATUS {
+ NO_STATE, OPEN, COMMITED, ROLLBACK
+ }
+
+
+ public SentryPolicyStore () {
+
+ }
+
+ //FIXME: Cleanup this mess i.e., creating a new PM and PMF.
+ @SuppressWarnings("nls")
+ public void setConf() {
+
+ pmfPropLock.lock();
+ try {
+ isInitialized = false;
+ Properties propsFromConf = getDataSourceProps();
+
+ assert(!isActiveTransaction());
+ shutdown();
+ // Always want to re-create pm as we don't know if it were created by the
+ // most recent instance of the pmf
+ pm = null;
+ openTrasactionCalls = 0;
+ currentTransaction = null;
+ transactionStatus = TXN_STATUS.NO_STATE;
+
+ initialize(propsFromConf);
+
+ if (!isInitialized) {
+ throw new RuntimeException(
+ "Unable to create persistence manager. Check dss.log for details");
+ } else {
+ LOG.info("Initialized ObjectStore");
+ }
+ } finally {
+ pmfPropLock.unlock();
+ }
+ }
+
+ private ClassLoader classLoader;
+ {
+ classLoader = Thread.currentThread().getContextClassLoader();
+ if (classLoader == null) {
+ classLoader = ObjectStore.class.getClassLoader();
+ }
+ }
+
+ @SuppressWarnings("nls")
+ private void initialize(Properties dsProps) {
+ LOG.info("ObjectStore, initialize called");
+ prop = dsProps;
+ pm = getPersistenceManager();
+ isInitialized = (pm != null);
+ }
+
+ public PersistenceManager getPersistenceManager() {
+ return getPMF().getPersistenceManager();
+ }
+
+ private static synchronized PersistenceManagerFactory getPMF() {
+ if (pmf == null) {
+ pmf = JDOHelper.getPersistenceManagerFactory(prop);
+ DataStoreCache dsc = pmf.getDataStoreCache();
+ if (dsc == null) {
+ LOG.warn("PersistenceManagerFactory returned null DataStoreCache object. Unable to initialize object pin types defined by hive.metastore.cache.pinobjtypes");
+ }
+ }
+ return pmf;
+ }
+
+ public void shutdown() {
+ if (pm != null) {
+ pm.close();
+ }
+ }
+
+ //FIXME: Cleanup this logic
+ public boolean openTransaction() {
+ openTrasactionCalls++;
+ if (openTrasactionCalls == 1) {
+ currentTransaction = pm.currentTransaction();
+ currentTransaction.begin();
+ transactionStatus = TXN_STATUS.OPEN;
+ } else {
+ // something is wrong since openTransactionCalls is greater than 1 but
+ // currentTransaction is not active
+ assert ((currentTransaction != null) && (currentTransaction.isActive()));
+ }
+ return currentTransaction.isActive();
+ }
+
+ @SuppressWarnings("nls")
+ public boolean commitTransaction() {
+ if (TXN_STATUS.ROLLBACK == transactionStatus) {
+ return false;
+ }
+ if (openTrasactionCalls <= 0) {
+ throw new RuntimeException("commitTransaction was called but openTransactionCalls = "
+ + openTrasactionCalls + ". This probably indicates that there are unbalanced " +
+ "calls to openTransaction/commitTransaction");
+ }
+ if (!currentTransaction.isActive()) {
+ throw new RuntimeException(
+ "Commit is called, but transaction is not active. Either there are"
+ + " mismatching open and close calls or rollback was called in the same trasaction");
+ }
+ openTrasactionCalls--;
+ if ((openTrasactionCalls == 0) && currentTransaction.isActive()) {
+ transactionStatus = TXN_STATUS.COMMITED;
+ currentTransaction.commit();
+ }
+ return true;
+ }
+
+ public boolean isActiveTransaction() {
+ if (currentTransaction == null) {
+ return false;
+ }
+ return currentTransaction.isActive();
+ }
+
+ public void rollbackTransaction() {
+ if (openTrasactionCalls < 1) {
+ return;
+ }
+ openTrasactionCalls = 0;
+ if (currentTransaction.isActive()
+ && transactionStatus != TXN_STATUS.ROLLBACK) {
+ transactionStatus = TXN_STATUS.ROLLBACK;
+ // could already be rolled back
+ currentTransaction.rollback();
+ // remove all detached objects from the cache, since the transaction is
+ // being rolled back they are no longer relevant, and this prevents them
+ // from reattaching in future transactions
+ pm.evictAll();
+ }
+ }
+
+ private static Properties getDataSourceProps() {
+ Properties prop = new Properties();
+ // FIXME: Read from configuration, don't hard-code everything
+ prop.setProperty("datanucleus.connectionPoolingType", "BONECP");
+ prop.setProperty("datanucleus.validateTables", "false");
+ prop.setProperty("datanucleus.validateColumns", "false");
+ prop.setProperty("datanucleus.validateConstraints", "false");
+ prop.setProperty("datanucleus.storeManagerType", "rdbms");
+ prop.setProperty("datanucleus.autoCreateSchema", "true");
+ prop.setProperty("datanucleus.fixedDatastore", "false");
+ prop.setProperty("hive.metastore.schema.verification", "false");
+ prop.setProperty("datanucleus.autoStartMechanismMode", "checked");
+ prop.setProperty("datanucleus.transactionIsolation", "read-committed");
+ prop.setProperty("datanucleus.cache.level2", "false");
+ prop.setProperty("datanucleus.cache.level2.type", "none");
+ prop.setProperty("datanucleus.identifierFactory", "datanucleus1");
+ prop.setProperty("datanucleus.rdbms.useLegacyNativeValueStrategy", "true");
+ prop.setProperty("datanucleus.plugin.pluginRegistryBundleCheck", "LOG");
+
+ prop.setProperty("javax.jdo.option.ConnectionDriverName",
+ "org.apache.derby.jdbc.EmbeddedDriver");
+ prop.setProperty("javax.jdo.PersistenceManagerFactoryClass",
+ "org.datanucleus.api.jdo.JDOPersistenceManagerFactory");
+ prop.setProperty("javax.jdo.option.DetachAllOnCommit", "true");
+ prop.setProperty("javax.jdo.option.NonTransactionalRead", "true");
+ prop.setProperty("javax.jdo.option.ConnectionUserName", "APP");
+
+ prop.setProperty("javax.jdo.option.ConnectionPassword", "mine");
+ prop.setProperty("javax.jdo.option.Multithreaded", "true");
+ prop.setProperty("javax.jdo.option.ConnectionURL",
+ "jdbc:derby:;databaseName=sentry_policy_db;create=true");
+ return prop;
+ }
+
+
+ private MSentryRole convertToMSentryRole(TSentryRole role) {
+ MSentryRole mRole = new MSentryRole();
+ mRole.setCreateTime(role.getCreateTime());
+ mRole.setRoleName(role.getRoleName());
+ mRole.setGrantorPrincipal(role.getGrantorPrincipal());
+
+ return mRole;
+
+ }
+
+
+ private void writeSentryRole(MSentryRole role) throws TSentryAlreadyExistsException{
+
+ // TODO: verify if the role exists, if it does throw an exception
+ pm.makePersistent(role);
+
+ }
+
+
+ public boolean createSentryRole(TSentryRole role) throws TSentryAlreadyExistsException {
+
+ // TODO: add some logging
+
+ boolean committed = false;
+
+ try {
+ openTransaction();
+ MSentryRole mRole = convertToMSentryRole(role);
+ writeSentryRole(mRole);
+ committed = commitTransaction();
+ } finally {
+ if (!committed) {
+ rollbackTransaction();
+ }
+ }
+
+ return committed;
+ }
+
+ private MSentryRole getMSentryRole (String roleName) throws TSentryNoSuchObjectException {
+
+ boolean committed = false;
+
+ try {
+ openTransaction();
+ Query query = pm.newQuery(MSentryRole.class);
+ query.setFilter("roleName == t");
+ query
+ .declareParameters("java.lang.String t");
+ query.setUnique(true);
+
+ MSentryRole mSentryRole = (MSentryRole) query.execute(roleName.trim());
+ pm.retrieve(mSentryRole);
+ committed = commitTransaction();
+ return mSentryRole;
+ } finally {
+ if (!committed) {
+ rollbackTransaction();
+ return null;
+ }
+ }
+ }
+
+ private MSentryPrivilege convertToMSentryPrivilege(TSentryPrivilege privilege) {
+ MSentryPrivilege mSentryPrivilege = new MSentryPrivilege();
+ mSentryPrivilege.setServerName(privilege.getServerName());
+ mSentryPrivilege.setDbName(privilege.getDbName());
+ mSentryPrivilege.setTableName(privilege.getTableName());
+ mSentryPrivilege.setPrivilegeScope(privilege.getPrivilegeScope());
+ mSentryPrivilege.setAction(privilege.getAction());
+ mSentryPrivilege.setCreateTime(privilege.getCreateTime());
+ mSentryPrivilege.setGrantorPrincipal(privilege.getGrantorPrincipal());
+ mSentryPrivilege.setURI(privilege.getURI());
+ mSentryPrivilege.setPrivilegeName(privilege.getPrivilegeName());
+ //MSentryRole mSentryRole = convertToMSentryRole(role);
+ return mSentryPrivilege;
+
+ }
+
+ public boolean alterSentryRole(String roleName, TSentryPrivilege privilege) throws TSentryNoSuchObjectException {
+
+ boolean committed = false;
+
+ try {
+ openTransaction();
+ MSentryRole mSentryRole = getMSentryRole(roleName);
+ MSentryPrivilege mSentryPrivilege = convertToMSentryPrivilege(privilege);
+ mSentryRole.appendPrivilege(mSentryPrivilege);
+ mSentryPrivilege.appendRole(mSentryRole);
+ pm.makePersistent(mSentryPrivilege);
+ //pm.makePersistent(mSentryRole);
+ committed = commitTransaction();
+ } finally {
+ if (!committed) {
+ rollbackTransaction();
+ }
+ }
+
+ return committed;
+ }
+
+ private TSentryPrivilege convertToSentryPrivilege(MSentryPrivilege mSentryPrivilege) {
+ TSentryPrivilege privilege = new TSentryPrivilege();
+ privilege.setCreateTime(mSentryPrivilege.getCreateTime());
+ privilege.setPrivilegeName(mSentryPrivilege.getPrivilegeName());
+ privilege.setAction(mSentryPrivilege.getAction());
+ privilege.setPrivilegeScope(mSentryPrivilege.getPrivilegeScope());
+ privilege.setServerName(mSentryPrivilege.getServerName());
+ privilege.setDbName(mSentryPrivilege.getDbName());
+ privilege.setTableName(mSentryPrivilege.getTableName());
+ privilege.setURI(mSentryPrivilege.getURI());
+ privilege.setGrantorPrincipal(mSentryPrivilege.getGrantorPrincipal());
+
+ return privilege;
+ }
+
+ private TSentryRole convertToSentryRole(MSentryRole mSentryRole) {
+ TSentryRole role = new TSentryRole();
+ role.setCreateTime(mSentryRole.getCreateTime());
+ role.setRoleName(mSentryRole.getRoleName());
+ role.setGrantorPrincipal(mSentryRole.getGrantorPrincipal());
+
+ Set<TSentryPrivilege> sentryPrivileges = new HashSet<TSentryPrivilege>();
+ for(MSentryPrivilege mSentryPrivilege:mSentryRole.getPrivileges()) {
+ TSentryPrivilege privilege = convertToSentryPrivilege(mSentryPrivilege);
+ sentryPrivileges.add(privilege);
+ }
+
+ role.setPrivileges(sentryPrivileges);
+ return role;
+ }
+
+ public TSentryRole getSentryRole(String roleName) throws TSentryNoSuchObjectException {
+ TSentryRole role;
+ MSentryRole mSentryRole = getMSentryRole(roleName);
+ role = convertToSentryRole(mSentryRole);
+ return role;
+
+ }
+
+ public boolean dropSentryRole(String roleName) throws TSentryNoSuchObjectException {
+
+ boolean committed = false;
+ try {
+ MSentryRole mSentryRole;
+
+ openTransaction();
+ Query query = pm.newQuery(MSentryRole.class);
+ query.setFilter("roleName == t");
+ query
+ .declareParameters("java.lang.String t");
+ query.setUnique(true);
+
+ mSentryRole = (MSentryRole) query.execute(roleName.trim());
+ pm.retrieve(mSentryRole);
+
+ if (mSentryRole != null) {
+ mSentryRole.removePrivileges();
+ pm.deletePersistent(mSentryRole);
+ }
+ committed = commitTransaction();
+ } finally {
+ if (!committed) {
+ rollbackTransaction();
+ }
+ }
+
+ return committed;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/HiveMetaStoreSentryPolicyStoreHandler.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/HiveMetaStoreSentryPolicyStoreHandler.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/HiveMetaStoreSentryPolicyStoreHandler.java
new file mode 100644
index 0000000..578b218
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/HiveMetaStoreSentryPolicyStoreHandler.java
@@ -0,0 +1,700 @@
+/**
+ * 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 org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.HiveMetaStore;
+import org.apache.hadoop.hive.metastore.IHMSHandler;
+import org.apache.hadoop.hive.metastore.api.ColumnStatistics;
+import org.apache.hadoop.hive.metastore.api.ConfigValSecurityException;
+import org.apache.hadoop.hive.metastore.api.Database;
+import org.apache.hadoop.hive.metastore.api.EnvironmentContext;
+import org.apache.hadoop.hive.metastore.api.FieldSchema;
+import org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege;
+import org.apache.hadoop.hive.metastore.api.HiveObjectRef;
+import org.apache.hadoop.hive.metastore.api.Index;
+import org.apache.hadoop.hive.metastore.api.InvalidInputException;
+import org.apache.hadoop.hive.metastore.api.InvalidObjectException;
+import org.apache.hadoop.hive.metastore.api.InvalidOperationException;
+import org.apache.hadoop.hive.metastore.api.InvalidPartitionException;
+import org.apache.hadoop.hive.metastore.api.MetaException;
+import org.apache.hadoop.hive.metastore.api.Partition;
+import org.apache.hadoop.hive.metastore.api.PartitionEventType;
+import org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet;
+import org.apache.hadoop.hive.metastore.api.PrincipalType;
+import org.apache.hadoop.hive.metastore.api.PrivilegeBag;
+import org.apache.hadoop.hive.metastore.api.Role;
+import org.apache.hadoop.hive.metastore.api.Table;
+import org.apache.hadoop.hive.metastore.api.Type;
+import org.apache.hadoop.hive.metastore.api.UnknownDBException;
+import org.apache.hadoop.hive.metastore.api.UnknownPartitionException;
+import org.apache.hadoop.hive.metastore.api.UnknownTableException;
+import org.apache.sentry.policystore.api.SentryThriftPolicyService;
+import org.apache.sentry.policystore.api.TAlterSentryRoleAddGroupsRequest;
+import org.apache.sentry.policystore.api.TAlterSentryRoleAddGroupsResponse;
+import org.apache.sentry.policystore.api.TAlterSentryRoleDeleteGroupsRequest;
+import org.apache.sentry.policystore.api.TAlterSentryRoleDeleteGroupsResponse;
+import org.apache.sentry.policystore.api.TCreateSentryPrivilegeRequest;
+import org.apache.sentry.policystore.api.TCreateSentryPrivilegeResponse;
+import org.apache.sentry.policystore.api.TCreateSentryRoleRequest;
+import org.apache.sentry.policystore.api.TCreateSentryRoleResponse;
+import org.apache.sentry.policystore.api.TListSentryRolesRequest;
+import org.apache.sentry.policystore.api.TListSentryRolesResponse;
+import org.apache.sentry.policystore.api.TSentryAlreadyExistsException;
+import org.apache.sentry.policystore.api.TSentryNoSuchObjectException;
+import org.apache.thrift.TException;
+
+import com.facebook.fb303.fb_status;
+
+public class HiveMetaStoreSentryPolicyStoreHandler
+ implements SentryThriftPolicyService.Iface, IHMSHandler {
+ private final String name;
+ private HiveConf conf;
+
+ private final SentryPolicyStoreHandler sentryPolicyStoreHander;
+ private final IHMSHandler hiveMetaStoreHandler;
+
+ public HiveMetaStoreSentryPolicyStoreHandler(String name, HiveConf conf)
+ throws MetaException {
+ super();
+ this.name = name;
+ this.conf = conf;
+ sentryPolicyStoreHander = new SentryPolicyStoreHandler(name, conf);
+ hiveMetaStoreHandler = new HiveMetaStore.HMSHandler(name, conf);
+ }
+
+ @Override
+ public TCreateSentryRoleResponse create_sentry_role(
+ TCreateSentryRoleRequest request) throws TSentryAlreadyExistsException,
+ TException {
+ return sentryPolicyStoreHander.create_sentry_role(request);
+ }
+ @Override
+ public TCreateSentryPrivilegeResponse create_sentry_privilege(
+ TCreateSentryPrivilegeRequest request)
+ throws TSentryAlreadyExistsException, TException {
+ return sentryPolicyStoreHander.create_sentry_privilege(request);
+ }
+ @Override
+ public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(
+ TAlterSentryRoleAddGroupsRequest request)
+ throws TSentryNoSuchObjectException, TException {
+ return sentryPolicyStoreHander.alter_sentry_role_add_groups(request);
+ }
+ @Override
+ public TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(
+ TAlterSentryRoleDeleteGroupsRequest request)
+ throws TSentryNoSuchObjectException, TException {
+ return sentryPolicyStoreHander.alter_sentry_role_delete_groups(request);
+ }
+ @Override
+ public TListSentryRolesResponse list_sentry_roles(
+ TListSentryRolesRequest request) throws TSentryNoSuchObjectException,
+ TException {
+ return sentryPolicyStoreHander.list_sentry_roles(request);
+ }
+
+ // below is hive methods
+
+ @Override
+ public Index add_index(Index arg0, Table arg1) throws InvalidObjectException,
+ org.apache.hadoop.hive.metastore.api.AlreadyExistsException,
+ MetaException, TException {
+ return hiveMetaStoreHandler.add_index(arg0, arg1);
+ }
+
+ @Override
+ public Partition add_partition(Partition arg0) throws InvalidObjectException,
+ org.apache.hadoop.hive.metastore.api.AlreadyExistsException,
+ MetaException, TException {
+ return hiveMetaStoreHandler.add_partition(arg0);
+ }
+
+ @Override
+ public Partition add_partition_with_environment_context(Partition arg0,
+ EnvironmentContext arg1) throws InvalidObjectException,
+ org.apache.hadoop.hive.metastore.api.AlreadyExistsException,
+ MetaException, TException {
+ return hiveMetaStoreHandler.add_partition_with_environment_context(arg0, arg1);
+ }
+
+ @Override
+ public int add_partitions(List<Partition> arg0)
+ throws InvalidObjectException,
+ org.apache.hadoop.hive.metastore.api.AlreadyExistsException,
+ MetaException, TException {
+ return hiveMetaStoreHandler.add_partitions(arg0);
+ }
+
+ @Override
+ public void alter_database(String arg0, Database arg1) throws MetaException,
+ org.apache.hadoop.hive.metastore.api.NoSuchObjectException, TException {
+ hiveMetaStoreHandler.alter_database(arg0, arg1);
+ }
+
+ @Override
+ public void alter_index(String arg0, String arg1, String arg2, Index arg3)
+ throws InvalidOperationException, MetaException, TException {
+ hiveMetaStoreHandler.alter_index(arg0, arg1, arg2, arg3);
+ }
+
+ @Override
+ public void alter_partition(String arg0, String arg1, Partition arg2)
+ throws InvalidOperationException, MetaException, TException {
+ hiveMetaStoreHandler.alter_partition(arg0, arg1, arg2);
+ }
+
+ @Override
+ public void alter_partition_with_environment_context(String arg0,
+ String arg1, Partition arg2, EnvironmentContext arg3)
+ throws InvalidOperationException, MetaException, TException {
+ hiveMetaStoreHandler.alter_partition_with_environment_context(arg0, arg1, arg2, arg3);
+ }
+
+ @Override
+ public void alter_partitions(String arg0, String arg1, List<Partition> arg2)
+ throws InvalidOperationException, MetaException, TException {
+ hiveMetaStoreHandler.alter_partitions(arg0, arg1, arg2);
+ }
+
+ @Override
+ public void alter_table(String arg0, String arg1, Table arg2)
+ throws InvalidOperationException, MetaException, TException {
+ hiveMetaStoreHandler.alter_table(arg0, arg1, arg2);
+ }
+
+ @Override
+ public void alter_table_with_environment_context(String arg0, String arg1,
+ Table arg2, EnvironmentContext arg3) throws InvalidOperationException,
+ MetaException, TException {
+ hiveMetaStoreHandler.alter_table_with_environment_context(arg0, arg1, arg2, arg3);
+ }
+
+ @Override
+ public Partition append_partition(String arg0, String arg1, List<String> arg2)
+ throws InvalidObjectException,
+ org.apache.hadoop.hive.metastore.api.AlreadyExistsException,
+ MetaException, TException {
+ return hiveMetaStoreHandler.append_partition(arg0, arg1, arg2);
+ }
+
+ @Override
+ public Partition append_partition_by_name(String arg0, String arg1,
+ String arg2) throws InvalidObjectException,
+ org.apache.hadoop.hive.metastore.api.AlreadyExistsException,
+ MetaException, TException {
+ return hiveMetaStoreHandler.append_partition_by_name(arg0, arg1, arg2);
+ }
+
+ @Override
+ public void cancel_delegation_token(String arg0) throws MetaException,
+ TException {
+ hiveMetaStoreHandler.cancel_delegation_token(arg0);
+ }
+
+ @Override
+ public void create_database(Database arg0)
+ throws org.apache.hadoop.hive.metastore.api.AlreadyExistsException,
+ InvalidObjectException, MetaException, TException {
+ hiveMetaStoreHandler.create_database(arg0);
+ }
+
+ @Override
+ public boolean create_role(Role arg0) throws MetaException, TException {
+ return hiveMetaStoreHandler.create_role(arg0);
+ }
+
+ @Override
+ public void create_table(Table arg0)
+ throws org.apache.hadoop.hive.metastore.api.AlreadyExistsException,
+ InvalidObjectException, MetaException,
+ org.apache.hadoop.hive.metastore.api.NoSuchObjectException, TException {
+ hiveMetaStoreHandler.create_table(arg0);
+ }
+
+ @Override
+ public void create_table_with_environment_context(Table arg0,
+ EnvironmentContext arg1)
+ throws org.apache.hadoop.hive.metastore.api.AlreadyExistsException,
+ InvalidObjectException, MetaException,
+ org.apache.hadoop.hive.metastore.api.NoSuchObjectException, TException {
+ hiveMetaStoreHandler.create_table_with_environment_context(arg0, arg1);
+ }
+
+ @Override
+ public boolean create_type(Type arg0)
+ throws org.apache.hadoop.hive.metastore.api.AlreadyExistsException,
+ InvalidObjectException, MetaException, TException {
+ return hiveMetaStoreHandler.create_type(arg0);
+ }
+
+ @Override
+ public boolean delete_partition_column_statistics(String arg0, String arg1,
+ String arg2, String arg3)
+ throws org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ MetaException, InvalidObjectException, InvalidInputException, TException {
+ return hiveMetaStoreHandler.delete_partition_column_statistics(arg0, arg1, arg2, arg3);
+ }
+
+ @Override
+ public boolean delete_table_column_statistics(String arg0, String arg1,
+ String arg2)
+ throws org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ MetaException, InvalidObjectException, InvalidInputException, TException {
+ return hiveMetaStoreHandler.delete_table_column_statistics(arg0, arg1, arg2);
+ }
+
+ @Override
+ public void drop_database(String arg0, boolean arg1, boolean arg2)
+ throws org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ InvalidOperationException, MetaException, TException {
+ hiveMetaStoreHandler.drop_database(arg0, arg1, arg2);
+ }
+
+ @Override
+ public boolean drop_index_by_name(String arg0, String arg1, String arg2,
+ boolean arg3)
+ throws org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ MetaException, TException {
+ return hiveMetaStoreHandler.drop_index_by_name(arg0, arg1, arg2, arg3);
+ }
+
+ @Override
+ public boolean drop_partition(String arg0, String arg1, List<String> arg2,
+ boolean arg3)
+ throws org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ MetaException, TException {
+ return hiveMetaStoreHandler.drop_partition(arg0, arg1, arg2, arg3);
+ }
+
+ @Override
+ public boolean drop_partition_by_name(String arg0, String arg1, String arg2,
+ boolean arg3)
+ throws org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ MetaException, TException {
+ return hiveMetaStoreHandler.drop_index_by_name(arg0, arg1, arg2, arg3);
+ }
+
+ @Override
+ public boolean drop_role(String arg0) throws MetaException, TException {
+ return hiveMetaStoreHandler.drop_role(arg0);
+ }
+
+ @Override
+ public void drop_table(String arg0, String arg1, boolean arg2)
+ throws org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ MetaException, TException {
+ hiveMetaStoreHandler.drop_table(arg0, arg1, arg2);
+ }
+
+ @Override
+ public boolean drop_type(String arg0) throws MetaException,
+ org.apache.hadoop.hive.metastore.api.NoSuchObjectException, TException {
+ return hiveMetaStoreHandler.drop_type(arg0);
+ }
+
+ @Override
+ public List<String> get_all_databases() throws MetaException, TException {
+ return hiveMetaStoreHandler.get_all_databases();
+ }
+
+ @Override
+ public List<String> get_all_tables(String arg0) throws MetaException,
+ TException {
+ return hiveMetaStoreHandler.get_all_tables(arg0);
+ }
+
+ @Override
+ public String get_config_value(String arg0, String arg1)
+ throws ConfigValSecurityException, TException {
+ return hiveMetaStoreHandler.get_config_value(arg0, arg1);
+ }
+
+ @Override
+ public Database get_database(String arg0)
+ throws org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ MetaException, TException {
+ return hiveMetaStoreHandler.get_database(arg0);
+ }
+
+ @Override
+ public List<String> get_databases(String arg0) throws MetaException,
+ TException {
+ return hiveMetaStoreHandler.get_databases(arg0);
+ }
+
+ @Override
+ public String get_delegation_token(String arg0, String arg1)
+ throws MetaException, TException {
+ return hiveMetaStoreHandler.get_delegation_token(arg0, arg1);
+ }
+
+ @Override
+ public List<FieldSchema> get_fields(String arg0, String arg1)
+ throws MetaException, UnknownTableException, UnknownDBException,
+ TException {
+ return hiveMetaStoreHandler.get_fields(arg0, arg1);
+ }
+
+ @Override
+ public Index get_index_by_name(String arg0, String arg1, String arg2)
+ throws MetaException,
+ org.apache.hadoop.hive.metastore.api.NoSuchObjectException, TException {
+ return hiveMetaStoreHandler.get_index_by_name(arg0, arg1, arg2);
+ }
+
+ @Override
+ public List<String> get_index_names(String arg0, String arg1, short arg2)
+ throws MetaException, TException {
+ return hiveMetaStoreHandler.get_index_names(arg0, arg1, arg2);
+ }
+
+ @Override
+ public List<Index> get_indexes(String arg0, String arg1, short arg2)
+ throws org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ MetaException, TException {
+ return hiveMetaStoreHandler.get_indexes(arg0, arg1, arg2);
+ }
+
+ @Override
+ public Partition get_partition(String arg0, String arg1, List<String> arg2)
+ throws MetaException,
+ org.apache.hadoop.hive.metastore.api.NoSuchObjectException, TException {
+ return hiveMetaStoreHandler.get_partition(arg0, arg1, arg2);
+ }
+
+ @Override
+ public Partition get_partition_by_name(String arg0, String arg1, String arg2)
+ throws MetaException,
+ org.apache.hadoop.hive.metastore.api.NoSuchObjectException, TException {
+ return hiveMetaStoreHandler.get_partition_by_name(arg0, arg1, arg2);
+ }
+
+ @Override
+ public ColumnStatistics get_partition_column_statistics(String arg0,
+ String arg1, String arg2, String arg3)
+ throws org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ MetaException, InvalidInputException, InvalidObjectException, TException {
+ return hiveMetaStoreHandler.get_partition_column_statistics(arg0, arg1, arg2, arg3);
+ }
+
+ @Override
+ public List<String> get_partition_names(String arg0, String arg1, short arg2)
+ throws MetaException, TException {
+ return hiveMetaStoreHandler.get_partition_names(arg0, arg1, arg2);
+ }
+
+ @Override
+ public List<String> get_partition_names_ps(String arg0, String arg1,
+ List<String> arg2, short arg3) throws MetaException,
+ org.apache.hadoop.hive.metastore.api.NoSuchObjectException, TException {
+ return hiveMetaStoreHandler.get_partition_names_ps(arg0, arg1, arg2, arg3);
+ }
+
+ @Override
+ public Partition get_partition_with_auth(String arg0, String arg1,
+ List<String> arg2, String arg3, List<String> arg4) throws MetaException,
+ org.apache.hadoop.hive.metastore.api.NoSuchObjectException, TException {
+ return hiveMetaStoreHandler.get_partition_with_auth(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ @Override
+ public List<Partition> get_partitions(String arg0, String arg1, short arg2)
+ throws org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ MetaException, TException {
+ return hiveMetaStoreHandler.get_partitions(arg0, arg1, arg2);
+ }
+
+ @Override
+ public List<Partition> get_partitions_by_filter(String arg0, String arg1,
+ String arg2, short arg3) throws MetaException,
+ org.apache.hadoop.hive.metastore.api.NoSuchObjectException, TException {
+ return hiveMetaStoreHandler.get_partitions_by_filter(arg0, arg1, arg2, arg3);
+ }
+
+ @Override
+ public List<Partition> get_partitions_by_names(String arg0, String arg1,
+ List<String> arg2) throws MetaException,
+ org.apache.hadoop.hive.metastore.api.NoSuchObjectException, TException {
+ return hiveMetaStoreHandler.get_partitions_by_names(arg0, arg1, arg2);
+ }
+
+ @Override
+ public List<Partition> get_partitions_ps(String arg0, String arg1,
+ List<String> arg2, short arg3) throws MetaException,
+ org.apache.hadoop.hive.metastore.api.NoSuchObjectException, TException {
+ return hiveMetaStoreHandler.get_partitions_ps(arg0, arg1, arg2, arg3);
+ }
+
+ @Override
+ public List<Partition> get_partitions_ps_with_auth(String arg0, String arg1,
+ List<String> arg2, short arg3, String arg4, List<String> arg5)
+ throws org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ MetaException, TException {
+ return hiveMetaStoreHandler.get_partitions_ps_with_auth(arg0, arg1, arg2, arg3, arg4, arg5);
+ }
+
+ @Override
+ public List<Partition> get_partitions_with_auth(String arg0, String arg1,
+ short arg2, String arg3, List<String> arg4)
+ throws org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ MetaException, TException {
+ return hiveMetaStoreHandler.get_partitions_with_auth(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ @Override
+ public PrincipalPrivilegeSet get_privilege_set(HiveObjectRef arg0,
+ String arg1, List<String> arg2) throws MetaException, TException {
+ return hiveMetaStoreHandler.get_privilege_set(arg0, arg1, arg2);
+ }
+
+ @Override
+ public List<String> get_role_names() throws MetaException, TException {
+ return hiveMetaStoreHandler.get_role_names();
+ }
+
+ @Override
+ public List<FieldSchema> get_schema(String arg0, String arg1)
+ throws MetaException, UnknownTableException, UnknownDBException,
+ TException {
+ return hiveMetaStoreHandler.get_schema(arg0, arg1);
+ }
+
+ @Override
+ public Table get_table(String arg0, String arg1) throws MetaException,
+ org.apache.hadoop.hive.metastore.api.NoSuchObjectException, TException {
+ return hiveMetaStoreHandler.get_table(arg0, arg1);
+ }
+
+ @Override
+ public ColumnStatistics get_table_column_statistics(String arg0, String arg1,
+ String arg2)
+ throws org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ MetaException, InvalidInputException, InvalidObjectException, TException {
+ return hiveMetaStoreHandler.get_table_column_statistics(arg0, arg1, arg2);
+ }
+
+ @Override
+ public List<String> get_table_names_by_filter(String arg0, String arg1,
+ short arg2) throws MetaException, InvalidOperationException,
+ UnknownDBException, TException {
+ return hiveMetaStoreHandler.get_table_names_by_filter(arg0, arg1, arg2);
+ }
+
+ @Override
+ public List<Table> get_table_objects_by_name(String arg0, List<String> arg1)
+ throws MetaException, InvalidOperationException, UnknownDBException,
+ TException {
+ return hiveMetaStoreHandler.get_table_objects_by_name(arg0, arg1);
+ }
+
+ @Override
+ public List<String> get_tables(String arg0, String arg1)
+ throws MetaException, TException {
+ return hiveMetaStoreHandler.get_tables(arg0, arg1);
+ }
+
+ @Override
+ public Type get_type(String arg0) throws MetaException,
+ org.apache.hadoop.hive.metastore.api.NoSuchObjectException, TException {
+ return hiveMetaStoreHandler.get_type(arg0);
+ }
+
+ @Override
+ public Map<String, Type> get_type_all(String arg0) throws MetaException,
+ TException {
+ return hiveMetaStoreHandler.get_type_all(arg0);
+ }
+
+ @Override
+ public boolean grant_privileges(PrivilegeBag arg0) throws MetaException,
+ TException {
+ return hiveMetaStoreHandler.grant_privileges(arg0);
+ }
+
+ @Override
+ public boolean grant_role(String arg0, String arg1, PrincipalType arg2,
+ String arg3, PrincipalType arg4, boolean arg5) throws MetaException,
+ TException {
+ return hiveMetaStoreHandler.grant_role(arg0, arg1, arg2, arg3, arg4, arg5);
+ }
+
+ @Override
+ public boolean isPartitionMarkedForEvent(String arg0, String arg1,
+ Map<String, String> arg2, PartitionEventType arg3) throws MetaException,
+ org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ UnknownDBException, UnknownTableException, UnknownPartitionException,
+ InvalidPartitionException, TException {
+ return hiveMetaStoreHandler.isPartitionMarkedForEvent(arg0, arg1, arg2, arg3);
+ }
+
+ @Override
+ public List<HiveObjectPrivilege> list_privileges(String arg0,
+ PrincipalType arg1, HiveObjectRef arg2) throws MetaException, TException {
+ return hiveMetaStoreHandler.list_privileges(arg0, arg1, arg2);
+ }
+
+ @Override
+ public List<Role> list_roles(String arg0, PrincipalType arg1)
+ throws MetaException, TException {
+ return hiveMetaStoreHandler.list_roles(arg0, arg1);
+ }
+
+ @Override
+ public void markPartitionForEvent(String arg0, String arg1,
+ Map<String, String> arg2, PartitionEventType arg3) throws MetaException,
+ org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ UnknownDBException, UnknownTableException, UnknownPartitionException,
+ InvalidPartitionException, TException {
+ hiveMetaStoreHandler.markPartitionForEvent(arg0, arg1, arg2, arg3);
+ }
+
+ @Override
+ public Map<String, String> partition_name_to_spec(String arg0)
+ throws MetaException, TException {
+ return hiveMetaStoreHandler.partition_name_to_spec(arg0);
+ }
+
+ @Override
+ public List<String> partition_name_to_vals(String arg0) throws MetaException,
+ TException {
+ return hiveMetaStoreHandler.partition_name_to_vals(arg0);
+ }
+
+ @Override
+ public void rename_partition(String arg0, String arg1, List<String> arg2,
+ Partition arg3) throws InvalidOperationException, MetaException,
+ TException {
+ hiveMetaStoreHandler.rename_partition(arg0, arg1, arg2, arg3);
+ }
+
+ @Override
+ public long renew_delegation_token(String arg0) throws MetaException,
+ TException {
+ return hiveMetaStoreHandler.renew_delegation_token(arg0);
+ }
+
+ @Override
+ public boolean revoke_privileges(PrivilegeBag arg0) throws MetaException,
+ TException {
+ return hiveMetaStoreHandler.revoke_privileges(arg0);
+ }
+
+ @Override
+ public boolean revoke_role(String arg0, String arg1, PrincipalType arg2)
+ throws MetaException, TException {
+ return hiveMetaStoreHandler.revoke_role(arg0, arg1, arg2);
+ }
+
+ @Override
+ public List<String> set_ugi(String arg0, List<String> arg1)
+ throws MetaException, TException {
+ return hiveMetaStoreHandler.set_ugi(arg0, arg1);
+ }
+
+ @Override
+ public boolean update_partition_column_statistics(ColumnStatistics arg0)
+ throws org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ InvalidObjectException, MetaException, InvalidInputException, TException {
+ return hiveMetaStoreHandler.update_partition_column_statistics(arg0);
+ }
+
+ @Override
+ public boolean update_table_column_statistics(ColumnStatistics arg0)
+ throws org.apache.hadoop.hive.metastore.api.NoSuchObjectException,
+ InvalidObjectException, MetaException, InvalidInputException, TException {
+ return hiveMetaStoreHandler.update_table_column_statistics(arg0);
+ }
+
+ @Override
+ public long aliveSince() throws TException {
+ return hiveMetaStoreHandler.aliveSince();
+ }
+
+ @Override
+ public long getCounter(String arg0) throws TException {
+ return hiveMetaStoreHandler.getCounter(arg0);
+ }
+
+ @Override
+ public Map<String, Long> getCounters() throws TException {
+ return hiveMetaStoreHandler.getCounters();
+ }
+
+ @Override
+ public String getCpuProfile(int arg0) throws TException {
+ return hiveMetaStoreHandler.getCpuProfile(arg0);
+ }
+
+ @Override
+ public String getName() throws TException {
+ return hiveMetaStoreHandler.getName();
+ }
+
+ @Override
+ public String getOption(String arg0) throws TException {
+ return hiveMetaStoreHandler.getOption(arg0);
+ }
+
+ @Override
+ public Map<String, String> getOptions() throws TException {
+ return hiveMetaStoreHandler.getOptions();
+ }
+
+ @Override
+ public fb_status getStatus() throws TException {
+ return hiveMetaStoreHandler.getStatus();
+ }
+
+ @Override
+ public String getStatusDetails() throws TException {
+ return hiveMetaStoreHandler.getStatusDetails();
+ }
+
+ @Override
+ public String getVersion() throws TException {
+ return hiveMetaStoreHandler.getVersion();
+ }
+
+ @Override
+ public void reinitialize() throws TException {
+ hiveMetaStoreHandler.reinitialize();
+
+ }
+
+ @Override
+ public void setOption(String arg0, String arg1) throws TException {
+ hiveMetaStoreHandler.setOption(arg0, arg1);
+
+ }
+
+ @Override
+ public void shutdown() throws TException {
+ hiveMetaStoreHandler.shutdown();
+ }
+
+ @Override
+ public void setConf(Configuration arg0) {
+ hiveMetaStoreHandler.setConf(arg0);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreHandler.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreHandler.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreHandler.java
new file mode 100644
index 0000000..ab50580
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreHandler.java
@@ -0,0 +1,77 @@
+/**
+ * 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.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.HiveMetaStore;
+import org.apache.sentry.policystore.api.SentryThriftPolicyService;
+import org.apache.sentry.policystore.api.TAlterSentryRoleAddGroupsRequest;
+import org.apache.sentry.policystore.api.TAlterSentryRoleAddGroupsResponse;
+import org.apache.sentry.policystore.api.TAlterSentryRoleDeleteGroupsRequest;
+import org.apache.sentry.policystore.api.TAlterSentryRoleDeleteGroupsResponse;
+import org.apache.sentry.policystore.api.TCreateSentryPrivilegeRequest;
+import org.apache.sentry.policystore.api.TCreateSentryPrivilegeResponse;
+import org.apache.sentry.policystore.api.TCreateSentryRoleRequest;
+import org.apache.sentry.policystore.api.TCreateSentryRoleResponse;
+import org.apache.sentry.policystore.api.TListSentryRolesRequest;
+import org.apache.sentry.policystore.api.TListSentryRolesResponse;
+import org.apache.sentry.policystore.api.TSentryAlreadyExistsException;
+import org.apache.sentry.policystore.api.TSentryNoSuchObjectException;
+import org.apache.thrift.TException;
+
+public class SentryPolicyStoreHandler implements SentryThriftPolicyService.Iface {
+ private final String name;
+ private final HiveConf conf;
+ public SentryPolicyStoreHandler(String name, HiveConf conf) {
+ super();
+ this.name = name;
+ this.conf = conf;
+ }
+ @Override
+ public TCreateSentryRoleResponse create_sentry_role(
+ TCreateSentryRoleRequest request) throws TSentryAlreadyExistsException,
+ TException {
+ return null;
+ }
+ @Override
+ public TCreateSentryPrivilegeResponse create_sentry_privilege(
+ TCreateSentryPrivilegeRequest request)
+ throws TSentryAlreadyExistsException, TException {
+ return null;
+ }
+ @Override
+ public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(
+ TAlterSentryRoleAddGroupsRequest request)
+ throws TSentryNoSuchObjectException, TException {
+ return null;
+ }
+ @Override
+ public TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(
+ TAlterSentryRoleDeleteGroupsRequest request)
+ throws TSentryNoSuchObjectException, TException {
+ return null;
+ }
+ @Override
+ public TListSentryRolesResponse list_sentry_roles(
+ TListSentryRolesRequest request) throws TSentryNoSuchObjectException,
+ TException {
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/sentry_policystore.thrift
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/sentry_policystore.thrift b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/sentry_policystore.thrift
new file mode 100644
index 0000000..73a5d32
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/sentry_policystore.thrift
@@ -0,0 +1,134 @@
+#!/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 "share/fb303/if/fb303.thrift"
+
+namespace java org.apache.sentry.policystore.api
+namespace php sentrypolicystore
+namespace cpp Apache.Sentry
+
+enum TSentryPolicyServiceVersion {
+V1
+}
+
+struct TSentryPrivilege {
+1: required string privilegeScope,
+2: required string privilegeName,
+3: required string serverName,
+4: optional string dbName,
+5: optional string tableName,
+6: optional string URI,
+7: required string action,
+8: required i64 createTime,
+9: required string grantorPrincipal
+}
+
+struct TSentryRole {
+1: required string roleName,
+2: required set<TSentryPrivilege> privileges,
+3: required i64 createTime,
+4: required string grantorPrincipal
+}
+// TODO fill out
+struct TSentryGroup {
+1: required string groupName
+}
+
+struct TCreateSentryRoleRequest {
+1: required TSentryPolicyServiceVersion protocol_version = TSentryPolicyServiceVersion.V1,
+2: required string userName,
+3: required TSentryRole role
+}
+struct TCreateSentryRoleResponse {
+1: required bool success
+}
+
+struct TCreateSentryPrivilegeRequest {
+1: required TSentryPolicyServiceVersion protocol_version = TSentryPolicyServiceVersion.V1,
+2: required string userName,
+3: required TSentryPrivilege privilege
+}
+struct TCreateSentryPrivilegeResponse {
+1: required bool success
+}
+
+struct TCreateSentryPrivilegeRequest {
+1: required TSentryPolicyServiceVersion protocol_version = TSentryPolicyServiceVersion.V1,
+2: required string userName,
+3: required TSentryPrivilege privilege
+}
+struct TCreateSentryPrivilegeResponse {
+1: required bool success
+}
+
+struct TAlterSentryRoleAddGroupsRequest {
+1: required TSentryPolicyServiceVersion protocol_version = TSentryPolicyServiceVersion.V1,
+2: required string userName,
+3: required string roleName,
+4: required set<TSentryGroup> groups
+}
+struct TAlterSentryRoleAddGroupsResponse {
+1: required bool success
+}
+
+struct TAlterSentryRoleDeleteGroupsRequest {
+1: required TSentryPolicyServiceVersion protocol_version = TSentryPolicyServiceVersion.V1,
+2: required string userName,
+}
+struct TAlterSentryRoleDeleteGroupsResponse {
+1: required bool success
+}
+
+struct TListSentryRolesRequest {
+1: required TSentryPolicyServiceVersion protocol_version = TSentryPolicyServiceVersion.V1,
+2: required string userName,
+3: optional string groupName,
+4: optional string roleName
+}
+struct TListSentryRolesResponse {
+1: required bool success,
+2: required set<TSentryRole> roles
+}
+
+exception TSentryAlreadyExistsException {
+ 1: string message
+}
+
+exception TSentryNoSuchObjectException {
+ 1: string message
+}
+
+service SentryThriftPolicyService
+{
+ TCreateSentryRoleResponse create_sentry_role(1:TCreateSentryRoleRequest request) throws (1:TSentryAlreadyExistsException o1)
+ //TDropSentryRoleResponse drop_sentry_role(1:TDropSentryRoleRequest request) throws (1:TSentryNoSuchObjectException o1)
+
+ TCreateSentryPrivilegeResponse create_sentry_privilege(1:TCreateSentryPrivilegeRequest request) throws (1:TSentryAlreadyExistsException o1)
+ //TDropSentryPrivilegeResponse drop_sentry_privilege(1:TDropSentryPrivilegeRequest request) throws (1:TSentryNoSuchObjectException o1)
+
+ TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(1:TAlterSentryRoleAddGroupsRequest request) throws (1:TSentryNoSuchObjectException o1)
+ TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(1:TAlterSentryRoleDeleteGroupsRequest request) throws (1:TSentryNoSuchObjectException o1)
+
+ TListSentryRolesResponse list_sentry_roles(1:TListSentryRolesRequest request) throws (1:TSentryNoSuchObjectException o1)
+}
[6/7] SENTRY-76 - Create basic thrift infrastructure for policy
service (Shreepadma via Brock)
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/SentryThriftPolicyService.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/SentryThriftPolicyService.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/SentryThriftPolicyService.java
new file mode 100644
index 0000000..c3af9d9
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/SentryThriftPolicyService.java
@@ -0,0 +1,4695 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.policystore.api;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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 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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SentryThriftPolicyService {
+
+ public interface Iface {
+
+ public TCreateSentryRoleResponse create_sentry_role(TCreateSentryRoleRequest request) throws TSentryAlreadyExistsException, org.apache.thrift.TException;
+
+ public TCreateSentryPrivilegeResponse create_sentry_privilege(TCreateSentryPrivilegeRequest request) throws TSentryAlreadyExistsException, org.apache.thrift.TException;
+
+ public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request) throws TSentryNoSuchObjectException, org.apache.thrift.TException;
+
+ public TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request) throws TSentryNoSuchObjectException, org.apache.thrift.TException;
+
+ public TListSentryRolesResponse list_sentry_roles(TListSentryRolesRequest request) throws TSentryNoSuchObjectException, org.apache.thrift.TException;
+
+ }
+
+ public interface AsyncIface {
+
+ public void create_sentry_role(TCreateSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.create_sentry_role_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void create_sentry_privilege(TCreateSentryPrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.create_sentry_privilege_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.alter_sentry_role_add_groups_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.alter_sentry_role_delete_groups_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void list_sentry_roles(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.list_sentry_roles_call> 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 TSentryAlreadyExistsException, 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 TSentryAlreadyExistsException, 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;
+ }
+ if (result.o1 != null) {
+ throw result.o1;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "create_sentry_role failed: unknown result");
+ }
+
+ public TCreateSentryPrivilegeResponse create_sentry_privilege(TCreateSentryPrivilegeRequest request) throws TSentryAlreadyExistsException, org.apache.thrift.TException
+ {
+ send_create_sentry_privilege(request);
+ return recv_create_sentry_privilege();
+ }
+
+ public void send_create_sentry_privilege(TCreateSentryPrivilegeRequest request) throws org.apache.thrift.TException
+ {
+ create_sentry_privilege_args args = new create_sentry_privilege_args();
+ args.setRequest(request);
+ sendBase("create_sentry_privilege", args);
+ }
+
+ public TCreateSentryPrivilegeResponse recv_create_sentry_privilege() throws TSentryAlreadyExistsException, org.apache.thrift.TException
+ {
+ create_sentry_privilege_result result = new create_sentry_privilege_result();
+ receiveBase(result, "create_sentry_privilege");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ if (result.o1 != null) {
+ throw result.o1;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "create_sentry_privilege failed: unknown result");
+ }
+
+ public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request) throws TSentryNoSuchObjectException, 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 TSentryNoSuchObjectException, 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;
+ }
+ if (result.o1 != null) {
+ throw result.o1;
+ }
+ 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 TSentryNoSuchObjectException, 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 TSentryNoSuchObjectException, 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;
+ }
+ if (result.o1 != null) {
+ throw result.o1;
+ }
+ 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(TListSentryRolesRequest request) throws TSentryNoSuchObjectException, org.apache.thrift.TException
+ {
+ send_list_sentry_roles(request);
+ return recv_list_sentry_roles();
+ }
+
+ public void send_list_sentry_roles(TListSentryRolesRequest request) throws org.apache.thrift.TException
+ {
+ list_sentry_roles_args args = new list_sentry_roles_args();
+ args.setRequest(request);
+ sendBase("list_sentry_roles", args);
+ }
+
+ public TListSentryRolesResponse recv_list_sentry_roles() throws TSentryNoSuchObjectException, org.apache.thrift.TException
+ {
+ list_sentry_roles_result result = new list_sentry_roles_result();
+ receiveBase(result, "list_sentry_roles");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ if (result.o1 != null) {
+ throw result.o1;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_roles 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<create_sentry_role_call> 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<create_sentry_role_call> 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 TSentryAlreadyExistsException, 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 create_sentry_privilege(TCreateSentryPrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback<create_sentry_privilege_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ create_sentry_privilege_call method_call = new create_sentry_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class create_sentry_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TCreateSentryPrivilegeRequest request;
+ public create_sentry_privilege_call(TCreateSentryPrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback<create_sentry_privilege_call> 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_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ create_sentry_privilege_args args = new create_sentry_privilege_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TCreateSentryPrivilegeResponse getResult() throws TSentryAlreadyExistsException, 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_privilege();
+ }
+ }
+
+ public void alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback<alter_sentry_role_add_groups_call> 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<alter_sentry_role_add_groups_call> 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 TSentryNoSuchObjectException, 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<alter_sentry_role_delete_groups_call> 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<alter_sentry_role_delete_groups_call> 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 TSentryNoSuchObjectException, 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(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_roles_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ list_sentry_roles_call method_call = new list_sentry_roles_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class list_sentry_roles_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TListSentryRolesRequest request;
+ public list_sentry_roles_call(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_roles_call> 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", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ list_sentry_roles_args args = new list_sentry_roles_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TListSentryRolesResponse getResult() throws TSentryNoSuchObjectException, 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();
+ }
+ }
+
+ }
+
+ 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("create_sentry_privilege", new create_sentry_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", new list_sentry_roles());
+ 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();
+ try {
+ result.success = iface.create_sentry_role(args.request);
+ } catch (TSentryAlreadyExistsException o1) {
+ result.o1 = o1;
+ }
+ return result;
+ }
+ }
+
+ public static class create_sentry_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, create_sentry_privilege_args> {
+ public create_sentry_privilege() {
+ super("create_sentry_privilege");
+ }
+
+ public create_sentry_privilege_args getEmptyArgsInstance() {
+ return new create_sentry_privilege_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public create_sentry_privilege_result getResult(I iface, create_sentry_privilege_args args) throws org.apache.thrift.TException {
+ create_sentry_privilege_result result = new create_sentry_privilege_result();
+ try {
+ result.success = iface.create_sentry_privilege(args.request);
+ } catch (TSentryAlreadyExistsException o1) {
+ result.o1 = o1;
+ }
+ 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();
+ try {
+ result.success = iface.alter_sentry_role_add_groups(args.request);
+ } catch (TSentryNoSuchObjectException o1) {
+ result.o1 = o1;
+ }
+ 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();
+ try {
+ result.success = iface.alter_sentry_role_delete_groups(args.request);
+ } catch (TSentryNoSuchObjectException o1) {
+ result.o1 = o1;
+ }
+ return result;
+ }
+ }
+
+ public static class list_sentry_roles<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_roles_args> {
+ public list_sentry_roles() {
+ super("list_sentry_roles");
+ }
+
+ public list_sentry_roles_args getEmptyArgsInstance() {
+ return new list_sentry_roles_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public list_sentry_roles_result getResult(I iface, list_sentry_roles_args args) throws org.apache.thrift.TException {
+ list_sentry_roles_result result = new list_sentry_roles_result();
+ try {
+ result.success = iface.list_sentry_roles(args.request);
+ } catch (TSentryNoSuchObjectException o1) {
+ result.o1 = o1;
+ }
+ return result;
+ }
+ }
+
+ }
+
+ public static class create_sentry_role_args implements org.apache.thrift.TBase<create_sentry_role_args, create_sentry_role_args._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("create_sentry_role_args");
+
+ private static final org.apache.thrift.protocol.TField REQUEST_FIELD_DESC = new org.apache.thrift.protocol.TField("request", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new create_sentry_role_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new create_sentry_role_argsTupleSchemeFactory());
+ }
+
+ private TCreateSentryRoleRequest request; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ REQUEST((short)1, "request");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // REQUEST
+ return REQUEST;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.REQUEST, new org.apache.thrift.meta_data.FieldMetaData("request", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TCreateSentryRoleRequest.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(create_sentry_role_args.class, metaDataMap);
+ }
+
+ public create_sentry_role_args() {
+ }
+
+ public create_sentry_role_args(
+ TCreateSentryRoleRequest request)
+ {
+ this();
+ this.request = request;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public create_sentry_role_args(create_sentry_role_args other) {
+ if (other.isSetRequest()) {
+ this.request = new TCreateSentryRoleRequest(other.request);
+ }
+ }
+
+ public create_sentry_role_args deepCopy() {
+ return new create_sentry_role_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.request = null;
+ }
+
+ public TCreateSentryRoleRequest getRequest() {
+ return this.request;
+ }
+
+ public void setRequest(TCreateSentryRoleRequest request) {
+ this.request = request;
+ }
+
+ public void unsetRequest() {
+ this.request = null;
+ }
+
+ /** Returns true if field request is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequest() {
+ return this.request != null;
+ }
+
+ public void setRequestIsSet(boolean value) {
+ if (!value) {
+ this.request = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case REQUEST:
+ if (value == null) {
+ unsetRequest();
+ } else {
+ setRequest((TCreateSentryRoleRequest)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case REQUEST:
+ return getRequest();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case REQUEST:
+ return isSetRequest();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof create_sentry_role_args)
+ return this.equals((create_sentry_role_args)that);
+ return false;
+ }
+
+ public boolean equals(create_sentry_role_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_request = true && this.isSetRequest();
+ boolean that_present_request = true && that.isSetRequest();
+ if (this_present_request || that_present_request) {
+ if (!(this_present_request && that_present_request))
+ return false;
+ if (!this.request.equals(that.request))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_request = true && (isSetRequest());
+ builder.append(present_request);
+ if (present_request)
+ builder.append(request);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(create_sentry_role_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ create_sentry_role_args typedOther = (create_sentry_role_args)other;
+
+ lastComparison = Boolean.valueOf(isSetRequest()).compareTo(typedOther.isSetRequest());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequest()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.request, typedOther.request);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("create_sentry_role_args(");
+ boolean first = true;
+
+ sb.append("request:");
+ if (this.request == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.request);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (request != null) {
+ request.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class create_sentry_role_argsStandardSchemeFactory implements SchemeFactory {
+ public create_sentry_role_argsStandardScheme getScheme() {
+ return new create_sentry_role_argsStandardScheme();
+ }
+ }
+
+ private static class create_sentry_role_argsStandardScheme extends StandardScheme<create_sentry_role_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, create_sentry_role_args struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // REQUEST
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.request = new TCreateSentryRoleRequest();
+ struct.request.read(iprot);
+ struct.setRequestIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, create_sentry_role_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.request != null) {
+ oprot.writeFieldBegin(REQUEST_FIELD_DESC);
+ struct.request.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class create_sentry_role_argsTupleSchemeFactory implements SchemeFactory {
+ public create_sentry_role_argsTupleScheme getScheme() {
+ return new create_sentry_role_argsTupleScheme();
+ }
+ }
+
+ private static class create_sentry_role_argsTupleScheme extends TupleScheme<create_sentry_role_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, create_sentry_role_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetRequest()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetRequest()) {
+ struct.request.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, create_sentry_role_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.request = new TCreateSentryRoleRequest();
+ struct.request.read(iprot);
+ struct.setRequestIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class create_sentry_role_result implements org.apache.thrift.TBase<create_sentry_role_result, create_sentry_role_result._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("create_sentry_role_result");
+
+ private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
+ private static final org.apache.thrift.protocol.TField O1_FIELD_DESC = new org.apache.thrift.protocol.TField("o1", 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 create_sentry_role_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new create_sentry_role_resultTupleSchemeFactory());
+ }
+
+ private TCreateSentryRoleResponse success; // required
+ private TSentryAlreadyExistsException o1; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ SUCCESS((short)0, "success"),
+ O1((short)1, "o1");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 0: // SUCCESS
+ return SUCCESS;
+ case 1: // O1
+ return O1;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TCreateSentryRoleResponse.class)));
+ tmpMap.put(_Fields.O1, new org.apache.thrift.meta_data.FieldMetaData("o1", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(create_sentry_role_result.class, metaDataMap);
+ }
+
+ public create_sentry_role_result() {
+ }
+
+ public create_sentry_role_result(
+ TCreateSentryRoleResponse success,
+ TSentryAlreadyExistsException o1)
+ {
+ this();
+ this.success = success;
+ this.o1 = o1;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public create_sentry_role_result(create_sentry_role_result other) {
+ if (other.isSetSuccess()) {
+ this.success = new TCreateSentryRoleResponse(other.success);
+ }
+ if (other.isSetO1()) {
+ this.o1 = new TSentryAlreadyExistsException(other.o1);
+ }
+ }
+
+ public create_sentry_role_result deepCopy() {
+ return new create_sentry_role_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ this.o1 = null;
+ }
+
+ public TCreateSentryRoleResponse getSuccess() {
+ return this.success;
+ }
+
+ public void setSuccess(TCreateSentryRoleResponse success) {
+ this.success = success;
+ }
+
+ public void unsetSuccess() {
+ this.success = null;
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return this.success != null;
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ if (!value) {
+ this.success = null;
+ }
+ }
+
+ public TSentryAlreadyExistsException getO1() {
+ return this.o1;
+ }
+
+ public void setO1(TSentryAlreadyExistsException o1) {
+ this.o1 = o1;
+ }
+
+ public void unsetO1() {
+ this.o1 = null;
+ }
+
+ /** Returns true if field o1 is set (has been assigned a value) and false otherwise */
+ public boolean isSetO1() {
+ return this.o1 != null;
+ }
+
+ public void setO1IsSet(boolean value) {
+ if (!value) {
+ this.o1 = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((TCreateSentryRoleResponse)value);
+ }
+ break;
+
+ case O1:
+ if (value == null) {
+ unsetO1();
+ } else {
+ setO1((TSentryAlreadyExistsException)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return getSuccess();
+
+ case O1:
+ return getO1();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case SUCCESS:
+ return isSetSuccess();
+ case O1:
+ return isSetO1();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof create_sentry_role_result)
+ return this.equals((create_sentry_role_result)that);
+ return false;
+ }
+
+ public boolean equals(create_sentry_role_result that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true && this.isSetSuccess();
+ boolean that_present_success = true && that.isSetSuccess();
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (!this.success.equals(that.success))
+ return false;
+ }
+
+ boolean this_present_o1 = true && this.isSetO1();
+ boolean that_present_o1 = true && that.isSetO1();
+ if (this_present_o1 || that_present_o1) {
+ if (!(this_present_o1 && that_present_o1))
+ return false;
+ if (!this.o1.equals(that.o1))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_success = true && (isSetSuccess());
+ builder.append(present_success);
+ if (present_success)
+ builder.append(success);
+
+ boolean present_o1 = true && (isSetO1());
+ builder.append(present_o1);
+ if (present_o1)
+ builder.append(o1);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(create_sentry_role_result other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ create_sentry_role_result typedOther = (create_sentry_role_result)other;
+
+ lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSuccess()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetO1()).compareTo(typedOther.isSetO1());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetO1()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.o1, typedOther.o1);
+ 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("create_sentry_role_result(");
+ boolean first = true;
+
+ sb.append("success:");
+ if (this.success == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.success);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("o1:");
+ if (this.o1 == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.o1);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (success != null) {
+ success.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class create_sentry_role_resultStandardSchemeFactory implements SchemeFactory {
+ public create_sentry_role_resultStandardScheme getScheme() {
+ return new create_sentry_role_resultStandardScheme();
+ }
+ }
+
+ private static class create_sentry_role_resultStandardScheme extends StandardScheme<create_sentry_role_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, create_sentry_role_result struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 0: // SUCCESS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.success = new TCreateSentryRoleResponse();
+ struct.success.read(iprot);
+ struct.setSuccessIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 1: // O1
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.o1 = new TSentryAlreadyExistsException();
+ struct.o1.read(iprot);
+ struct.setO1IsSet(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, create_sentry_role_result struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.success != null) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ struct.success.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.o1 != null) {
+ oprot.writeFieldBegin(O1_FIELD_DESC);
+ struct.o1.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class create_sentry_role_resultTupleSchemeFactory implements SchemeFactory {
+ public create_sentry_role_resultTupleScheme getScheme() {
+ return new create_sentry_role_resultTupleScheme();
+ }
+ }
+
+ private static class create_sentry_role_resultTupleScheme extends TupleScheme<create_sentry_role_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, create_sentry_role_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetSuccess()) {
+ optionals.set(0);
+ }
+ if (struct.isSetO1()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetSuccess()) {
+ struct.success.write(oprot);
+ }
+ if (struct.isSetO1()) {
+ struct.o1.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, create_sentry_role_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct.success = new TCreateSentryRoleResponse();
+ struct.success.read(iprot);
+ struct.setSuccessIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.o1 = new TSentryAlreadyExistsException();
+ struct.o1.read(iprot);
+ struct.setO1IsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class create_sentry_privilege_args implements org.apache.thrift.TBase<create_sentry_privilege_args, create_sentry_privilege_args._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("create_sentry_privilege_args");
+
+ private static final org.apache.thrift.protocol.TField REQUEST_FIELD_DESC = new org.apache.thrift.protocol.TField("request", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new create_sentry_privilege_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new create_sentry_privilege_argsTupleSchemeFactory());
+ }
+
+ private TCreateSentryPrivilegeRequest request; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ REQUEST((short)1, "request");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // REQUEST
+ return REQUEST;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.REQUEST, new org.apache.thrift.meta_data.FieldMetaData("request", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TCreateSentryPrivilegeRequest.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(create_sentry_privilege_args.class, metaDataMap);
+ }
+
+ public create_sentry_privilege_args() {
+ }
+
+ public create_sentry_privilege_args(
+ TCreateSentryPrivilegeRequest request)
+ {
+ this();
+ this.request = request;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public create_sentry_privilege_args(create_sentry_privilege_args other) {
+ if (other.isSetRequest()) {
+ this.request = new TCreateSentryPrivilegeRequest(other.request);
+ }
+ }
+
+ public create_sentry_privilege_args deepCopy() {
+ return new create_sentry_privilege_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.request = null;
+ }
+
+ public TCreateSentryPrivilegeRequest getRequest() {
+ return this.request;
+ }
+
+ public void setRequest(TCreateSentryPrivilegeRequest request) {
+ this.request = request;
+ }
+
+ public void unsetRequest() {
+ this.request = null;
+ }
+
+ /** Returns true if field request is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequest() {
+ return this.request != null;
+ }
+
+ public void setRequestIsSet(boolean value) {
+ if (!value) {
+ this.request = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case REQUEST:
+ if (value == null) {
+ unsetRequest();
+ } else {
+ setRequest((TCreateSentryPrivilegeRequest)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case REQUEST:
+ return getRequest();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case REQUEST:
+ return isSetRequest();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof create_sentry_privilege_args)
+ return this.equals((create_sentry_privilege_args)that);
+ return false;
+ }
+
+ public boolean equals(create_sentry_privilege_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_request = true && this.isSetRequest();
+ boolean that_present_request = true && that.isSetRequest();
+ if (this_present_request || that_present_request) {
+ if (!(this_present_request && that_present_request))
+ return false;
+ if (!this.request.equals(that.request))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_request = true && (isSetRequest());
+ builder.append(present_request);
+ if (present_request)
+ builder.append(request);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(create_sentry_privilege_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ create_sentry_privilege_args typedOther = (create_sentry_privilege_args)other;
+
+ lastComparison = Boolean.valueOf(isSetRequest()).compareTo(typedOther.isSetRequest());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequest()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.request, typedOther.request);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("create_sentry_privilege_args(");
+ boolean first = true;
+
+ sb.append("request:");
+ if (this.request == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.request);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (request != null) {
+ request.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class create_sentry_privilege_argsStandardSchemeFactory implements SchemeFactory {
+ public create_sentry_privilege_argsStandardScheme getScheme() {
+ return new create_sentry_privilege_argsStandardScheme();
+ }
+ }
+
+ private static class create_sentry_privilege_argsStandardScheme extends StandardScheme<create_sentry_privilege_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, create_sentry_privilege_args struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // REQUEST
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.request = new TCreateSentryPrivilegeRequest();
+ struct.request.read(iprot);
+ struct.setRequestIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, create_sentry_privilege_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.request != null) {
+ oprot.writeFieldBegin(REQUEST_FIELD_DESC);
+ struct.request.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class create_sentry_privilege_argsTupleSchemeFactory implements SchemeFactory {
+ public create_sentry_privilege_argsTupleScheme getScheme() {
+ return new create_sentry_privilege_argsTupleScheme();
+ }
+ }
+
+ private static class create_sentry_privilege_argsTupleScheme extends TupleScheme<create_sentry_privilege_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, create_sentry_privilege_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetRequest()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetRequest()) {
+ struct.request.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, create_sentry_privilege_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.request = new TCreateSentryPrivilegeRequest();
+ struct.request.read(iprot);
+ struct.setRequestIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class create_sentry_privilege_result implements org.apache.thrift.TBase<create_sentry_privilege_result, create_sentry_privilege_result._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("create_sentry_privilege_result");
+
+ private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
+ private static final org.apache.thrift.protocol.TField O1_FIELD_DESC = new org.apache.thrift.protocol.TField("o1", 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 create_sentry_privilege_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new create_sentry_privilege_resultTupleSchemeFactory());
+ }
+
+ private TCreateSentryPrivilegeResponse success; // required
+ private TSentryAlreadyExistsException o1; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ SUCCESS((short)0, "success"),
+ O1((short)1, "o1");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 0: // SUCCESS
+ return SUCCESS;
+ case 1: // O1
+ return O1;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TCreateSentryPrivilegeResponse.class)));
+ tmpMap.put(_Fields.O1, new org.apache.thrift.meta_data.FieldMetaData("o1", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(create_sentry_privilege_result.class, metaDataMap);
+ }
+
+ public create_sentry_privilege_result() {
+ }
+
+ public create_sentry_privilege_result(
+ TCreateSentryPrivilegeResponse success,
+ TSentryAlreadyExistsException o1)
+ {
+ this();
+ this.success = success;
+ this.o1 = o1;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public create_sentry_privilege_result(create_sentry_privilege_result other) {
+ if (other.isSetSuccess()) {
+ this.success = new TCreateSentryPrivilegeResponse(other.success);
+ }
+ if (other.isSetO1()) {
+ this.o1 = new TSentryAlreadyExistsException(other.o1);
+ }
+ }
+
+ public create_sentry_privilege_result deepCopy() {
+ return new create_sentry_privilege_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ this.o1 = null;
+ }
+
+ public TCreateSentryPrivilegeResponse getSuccess() {
+ return this.success;
+ }
+
+ public void setSuccess(TCreateSentryPrivilegeResponse success) {
+ this.success = success;
+ }
+
+ public void unsetSuccess() {
+ this.success = null;
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return this.success != null;
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ if (!value) {
+ this.success = null;
+ }
+ }
+
+ public TSentryAlreadyExistsException getO1() {
+ return this.o1;
+ }
+
+ public void setO1(TSentryAlreadyExistsException o1) {
+ this.o1 = o1;
+ }
+
+ public void unsetO1() {
+ this.o1 = null;
+ }
+
+ /** Returns true if field o1 is set (has been assigned a value) and false otherwise */
+ public boolean isSetO1() {
+ return this.o1 != null;
+ }
+
+ public void setO1IsSet(boolean value) {
+ if (!value) {
+ this.o1 = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((TCreateSentryPrivilegeResponse)value);
+ }
+ break;
+
+ case O1:
+ if (value == null) {
+ unsetO1();
+ } else {
+ setO1((TSentryAlreadyExistsException)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return getSuccess();
+
+ case O1:
+ return getO1();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case SUCCESS:
+ return isSetSuccess();
+ case O1:
+ return isSetO1();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof create_sentry_privilege_result)
+ return this.equals((create_sentry_privilege_result)that);
+ return false;
+ }
+
+ public boolean equals(create_sentry_privilege_result that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true && this.isSetSuccess();
+ boolean that_present_success = true && that.isSetSuccess();
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (!this.success.equals(that.success))
+ return false;
+ }
+
+ boolean this_present_o1 = true && this.isSetO1();
+ boolean that_present_o1 = true && that.isSetO1();
+ if (this_present_o1 || that_present_o1) {
+ if (!(this_present_o1 && that_present_o1))
+ return false;
+ if (!this.o1.equals(that.o1))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_success = true && (isSetSuccess());
+ builder.append(present_success);
+ if (present_success)
+ builder.append(success);
+
+ boolean present_o1 = true && (isSetO1());
+ builder.append(present_o1);
+ if (present_o1)
+ builder.append(o1);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(create_sentry_privilege_result other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ create_sentry_privilege_result typedOther = (create_sentry_privilege_result)other;
+
+ lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSuccess()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetO1()).compareTo(typedOther.isSetO1());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetO1()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.o1, typedOther.o1);
+ 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("create_sentry_privilege_result(");
+ boolean first = true;
+
+ sb.append("success:");
+ if (this.success == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.success);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("o1:");
+ if (this.o1 == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.o1);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (success != null) {
+ success.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class create_sentry_privilege_resultStandardSchemeFactory implements SchemeFactory {
+ public create_sentry_privilege_resultStandardScheme getScheme() {
+ return new create_sentry_privilege_resultStandardScheme();
+ }
+ }
+
+ private static class create_sentry_privilege_resultStandardScheme extends StandardScheme<create_sentry_privilege_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, create_sentry_privilege_result struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 0: // SUCCESS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.success = new TCreateSentryPrivilegeResponse();
+ struct.success.read(iprot);
+ struct.setSuccessIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 1: // O1
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.o1 = new TSentryAlreadyExistsException();
+ struct.o1.read(iprot);
+ struct.setO1IsSet(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, create_sentry_privilege_result struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.success != null) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ struct.success.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.o1 != null) {
+ oprot.writeFieldBegin(O1_FIELD_DESC);
+ struct.o1.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class create_sentry_privilege_resultTupleSchemeFactory implements SchemeFactory {
+ public create_sentry_privilege_resultTupleScheme getScheme() {
+ return new create_sentry_privilege_resultTupleScheme();
+ }
+ }
+
+ private static class create_sentry_privilege_resultTupleScheme extends TupleScheme<create_sentry_privilege_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, create_sentry_privilege_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetSuccess()) {
+ optionals.set(0);
+ }
+ if (struct.isSetO1()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetSuccess()) {
+ struct.success.write(oprot);
+ }
+ if (struct.isSetO1()) {
+ struct.o1.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, create_sentry_privilege_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct.success = new TCreateSentryPrivilegeResponse();
+ struct.success.read(iprot);
+ struct.setSuccessIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.o1 = new TSentryAlreadyExistsException();
+ struct.o1.read(iprot);
+ struct.setO1IsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class alter_sentry_role_add_groups_args implements org.apache.thrift.TBase<alter_sentry_role_add_groups_args, alter_sentry_role_add_groups_args._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("alter_sentry_role_add_groups_args");
+
+ private static final org.apache.thrift.protocol.TField REQUEST_FIELD_DESC = new org.apache.thrift.protocol.TField("request", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new alter_sentry_role_add_groups_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new alter_sentry_role_add_groups_argsTupleSchemeFactory());
+ }
+
+ private TAlterSentryRoleAddGroupsRequest request; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ REQUEST((short)1, "request");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // REQUEST
+ return REQUEST;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.REQUEST, new org.apache.thrift.meta_data.FieldMetaData("request", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAlterSentryRoleAddGroupsRequest.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(alter_sentry_role_add_groups_args.class, metaDataMap);
+ }
+
+ public alter_sentry_role_add_groups_args() {
+ }
+
+ public alter_sentry_role_add_groups_args(
+ TAlterSentryRoleAddGroupsRequest request)
+ {
+ this();
+ this.request = request;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public alter_sentry_role_add_groups_args(alter_sentry_role_add_groups_args other) {
+ if (other.isSetRequest()) {
+ this.request = new TAlterSentryRoleAddGroupsRequest(other.request);
+ }
+ }
+
+ public alter_sentry_role_add_groups_args deepCopy() {
+ return new alter_sentry_role_add_groups_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.request = null;
+ }
+
+ public TAlterSentryRoleAddGroupsRequest getRequest() {
+ return this.request;
+ }
+
+ public void setRequest(TAlterSentryRoleAddGroupsRequest request) {
+ this.request = request;
+ }
+
+ public void unsetRequest() {
+ this.request = null;
+ }
+
+ /** Returns true if field request is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequest() {
+ return this.requ
<TRUNCATED>
[3/7] SENTRY-76 - Create basic thrift infrastructure for policy
service (Shreepadma via Brock)
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TListSentryRolesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TListSentryRolesRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TListSentryRolesRequest.java
new file mode 100644
index 0000000..123daef
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TListSentryRolesRequest.java
@@ -0,0 +1,717 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.policystore.api;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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 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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSentryRolesRequest, TListSentryRolesRequest._Fields>, java.io.Serializable, Cloneable {
+ 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 USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", 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 ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", 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 TSentryPolicyServiceVersion protocol_version; // required
+ private String userName; // required
+ private String groupName; // optional
+ private String roleName; // 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 {
+ /**
+ *
+ * @see TSentryPolicyServiceVersion
+ */
+ PROTOCOL_VERSION((short)1, "protocol_version"),
+ USER_NAME((short)2, "userName"),
+ GROUP_NAME((short)3, "groupName"),
+ ROLE_NAME((short)4, "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: // USER_NAME
+ return USER_NAME;
+ case 3: // GROUP_NAME
+ return GROUP_NAME;
+ case 4: // 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 _Fields optionals[] = {_Fields.GROUP_NAME,_Fields.ROLE_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.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TSentryPolicyServiceVersion.class)));
+ 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)));
+ 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.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", 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 = org.apache.sentry.policystore.api.TSentryPolicyServiceVersion.V1;
+
+ }
+
+ public TListSentryRolesRequest(
+ TSentryPolicyServiceVersion protocol_version,
+ String userName)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ this.userName = userName;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TListSentryRolesRequest(TListSentryRolesRequest other) {
+ if (other.isSetProtocol_version()) {
+ this.protocol_version = other.protocol_version;
+ }
+ if (other.isSetUserName()) {
+ this.userName = other.userName;
+ }
+ if (other.isSetGroupName()) {
+ this.groupName = other.groupName;
+ }
+ if (other.isSetRoleName()) {
+ this.roleName = other.roleName;
+ }
+ }
+
+ public TListSentryRolesRequest deepCopy() {
+ return new TListSentryRolesRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = org.apache.sentry.policystore.api.TSentryPolicyServiceVersion.V1;
+
+ this.userName = null;
+ this.groupName = null;
+ this.roleName = null;
+ }
+
+ /**
+ *
+ * @see TSentryPolicyServiceVersion
+ */
+ public TSentryPolicyServiceVersion getProtocol_version() {
+ return this.protocol_version;
+ }
+
+ /**
+ *
+ * @see TSentryPolicyServiceVersion
+ */
+ public void setProtocol_version(TSentryPolicyServiceVersion protocol_version) {
+ this.protocol_version = protocol_version;
+ }
+
+ public void unsetProtocol_version() {
+ this.protocol_version = null;
+ }
+
+ /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
+ public boolean isSetProtocol_version() {
+ return this.protocol_version != null;
+ }
+
+ public void setProtocol_versionIsSet(boolean value) {
+ if (!value) {
+ this.protocol_version = 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 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 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((TSentryPolicyServiceVersion)value);
+ }
+ break;
+
+ case USER_NAME:
+ if (value == null) {
+ unsetUserName();
+ } else {
+ setUserName((String)value);
+ }
+ break;
+
+ case GROUP_NAME:
+ if (value == null) {
+ unsetGroupName();
+ } else {
+ setGroupName((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 USER_NAME:
+ return getUserName();
+
+ case GROUP_NAME:
+ return getGroupName();
+
+ 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 USER_NAME:
+ return isSetUserName();
+ case GROUP_NAME:
+ return isSetGroupName();
+ case ROLE_NAME:
+ return isSetRoleName();
+ }
+ 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 && this.isSetProtocol_version();
+ boolean that_present_protocol_version = true && that.isSetProtocol_version();
+ if (this_present_protocol_version || that_present_protocol_version) {
+ if (!(this_present_protocol_version && that_present_protocol_version))
+ return false;
+ if (!this.protocol_version.equals(that.protocol_version))
+ 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;
+ }
+
+ 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_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() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_protocol_version = true && (isSetProtocol_version());
+ builder.append(present_protocol_version);
+ if (present_protocol_version)
+ builder.append(protocol_version.getValue());
+
+ boolean present_userName = true && (isSetUserName());
+ builder.append(present_userName);
+ if (present_userName)
+ builder.append(userName);
+
+ boolean present_groupName = true && (isSetGroupName());
+ builder.append(present_groupName);
+ if (present_groupName)
+ builder.append(groupName);
+
+ boolean present_roleName = true && (isSetRoleName());
+ builder.append(present_roleName);
+ if (present_roleName)
+ builder.append(roleName);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TListSentryRolesRequest other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TListSentryRolesRequest typedOther = (TListSentryRolesRequest)other;
+
+ lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProtocol_version()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetUserName()).compareTo(typedOther.isSetUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userName, typedOther.userName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGroupName()).compareTo(typedOther.isSetGroupName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGroupName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groupName, typedOther.groupName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.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("TListSentryRolesRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ if (this.protocol_version == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.protocol_version);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("userName:");
+ if (this.userName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.userName);
+ }
+ 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 (isSetRoleName()) {
+ 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 (!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 {
+ 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 = TSentryPolicyServiceVersion.findByValue(iprot.readI32());
+ struct.setProtocol_versionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // 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;
+ 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: // 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, TListSentryRolesRequest struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.protocol_version != null) {
+ oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
+ oprot.writeI32(struct.protocol_version.getValue());
+ oprot.writeFieldEnd();
+ }
+ if (struct.userName != null) {
+ oprot.writeFieldBegin(USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.userName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.groupName != null) {
+ if (struct.isSetGroupName()) {
+ oprot.writeFieldBegin(GROUP_NAME_FIELD_DESC);
+ oprot.writeString(struct.groupName);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.roleName != null) {
+ if (struct.isSetRoleName()) {
+ oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
+ oprot.writeString(struct.roleName);
+ 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.getValue());
+ oprot.writeString(struct.userName);
+ BitSet optionals = new BitSet();
+ if (struct.isSetGroupName()) {
+ optionals.set(0);
+ }
+ if (struct.isSetRoleName()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetGroupName()) {
+ oprot.writeString(struct.groupName);
+ }
+ if (struct.isSetRoleName()) {
+ oprot.writeString(struct.roleName);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = TSentryPolicyServiceVersion.findByValue(iprot.readI32());
+ struct.setProtocol_versionIsSet(true);
+ struct.userName = iprot.readString();
+ struct.setUserNameIsSet(true);
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct.groupName = iprot.readString();
+ struct.setGroupNameIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TListSentryRolesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TListSentryRolesResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TListSentryRolesResponse.java
new file mode 100644
index 0000000..e669797
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TListSentryRolesResponse.java
@@ -0,0 +1,538 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.policystore.api;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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 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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TListSentryRolesResponse implements org.apache.thrift.TBase<TListSentryRolesResponse, TListSentryRolesResponse._Fields>, java.io.Serializable, Cloneable {
+ 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 SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", 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 TListSentryRolesResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TListSentryRolesResponseTupleSchemeFactory());
+ }
+
+ private boolean success; // required
+ private Set<TSentryRole> 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 {
+ SUCCESS((short)1, "success"),
+ 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: // SUCCESS
+ return SUCCESS;
+ 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 __SUCCESS_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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", 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.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(
+ boolean success,
+ Set<TSentryRole> roles)
+ {
+ this();
+ this.success = success;
+ setSuccessIsSet(true);
+ this.roles = roles;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TListSentryRolesResponse(TListSentryRolesResponse other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.success = other.success;
+ if (other.isSetRoles()) {
+ Set<TSentryRole> __this__roles = new HashSet<TSentryRole>();
+ 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() {
+ setSuccessIsSet(false);
+ this.success = false;
+ this.roles = null;
+ }
+
+ public boolean isSuccess() {
+ return this.success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ setSuccessIsSet(true);
+ }
+
+ public void unsetSuccess() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
+ }
+
+ 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 SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((Boolean)value);
+ }
+ break;
+
+ case ROLES:
+ if (value == null) {
+ unsetRoles();
+ } else {
+ setRoles((Set<TSentryRole>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return Boolean.valueOf(isSuccess());
+
+ 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 SUCCESS:
+ return isSetSuccess();
+ 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_success = true;
+ boolean that_present_success = true;
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (this.success != that.success)
+ 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() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_success = true;
+ builder.append(present_success);
+ if (present_success)
+ builder.append(success);
+
+ boolean present_roles = true && (isSetRoles());
+ builder.append(present_roles);
+ if (present_roles)
+ builder.append(roles);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TListSentryRolesResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TListSentryRolesResponse typedOther = (TListSentryRolesResponse)other;
+
+ lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSuccess()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoles()).compareTo(typedOther.isSetRoles());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoles()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roles, typedOther.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("success:");
+ sb.append(this.success);
+ 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 (!isSetSuccess()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'success' 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 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: // SUCCESS
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.success = iprot.readBool();
+ struct.setSuccessIsSet(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 _set16 = iprot.readSetBegin();
+ struct.roles = new HashSet<TSentryRole>(2*_set16.size);
+ for (int _i17 = 0; _i17 < _set16.size; ++_i17)
+ {
+ TSentryRole _elem18; // required
+ _elem18 = new TSentryRole();
+ _elem18.read(iprot);
+ struct.roles.add(_elem18);
+ }
+ 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);
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ oprot.writeBool(struct.success);
+ oprot.writeFieldEnd();
+ if (struct.roles != null) {
+ oprot.writeFieldBegin(ROLES_FIELD_DESC);
+ {
+ oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.roles.size()));
+ for (TSentryRole _iter19 : struct.roles)
+ {
+ _iter19.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;
+ oprot.writeBool(struct.success);
+ {
+ oprot.writeI32(struct.roles.size());
+ for (TSentryRole _iter20 : struct.roles)
+ {
+ _iter20.write(oprot);
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.success = iprot.readBool();
+ struct.setSuccessIsSet(true);
+ {
+ org.apache.thrift.protocol.TSet _set21 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.roles = new HashSet<TSentryRole>(2*_set21.size);
+ for (int _i22 = 0; _i22 < _set21.size; ++_i22)
+ {
+ TSentryRole _elem23; // required
+ _elem23 = new TSentryRole();
+ _elem23.read(iprot);
+ struct.roles.add(_elem23);
+ }
+ }
+ struct.setRolesIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryAlreadyExistsException.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryAlreadyExistsException.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryAlreadyExistsException.java
new file mode 100644
index 0000000..59a8b54
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryAlreadyExistsException.java
@@ -0,0 +1,391 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.policystore.api;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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 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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TSentryAlreadyExistsException extends TException implements org.apache.thrift.TBase<TSentryAlreadyExistsException, TSentryAlreadyExistsException._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryAlreadyExistsException");
+
+ 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)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TSentryAlreadyExistsExceptionStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TSentryAlreadyExistsExceptionTupleSchemeFactory());
+ }
+
+ private String message; // 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 {
+ MESSAGE((short)1, "message");
+
+ 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: // MESSAGE
+ return MESSAGE;
+ 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.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryAlreadyExistsException.class, metaDataMap);
+ }
+
+ public TSentryAlreadyExistsException() {
+ }
+
+ public TSentryAlreadyExistsException(
+ String message)
+ {
+ this();
+ this.message = message;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TSentryAlreadyExistsException(TSentryAlreadyExistsException other) {
+ if (other.isSetMessage()) {
+ this.message = other.message;
+ }
+ }
+
+ public TSentryAlreadyExistsException deepCopy() {
+ return new TSentryAlreadyExistsException(this);
+ }
+
+ @Override
+ public void clear() {
+ this.message = null;
+ }
+
+ 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 void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case MESSAGE:
+ if (value == null) {
+ unsetMessage();
+ } else {
+ setMessage((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case MESSAGE:
+ return getMessage();
+
+ }
+ 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 MESSAGE:
+ return isSetMessage();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TSentryAlreadyExistsException)
+ return this.equals((TSentryAlreadyExistsException)that);
+ return false;
+ }
+
+ public boolean equals(TSentryAlreadyExistsException that) {
+ if (that == null)
+ 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;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_message = true && (isSetMessage());
+ builder.append(present_message);
+ if (present_message)
+ builder.append(message);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TSentryAlreadyExistsException other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TSentryAlreadyExistsException typedOther = (TSentryAlreadyExistsException)other;
+
+ lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetMessage()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, typedOther.message);
+ 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("TSentryAlreadyExistsException(");
+ boolean first = true;
+
+ sb.append("message:");
+ if (this.message == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.message);
+ }
+ 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 TSentryAlreadyExistsExceptionStandardSchemeFactory implements SchemeFactory {
+ public TSentryAlreadyExistsExceptionStandardScheme getScheme() {
+ return new TSentryAlreadyExistsExceptionStandardScheme();
+ }
+ }
+
+ private static class TSentryAlreadyExistsExceptionStandardScheme extends StandardScheme<TSentryAlreadyExistsException> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryAlreadyExistsException 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: // 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;
+ 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, TSentryAlreadyExistsException struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.message != null) {
+ oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
+ oprot.writeString(struct.message);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TSentryAlreadyExistsExceptionTupleSchemeFactory implements SchemeFactory {
+ public TSentryAlreadyExistsExceptionTupleScheme getScheme() {
+ return new TSentryAlreadyExistsExceptionTupleScheme();
+ }
+ }
+
+ private static class TSentryAlreadyExistsExceptionTupleScheme extends TupleScheme<TSentryAlreadyExistsException> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TSentryAlreadyExistsException struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetMessage()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetMessage()) {
+ oprot.writeString(struct.message);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TSentryAlreadyExistsException struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.message = iprot.readString();
+ struct.setMessageIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryGroup.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryGroup.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryGroup.java
new file mode 100644
index 0000000..b87d456
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryGroup.java
@@ -0,0 +1,385 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.policystore.api;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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 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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TSentryGroup implements org.apache.thrift.TBase<TSentryGroup, TSentryGroup._Fields>, java.io.Serializable, Cloneable {
+ 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() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_groupName = true && (isSetGroupName());
+ builder.append(present_groupName);
+ if (present_groupName)
+ builder.append(groupName);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TSentryGroup other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TSentryGroup typedOther = (TSentryGroup)other;
+
+ lastComparison = Boolean.valueOf(isSetGroupName()).compareTo(typedOther.isSetGroupName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGroupName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groupName, typedOther.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/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryNoSuchObjectException.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryNoSuchObjectException.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryNoSuchObjectException.java
new file mode 100644
index 0000000..dea44c3
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryNoSuchObjectException.java
@@ -0,0 +1,391 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.policystore.api;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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 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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TSentryNoSuchObjectException extends TException implements org.apache.thrift.TBase<TSentryNoSuchObjectException, TSentryNoSuchObjectException._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryNoSuchObjectException");
+
+ 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)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TSentryNoSuchObjectExceptionStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TSentryNoSuchObjectExceptionTupleSchemeFactory());
+ }
+
+ private String message; // 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 {
+ MESSAGE((short)1, "message");
+
+ 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: // MESSAGE
+ return MESSAGE;
+ 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.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryNoSuchObjectException.class, metaDataMap);
+ }
+
+ public TSentryNoSuchObjectException() {
+ }
+
+ public TSentryNoSuchObjectException(
+ String message)
+ {
+ this();
+ this.message = message;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TSentryNoSuchObjectException(TSentryNoSuchObjectException other) {
+ if (other.isSetMessage()) {
+ this.message = other.message;
+ }
+ }
+
+ public TSentryNoSuchObjectException deepCopy() {
+ return new TSentryNoSuchObjectException(this);
+ }
+
+ @Override
+ public void clear() {
+ this.message = null;
+ }
+
+ 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 void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case MESSAGE:
+ if (value == null) {
+ unsetMessage();
+ } else {
+ setMessage((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case MESSAGE:
+ return getMessage();
+
+ }
+ 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 MESSAGE:
+ return isSetMessage();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TSentryNoSuchObjectException)
+ return this.equals((TSentryNoSuchObjectException)that);
+ return false;
+ }
+
+ public boolean equals(TSentryNoSuchObjectException that) {
+ if (that == null)
+ 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;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_message = true && (isSetMessage());
+ builder.append(present_message);
+ if (present_message)
+ builder.append(message);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TSentryNoSuchObjectException other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TSentryNoSuchObjectException typedOther = (TSentryNoSuchObjectException)other;
+
+ lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetMessage()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, typedOther.message);
+ 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("TSentryNoSuchObjectException(");
+ boolean first = true;
+
+ sb.append("message:");
+ if (this.message == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.message);
+ }
+ 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 TSentryNoSuchObjectExceptionStandardSchemeFactory implements SchemeFactory {
+ public TSentryNoSuchObjectExceptionStandardScheme getScheme() {
+ return new TSentryNoSuchObjectExceptionStandardScheme();
+ }
+ }
+
+ private static class TSentryNoSuchObjectExceptionStandardScheme extends StandardScheme<TSentryNoSuchObjectException> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryNoSuchObjectException 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: // 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;
+ 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, TSentryNoSuchObjectException struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.message != null) {
+ oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
+ oprot.writeString(struct.message);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TSentryNoSuchObjectExceptionTupleSchemeFactory implements SchemeFactory {
+ public TSentryNoSuchObjectExceptionTupleScheme getScheme() {
+ return new TSentryNoSuchObjectExceptionTupleScheme();
+ }
+ }
+
+ private static class TSentryNoSuchObjectExceptionTupleScheme extends TupleScheme<TSentryNoSuchObjectException> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TSentryNoSuchObjectException struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetMessage()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetMessage()) {
+ oprot.writeString(struct.message);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TSentryNoSuchObjectException struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.message = iprot.readString();
+ struct.setMessageIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryPolicyServiceVersion.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryPolicyServiceVersion.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryPolicyServiceVersion.java
new file mode 100644
index 0000000..9c870ef
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryPolicyServiceVersion.java
@@ -0,0 +1,42 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.policystore.api;
+
+
+import java.util.Map;
+import java.util.HashMap;
+import org.apache.thrift.TEnum;
+
+public enum TSentryPolicyServiceVersion implements org.apache.thrift.TEnum {
+ V1(0);
+
+ private final int value;
+
+ private TSentryPolicyServiceVersion(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 TSentryPolicyServiceVersion findByValue(int value) {
+ switch (value) {
+ case 0:
+ return V1;
+ default:
+ return null;
+ }
+ }
+}
[5/7] SENTRY-76 - Create basic thrift infrastructure for policy
service (Shreepadma via Brock)
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TAlterSentryRoleAddGroupsRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TAlterSentryRoleAddGroupsRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TAlterSentryRoleAddGroupsRequest.java
new file mode 100644
index 0000000..0960897
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TAlterSentryRoleAddGroupsRequest.java
@@ -0,0 +1,757 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.policystore.api;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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 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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TAlterSentryRoleAddGroupsRequest implements org.apache.thrift.TBase<TAlterSentryRoleAddGroupsRequest, TAlterSentryRoleAddGroupsRequest._Fields>, java.io.Serializable, Cloneable {
+ 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 USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", 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)4);
+
+ 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 TSentryPolicyServiceVersion protocol_version; // required
+ private String userName; // 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 {
+ /**
+ *
+ * @see TSentryPolicyServiceVersion
+ */
+ PROTOCOL_VERSION((short)1, "protocol_version"),
+ USER_NAME((short)2, "userName"),
+ ROLE_NAME((short)3, "roleName"),
+ GROUPS((short)4, "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: // USER_NAME
+ return USER_NAME;
+ case 3: // ROLE_NAME
+ return ROLE_NAME;
+ case 4: // 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.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TSentryPolicyServiceVersion.class)));
+ 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)));
+ 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 = org.apache.sentry.policystore.api.TSentryPolicyServiceVersion.V1;
+
+ }
+
+ public TAlterSentryRoleAddGroupsRequest(
+ TSentryPolicyServiceVersion protocol_version,
+ String userName,
+ String roleName,
+ Set<TSentryGroup> groups)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ this.userName = userName;
+ this.roleName = roleName;
+ this.groups = groups;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleAddGroupsRequest(TAlterSentryRoleAddGroupsRequest other) {
+ if (other.isSetProtocol_version()) {
+ this.protocol_version = other.protocol_version;
+ }
+ if (other.isSetUserName()) {
+ this.userName = other.userName;
+ }
+ if (other.isSetRoleName()) {
+ this.roleName = other.roleName;
+ }
+ if (other.isSetGroups()) {
+ Set<TSentryGroup> __this__groups = new HashSet<TSentryGroup>();
+ 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 = org.apache.sentry.policystore.api.TSentryPolicyServiceVersion.V1;
+
+ this.userName = null;
+ this.roleName = null;
+ this.groups = null;
+ }
+
+ /**
+ *
+ * @see TSentryPolicyServiceVersion
+ */
+ public TSentryPolicyServiceVersion getProtocol_version() {
+ return this.protocol_version;
+ }
+
+ /**
+ *
+ * @see TSentryPolicyServiceVersion
+ */
+ public void setProtocol_version(TSentryPolicyServiceVersion protocol_version) {
+ this.protocol_version = protocol_version;
+ }
+
+ public void unsetProtocol_version() {
+ this.protocol_version = null;
+ }
+
+ /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
+ public boolean isSetProtocol_version() {
+ return this.protocol_version != null;
+ }
+
+ public void setProtocol_versionIsSet(boolean value) {
+ if (!value) {
+ this.protocol_version = 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 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((TSentryPolicyServiceVersion)value);
+ }
+ break;
+
+ case USER_NAME:
+ if (value == null) {
+ unsetUserName();
+ } else {
+ setUserName((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 USER_NAME:
+ return getUserName();
+
+ 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 USER_NAME:
+ return isSetUserName();
+ 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 && this.isSetProtocol_version();
+ boolean that_present_protocol_version = true && that.isSetProtocol_version();
+ if (this_present_protocol_version || that_present_protocol_version) {
+ if (!(this_present_protocol_version && that_present_protocol_version))
+ return false;
+ if (!this.protocol_version.equals(that.protocol_version))
+ 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;
+ }
+
+ 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() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_protocol_version = true && (isSetProtocol_version());
+ builder.append(present_protocol_version);
+ if (present_protocol_version)
+ builder.append(protocol_version.getValue());
+
+ boolean present_userName = true && (isSetUserName());
+ builder.append(present_userName);
+ if (present_userName)
+ builder.append(userName);
+
+ boolean present_roleName = true && (isSetRoleName());
+ builder.append(present_roleName);
+ if (present_roleName)
+ builder.append(roleName);
+
+ boolean present_groups = true && (isSetGroups());
+ builder.append(present_groups);
+ if (present_groups)
+ builder.append(groups);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TAlterSentryRoleAddGroupsRequest other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TAlterSentryRoleAddGroupsRequest typedOther = (TAlterSentryRoleAddGroupsRequest)other;
+
+ lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProtocol_version()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetUserName()).compareTo(typedOther.isSetUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userName, typedOther.userName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGroups()).compareTo(typedOther.isSetGroups());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGroups()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, typedOther.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:");
+ if (this.protocol_version == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.protocol_version);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("userName:");
+ if (this.userName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.userName);
+ }
+ 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 (!isSetUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'userName' 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 {
+ 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 = TSentryPolicyServiceVersion.findByValue(iprot.readI32());
+ struct.setProtocol_versionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // 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;
+ 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: // GROUPS
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set8 = iprot.readSetBegin();
+ struct.groups = new HashSet<TSentryGroup>(2*_set8.size);
+ for (int _i9 = 0; _i9 < _set8.size; ++_i9)
+ {
+ TSentryGroup _elem10; // required
+ _elem10 = new TSentryGroup();
+ _elem10.read(iprot);
+ struct.groups.add(_elem10);
+ }
+ 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);
+ if (struct.protocol_version != null) {
+ oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
+ oprot.writeI32(struct.protocol_version.getValue());
+ oprot.writeFieldEnd();
+ }
+ if (struct.userName != null) {
+ oprot.writeFieldBegin(USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.userName);
+ 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 _iter11 : struct.groups)
+ {
+ _iter11.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.getValue());
+ oprot.writeString(struct.userName);
+ oprot.writeString(struct.roleName);
+ {
+ oprot.writeI32(struct.groups.size());
+ for (TSentryGroup _iter12 : struct.groups)
+ {
+ _iter12.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 = TSentryPolicyServiceVersion.findByValue(iprot.readI32());
+ struct.setProtocol_versionIsSet(true);
+ struct.userName = iprot.readString();
+ struct.setUserNameIsSet(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.STRUCT, iprot.readI32());
+ struct.groups = new HashSet<TSentryGroup>(2*_set13.size);
+ for (int _i14 = 0; _i14 < _set13.size; ++_i14)
+ {
+ TSentryGroup _elem15; // required
+ _elem15 = new TSentryGroup();
+ _elem15.read(iprot);
+ struct.groups.add(_elem15);
+ }
+ }
+ struct.setGroupsIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TAlterSentryRoleAddGroupsResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TAlterSentryRoleAddGroupsResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TAlterSentryRoleAddGroupsResponse.java
new file mode 100644
index 0000000..d52618d
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TAlterSentryRoleAddGroupsResponse.java
@@ -0,0 +1,383 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.policystore.api;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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 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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TAlterSentryRoleAddGroupsResponse implements org.apache.thrift.TBase<TAlterSentryRoleAddGroupsResponse, TAlterSentryRoleAddGroupsResponse._Fields>, java.io.Serializable, Cloneable {
+ 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 SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (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 boolean success; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ SUCCESS((short)1, "success");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // SUCCESS
+ return SUCCESS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __SUCCESS_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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleAddGroupsResponse.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleAddGroupsResponse() {
+ }
+
+ public TAlterSentryRoleAddGroupsResponse(
+ boolean success)
+ {
+ this();
+ this.success = success;
+ setSuccessIsSet(true);
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleAddGroupsResponse(TAlterSentryRoleAddGroupsResponse other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.success = other.success;
+ }
+
+ public TAlterSentryRoleAddGroupsResponse deepCopy() {
+ return new TAlterSentryRoleAddGroupsResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ setSuccessIsSet(false);
+ this.success = false;
+ }
+
+ public boolean isSuccess() {
+ return this.success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ setSuccessIsSet(true);
+ }
+
+ public void unsetSuccess() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((Boolean)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return Boolean.valueOf(isSuccess());
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case SUCCESS:
+ return isSetSuccess();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleAddGroupsResponse)
+ return this.equals((TAlterSentryRoleAddGroupsResponse)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleAddGroupsResponse that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true;
+ boolean that_present_success = true;
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (this.success != that.success)
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_success = true;
+ builder.append(present_success);
+ if (present_success)
+ builder.append(success);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TAlterSentryRoleAddGroupsResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TAlterSentryRoleAddGroupsResponse typedOther = (TAlterSentryRoleAddGroupsResponse)other;
+
+ lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSuccess()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("TAlterSentryRoleAddGroupsResponse(");
+ boolean first = true;
+
+ sb.append("success:");
+ sb.append(this.success);
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetSuccess()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'success' 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 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: // SUCCESS
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.success = iprot.readBool();
+ struct.setSuccessIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, TAlterSentryRoleAddGroupsResponse struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ oprot.writeBool(struct.success);
+ 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;
+ oprot.writeBool(struct.success);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.success = iprot.readBool();
+ struct.setSuccessIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TAlterSentryRoleDeleteGroupsRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TAlterSentryRoleDeleteGroupsRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TAlterSentryRoleDeleteGroupsRequest.java
new file mode 100644
index 0000000..02e10c3
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TAlterSentryRoleDeleteGroupsRequest.java
@@ -0,0 +1,501 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.policystore.api;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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 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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TAlterSentryRoleDeleteGroupsRequest implements org.apache.thrift.TBase<TAlterSentryRoleDeleteGroupsRequest, TAlterSentryRoleDeleteGroupsRequest._Fields>, java.io.Serializable, Cloneable {
+ 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 USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", 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 TAlterSentryRoleDeleteGroupsRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAlterSentryRoleDeleteGroupsRequestTupleSchemeFactory());
+ }
+
+ private TSentryPolicyServiceVersion protocol_version; // 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 {
+ /**
+ *
+ * @see TSentryPolicyServiceVersion
+ */
+ PROTOCOL_VERSION((short)1, "protocol_version"),
+ USER_NAME((short)2, "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: // 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
+ 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.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TSentryPolicyServiceVersion.class)));
+ 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(TAlterSentryRoleDeleteGroupsRequest.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleDeleteGroupsRequest() {
+ this.protocol_version = org.apache.sentry.policystore.api.TSentryPolicyServiceVersion.V1;
+
+ }
+
+ public TAlterSentryRoleDeleteGroupsRequest(
+ TSentryPolicyServiceVersion protocol_version,
+ String userName)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ this.userName = userName;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleDeleteGroupsRequest(TAlterSentryRoleDeleteGroupsRequest other) {
+ if (other.isSetProtocol_version()) {
+ this.protocol_version = other.protocol_version;
+ }
+ if (other.isSetUserName()) {
+ this.userName = other.userName;
+ }
+ }
+
+ public TAlterSentryRoleDeleteGroupsRequest deepCopy() {
+ return new TAlterSentryRoleDeleteGroupsRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = org.apache.sentry.policystore.api.TSentryPolicyServiceVersion.V1;
+
+ this.userName = null;
+ }
+
+ /**
+ *
+ * @see TSentryPolicyServiceVersion
+ */
+ public TSentryPolicyServiceVersion getProtocol_version() {
+ return this.protocol_version;
+ }
+
+ /**
+ *
+ * @see TSentryPolicyServiceVersion
+ */
+ public void setProtocol_version(TSentryPolicyServiceVersion protocol_version) {
+ this.protocol_version = protocol_version;
+ }
+
+ public void unsetProtocol_version() {
+ this.protocol_version = null;
+ }
+
+ /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
+ public boolean isSetProtocol_version() {
+ return this.protocol_version != null;
+ }
+
+ public void setProtocol_versionIsSet(boolean value) {
+ if (!value) {
+ this.protocol_version = 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((TSentryPolicyServiceVersion)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 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 USER_NAME:
+ return isSetUserName();
+ }
+ 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 && this.isSetProtocol_version();
+ boolean that_present_protocol_version = true && that.isSetProtocol_version();
+ if (this_present_protocol_version || that_present_protocol_version) {
+ if (!(this_present_protocol_version && that_present_protocol_version))
+ return false;
+ if (!this.protocol_version.equals(that.protocol_version))
+ 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() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_protocol_version = true && (isSetProtocol_version());
+ builder.append(present_protocol_version);
+ if (present_protocol_version)
+ builder.append(protocol_version.getValue());
+
+ boolean present_userName = true && (isSetUserName());
+ builder.append(present_userName);
+ if (present_userName)
+ builder.append(userName);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TAlterSentryRoleDeleteGroupsRequest other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TAlterSentryRoleDeleteGroupsRequest typedOther = (TAlterSentryRoleDeleteGroupsRequest)other;
+
+ lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProtocol_version()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetUserName()).compareTo(typedOther.isSetUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userName, typedOther.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("TAlterSentryRoleDeleteGroupsRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ if (this.protocol_version == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.protocol_version);
+ }
+ 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 (!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 {
+ 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 = TSentryPolicyServiceVersion.findByValue(iprot.readI32());
+ struct.setProtocol_versionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // 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, TAlterSentryRoleDeleteGroupsRequest struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.protocol_version != null) {
+ oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
+ oprot.writeI32(struct.protocol_version.getValue());
+ 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 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.getValue());
+ oprot.writeString(struct.userName);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = TSentryPolicyServiceVersion.findByValue(iprot.readI32());
+ struct.setProtocol_versionIsSet(true);
+ struct.userName = iprot.readString();
+ struct.setUserNameIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TAlterSentryRoleDeleteGroupsResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TAlterSentryRoleDeleteGroupsResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TAlterSentryRoleDeleteGroupsResponse.java
new file mode 100644
index 0000000..f11808f
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TAlterSentryRoleDeleteGroupsResponse.java
@@ -0,0 +1,383 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.policystore.api;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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 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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TAlterSentryRoleDeleteGroupsResponse implements org.apache.thrift.TBase<TAlterSentryRoleDeleteGroupsResponse, TAlterSentryRoleDeleteGroupsResponse._Fields>, java.io.Serializable, Cloneable {
+ 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 SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (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 boolean success; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ SUCCESS((short)1, "success");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // SUCCESS
+ return SUCCESS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __SUCCESS_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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleDeleteGroupsResponse.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleDeleteGroupsResponse() {
+ }
+
+ public TAlterSentryRoleDeleteGroupsResponse(
+ boolean success)
+ {
+ this();
+ this.success = success;
+ setSuccessIsSet(true);
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleDeleteGroupsResponse(TAlterSentryRoleDeleteGroupsResponse other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.success = other.success;
+ }
+
+ public TAlterSentryRoleDeleteGroupsResponse deepCopy() {
+ return new TAlterSentryRoleDeleteGroupsResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ setSuccessIsSet(false);
+ this.success = false;
+ }
+
+ public boolean isSuccess() {
+ return this.success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ setSuccessIsSet(true);
+ }
+
+ public void unsetSuccess() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((Boolean)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return Boolean.valueOf(isSuccess());
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case SUCCESS:
+ return isSetSuccess();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleDeleteGroupsResponse)
+ return this.equals((TAlterSentryRoleDeleteGroupsResponse)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleDeleteGroupsResponse that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true;
+ boolean that_present_success = true;
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (this.success != that.success)
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_success = true;
+ builder.append(present_success);
+ if (present_success)
+ builder.append(success);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TAlterSentryRoleDeleteGroupsResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TAlterSentryRoleDeleteGroupsResponse typedOther = (TAlterSentryRoleDeleteGroupsResponse)other;
+
+ lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSuccess()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("TAlterSentryRoleDeleteGroupsResponse(");
+ boolean first = true;
+
+ sb.append("success:");
+ sb.append(this.success);
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetSuccess()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'success' 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 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: // SUCCESS
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.success = iprot.readBool();
+ struct.setSuccessIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, TAlterSentryRoleDeleteGroupsResponse struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ oprot.writeBool(struct.success);
+ 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;
+ oprot.writeBool(struct.success);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.success = iprot.readBool();
+ struct.setSuccessIsSet(true);
+ }
+ }
+
+}
+
[2/7] SENTRY-76 - Create basic thrift infrastructure for policy
service (Shreepadma via Brock)
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryPrivilege.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryPrivilege.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryPrivilege.java
new file mode 100644
index 0000000..39c7a0d
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryPrivilege.java
@@ -0,0 +1,1210 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.policystore.api;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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 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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TSentryPrivilege implements org.apache.thrift.TBase<TSentryPrivilege, TSentryPrivilege._Fields>, java.io.Serializable, Cloneable {
+ 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 PRIVILEGE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("privilegeName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ 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 GRANTOR_PRINCIPAL_FIELD_DESC = new org.apache.thrift.protocol.TField("grantorPrincipal", org.apache.thrift.protocol.TType.STRING, (short)9);
+
+ 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 privilegeName; // required
+ private String serverName; // required
+ private String dbName; // optional
+ private String tableName; // optional
+ private String URI; // optional
+ private String action; // required
+ private long createTime; // 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 {
+ PRIVILEGE_SCOPE((short)1, "privilegeScope"),
+ PRIVILEGE_NAME((short)2, "privilegeName"),
+ 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"),
+ GRANTOR_PRINCIPAL((short)9, "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: // PRIVILEGE_SCOPE
+ return PRIVILEGE_SCOPE;
+ case 2: // PRIVILEGE_NAME
+ return PRIVILEGE_NAME;
+ 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: // 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
+ private static final int __CREATETIME_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ private _Fields optionals[] = {_Fields.DB_NAME,_Fields.TABLE_NAME,_Fields.URI};
+ 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.PRIVILEGE_NAME, new org.apache.thrift.meta_data.FieldMetaData("privilegeName", 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.REQUIRED,
+ 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.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(TSentryPrivilege.class, metaDataMap);
+ }
+
+ public TSentryPrivilege() {
+ }
+
+ public TSentryPrivilege(
+ String privilegeScope,
+ String privilegeName,
+ String serverName,
+ String action,
+ long createTime,
+ String grantorPrincipal)
+ {
+ this();
+ this.privilegeScope = privilegeScope;
+ this.privilegeName = privilegeName;
+ this.serverName = serverName;
+ this.action = action;
+ this.createTime = createTime;
+ setCreateTimeIsSet(true);
+ this.grantorPrincipal = grantorPrincipal;
+ }
+
+ /**
+ * 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.isSetPrivilegeName()) {
+ this.privilegeName = other.privilegeName;
+ }
+ 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.isSetGrantorPrincipal()) {
+ this.grantorPrincipal = other.grantorPrincipal;
+ }
+ }
+
+ public TSentryPrivilege deepCopy() {
+ return new TSentryPrivilege(this);
+ }
+
+ @Override
+ public void clear() {
+ this.privilegeScope = null;
+ this.privilegeName = null;
+ this.serverName = null;
+ this.dbName = null;
+ this.tableName = null;
+ this.URI = null;
+ this.action = null;
+ setCreateTimeIsSet(false);
+ this.createTime = 0;
+ this.grantorPrincipal = null;
+ }
+
+ 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 getPrivilegeName() {
+ return this.privilegeName;
+ }
+
+ public void setPrivilegeName(String privilegeName) {
+ this.privilegeName = privilegeName;
+ }
+
+ public void unsetPrivilegeName() {
+ this.privilegeName = null;
+ }
+
+ /** Returns true if field privilegeName is set (has been assigned a value) and false otherwise */
+ public boolean isSetPrivilegeName() {
+ return this.privilegeName != null;
+ }
+
+ public void setPrivilegeNameIsSet(boolean value) {
+ if (!value) {
+ this.privilegeName = 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);
+ }
+
+ 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 PRIVILEGE_SCOPE:
+ if (value == null) {
+ unsetPrivilegeScope();
+ } else {
+ setPrivilegeScope((String)value);
+ }
+ break;
+
+ case PRIVILEGE_NAME:
+ if (value == null) {
+ unsetPrivilegeName();
+ } else {
+ setPrivilegeName((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 GRANTOR_PRINCIPAL:
+ if (value == null) {
+ unsetGrantorPrincipal();
+ } else {
+ setGrantorPrincipal((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PRIVILEGE_SCOPE:
+ return getPrivilegeScope();
+
+ case PRIVILEGE_NAME:
+ return getPrivilegeName();
+
+ 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 Long.valueOf(getCreateTime());
+
+ 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 PRIVILEGE_SCOPE:
+ return isSetPrivilegeScope();
+ case PRIVILEGE_NAME:
+ return isSetPrivilegeName();
+ 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 GRANTOR_PRINCIPAL:
+ return isSetGrantorPrincipal();
+ }
+ 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_privilegeName = true && this.isSetPrivilegeName();
+ boolean that_present_privilegeName = true && that.isSetPrivilegeName();
+ if (this_present_privilegeName || that_present_privilegeName) {
+ if (!(this_present_privilegeName && that_present_privilegeName))
+ return false;
+ if (!this.privilegeName.equals(that.privilegeName))
+ 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;
+ boolean that_present_createTime = true;
+ 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;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_privilegeScope = true && (isSetPrivilegeScope());
+ builder.append(present_privilegeScope);
+ if (present_privilegeScope)
+ builder.append(privilegeScope);
+
+ boolean present_privilegeName = true && (isSetPrivilegeName());
+ builder.append(present_privilegeName);
+ if (present_privilegeName)
+ builder.append(privilegeName);
+
+ boolean present_serverName = true && (isSetServerName());
+ builder.append(present_serverName);
+ if (present_serverName)
+ builder.append(serverName);
+
+ boolean present_dbName = true && (isSetDbName());
+ builder.append(present_dbName);
+ if (present_dbName)
+ builder.append(dbName);
+
+ boolean present_tableName = true && (isSetTableName());
+ builder.append(present_tableName);
+ if (present_tableName)
+ builder.append(tableName);
+
+ boolean present_URI = true && (isSetURI());
+ builder.append(present_URI);
+ if (present_URI)
+ builder.append(URI);
+
+ boolean present_action = true && (isSetAction());
+ builder.append(present_action);
+ if (present_action)
+ builder.append(action);
+
+ boolean present_createTime = true;
+ builder.append(present_createTime);
+ if (present_createTime)
+ builder.append(createTime);
+
+ boolean present_grantorPrincipal = true && (isSetGrantorPrincipal());
+ builder.append(present_grantorPrincipal);
+ if (present_grantorPrincipal)
+ builder.append(grantorPrincipal);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TSentryPrivilege other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TSentryPrivilege typedOther = (TSentryPrivilege)other;
+
+ lastComparison = Boolean.valueOf(isSetPrivilegeScope()).compareTo(typedOther.isSetPrivilegeScope());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPrivilegeScope()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilegeScope, typedOther.privilegeScope);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetPrivilegeName()).compareTo(typedOther.isSetPrivilegeName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPrivilegeName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilegeName, typedOther.privilegeName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetServerName()).compareTo(typedOther.isSetServerName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetServerName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serverName, typedOther.serverName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetDbName()).compareTo(typedOther.isSetDbName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetDbName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dbName, typedOther.dbName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetTableName()).compareTo(typedOther.isSetTableName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetTableName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tableName, typedOther.tableName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetURI()).compareTo(typedOther.isSetURI());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetURI()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.URI, typedOther.URI);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetAction()).compareTo(typedOther.isSetAction());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAction()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.action, typedOther.action);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetCreateTime()).compareTo(typedOther.isSetCreateTime());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetCreateTime()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.createTime, typedOther.createTime);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGrantorPrincipal()).compareTo(typedOther.isSetGrantorPrincipal());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGrantorPrincipal()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.grantorPrincipal, typedOther.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("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("privilegeName:");
+ if (this.privilegeName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.privilegeName);
+ }
+ 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 (!first) sb.append(", ");
+ sb.append("createTime:");
+ sb.append(this.createTime);
+ 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 (!isSetPrivilegeScope()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilegeScope' is unset! Struct:" + toString());
+ }
+
+ if (!isSetPrivilegeName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilegeName' 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());
+ }
+
+ if (!isSetCreateTime()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'createTime' 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 {
+ // 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 2: // PRIVILEGE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.privilegeName = iprot.readString();
+ struct.setPrivilegeNameIsSet(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: // 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, 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.privilegeName != null) {
+ oprot.writeFieldBegin(PRIVILEGE_NAME_FIELD_DESC);
+ oprot.writeString(struct.privilegeName);
+ 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();
+ }
+ oprot.writeFieldBegin(CREATE_TIME_FIELD_DESC);
+ oprot.writeI64(struct.createTime);
+ 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 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.privilegeName);
+ oprot.writeString(struct.serverName);
+ oprot.writeString(struct.action);
+ oprot.writeI64(struct.createTime);
+ oprot.writeString(struct.grantorPrincipal);
+ BitSet optionals = new BitSet();
+ if (struct.isSetDbName()) {
+ optionals.set(0);
+ }
+ if (struct.isSetTableName()) {
+ optionals.set(1);
+ }
+ if (struct.isSetURI()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetDbName()) {
+ oprot.writeString(struct.dbName);
+ }
+ if (struct.isSetTableName()) {
+ oprot.writeString(struct.tableName);
+ }
+ if (struct.isSetURI()) {
+ oprot.writeString(struct.URI);
+ }
+ }
+
+ @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.privilegeName = iprot.readString();
+ struct.setPrivilegeNameIsSet(true);
+ struct.serverName = iprot.readString();
+ struct.setServerNameIsSet(true);
+ struct.action = iprot.readString();
+ struct.setActionIsSet(true);
+ struct.createTime = iprot.readI64();
+ struct.setCreateTimeIsSet(true);
+ struct.grantorPrincipal = iprot.readString();
+ struct.setGrantorPrincipalIsSet(true);
+ BitSet incoming = iprot.readBitSet(3);
+ 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);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryRole.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryRole.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryRole.java
new file mode 100644
index 0000000..478f3f6
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TSentryRole.java
@@ -0,0 +1,740 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.policystore.api;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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 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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentryRole._Fields>, java.io.Serializable, Cloneable {
+ 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 PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)2);
+ 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)3);
+ 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)4);
+
+ 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<TSentryPrivilege> privileges; // required
+ private long createTime; // 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"),
+ PRIVILEGES((short)2, "privileges"),
+ CREATE_TIME((short)3, "createTime"),
+ GRANTOR_PRINCIPAL((short)4, "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: // PRIVILEGES
+ return PRIVILEGES;
+ case 3: // CREATE_TIME
+ return CREATE_TIME;
+ case 4: // 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
+ private static final int __CREATETIME_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.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.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.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class))));
+ tmpMap.put(_Fields.CREATE_TIME, new org.apache.thrift.meta_data.FieldMetaData("createTime", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ 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.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<TSentryPrivilege> privileges,
+ long createTime,
+ String grantorPrincipal)
+ {
+ this();
+ this.roleName = roleName;
+ this.privileges = privileges;
+ this.createTime = createTime;
+ setCreateTimeIsSet(true);
+ this.grantorPrincipal = grantorPrincipal;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TSentryRole(TSentryRole other) {
+ __isset_bitfield = other.__isset_bitfield;
+ if (other.isSetRoleName()) {
+ this.roleName = other.roleName;
+ }
+ if (other.isSetPrivileges()) {
+ Set<TSentryPrivilege> __this__privileges = new HashSet<TSentryPrivilege>();
+ for (TSentryPrivilege other_element : other.privileges) {
+ __this__privileges.add(new TSentryPrivilege(other_element));
+ }
+ this.privileges = __this__privileges;
+ }
+ this.createTime = other.createTime;
+ if (other.isSetGrantorPrincipal()) {
+ this.grantorPrincipal = other.grantorPrincipal;
+ }
+ }
+
+ public TSentryRole deepCopy() {
+ return new TSentryRole(this);
+ }
+
+ @Override
+ public void clear() {
+ this.roleName = null;
+ this.privileges = null;
+ setCreateTimeIsSet(false);
+ this.createTime = 0;
+ 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 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 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;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case ROLE_NAME:
+ if (value == null) {
+ unsetRoleName();
+ } else {
+ setRoleName((String)value);
+ }
+ break;
+
+ case PRIVILEGES:
+ if (value == null) {
+ unsetPrivileges();
+ } else {
+ setPrivileges((Set<TSentryPrivilege>)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;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case ROLE_NAME:
+ return getRoleName();
+
+ case PRIVILEGES:
+ return getPrivileges();
+
+ case CREATE_TIME:
+ return Long.valueOf(getCreateTime());
+
+ 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 PRIVILEGES:
+ return isSetPrivileges();
+ case CREATE_TIME:
+ return isSetCreateTime();
+ 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_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;
+ }
+
+ boolean this_present_createTime = true;
+ boolean that_present_createTime = true;
+ 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;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_roleName = true && (isSetRoleName());
+ builder.append(present_roleName);
+ if (present_roleName)
+ builder.append(roleName);
+
+ boolean present_privileges = true && (isSetPrivileges());
+ builder.append(present_privileges);
+ if (present_privileges)
+ builder.append(privileges);
+
+ boolean present_createTime = true;
+ builder.append(present_createTime);
+ if (present_createTime)
+ builder.append(createTime);
+
+ boolean present_grantorPrincipal = true && (isSetGrantorPrincipal());
+ builder.append(present_grantorPrincipal);
+ if (present_grantorPrincipal)
+ builder.append(grantorPrincipal);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TSentryRole other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TSentryRole typedOther = (TSentryRole)other;
+
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetPrivileges()).compareTo(typedOther.isSetPrivileges());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPrivileges()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, typedOther.privileges);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetCreateTime()).compareTo(typedOther.isSetCreateTime());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetCreateTime()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.createTime, typedOther.createTime);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGrantorPrincipal()).compareTo(typedOther.isSetGrantorPrincipal());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGrantorPrincipal()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.grantorPrincipal, typedOther.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("privileges:");
+ if (this.privileges == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.privileges);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("createTime:");
+ sb.append(this.createTime);
+ 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 (!isSetPrivileges()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'privileges' is unset! Struct:" + toString());
+ }
+
+ if (!isSetCreateTime()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'createTime' 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 {
+ // 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 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: // PRIVILEGES
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set0 = iprot.readSetBegin();
+ struct.privileges = new HashSet<TSentryPrivilege>(2*_set0.size);
+ for (int _i1 = 0; _i1 < _set0.size; ++_i1)
+ {
+ TSentryPrivilege _elem2; // required
+ _elem2 = new TSentryPrivilege();
+ _elem2.read(iprot);
+ struct.privileges.add(_elem2);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setPrivilegesIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // 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 4: // 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.privileges != null) {
+ oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
+ {
+ oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.privileges.size()));
+ for (TSentryPrivilege _iter3 : struct.privileges)
+ {
+ _iter3.write(oprot);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldBegin(CREATE_TIME_FIELD_DESC);
+ oprot.writeI64(struct.createTime);
+ 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.privileges.size());
+ for (TSentryPrivilege _iter4 : struct.privileges)
+ {
+ _iter4.write(oprot);
+ }
+ }
+ oprot.writeI64(struct.createTime);
+ 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 _set5 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.privileges = new HashSet<TSentryPrivilege>(2*_set5.size);
+ for (int _i6 = 0; _i6 < _set5.size; ++_i6)
+ {
+ TSentryPrivilege _elem7; // required
+ _elem7 = new TSentryPrivilege();
+ _elem7.read(iprot);
+ struct.privileges.add(_elem7);
+ }
+ }
+ struct.setPrivilegesIsSet(true);
+ struct.createTime = iprot.readI64();
+ struct.setCreateTimeIsSet(true);
+ struct.grantorPrincipal = iprot.readString();
+ struct.setGrantorPrincipalIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryGroup.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryGroup.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryGroup.java
new file mode 100644
index 0000000..4aa9321
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryGroup.java
@@ -0,0 +1,78 @@
+/**
+ * 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.model;
+
+import java.util.Set;
+
+public class MSentryGroup {
+
+ private String groupName;
+
+ // set of roles granted to this group
+ private Set<MSentryRole> roles;
+
+ private long createTime;
+
+ private String grantorPrincipal;
+
+
+ MSentryGroup(String groupName, long createTime, String grantorPrincipal,
+ Set<MSentryRole> roles) {
+ this.setGroupName(groupName);
+ this.createTime = createTime;
+ this.grantorPrincipal = grantorPrincipal;
+ this.setRoles(roles);
+ }
+
+ public long getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(long createTime) {
+ this.createTime = createTime;
+ }
+
+ public String getGrantorPrincipal() {
+ return grantorPrincipal;
+ }
+
+ public void setGrantorPrincipal(String grantorPrincipal) {
+ this.grantorPrincipal = grantorPrincipal;
+ }
+
+ public Set<MSentryRole> getRoles() {
+ return roles;
+ }
+
+ public void setRoles(Set<MSentryRole> roles) {
+ this.roles = roles;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public void appendRoles(Set<MSentryRole> roles) {
+ this.roles.addAll(roles);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPrivilege.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPrivilege.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPrivilege.java
new file mode 100644
index 0000000..c51901c
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPrivilege.java
@@ -0,0 +1,141 @@
+/**
+ * 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.model;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class MSentryPrivilege {
+
+ private String privilegeScope;
+
+ private String privilegeName;
+
+ private String serverName;
+
+ private String dbName;
+
+ private String tableName;
+
+ private String URI;
+
+ private String action;
+
+ // roles this privilege is a part of
+ Set<MSentryRole> roles;
+
+ private long createTime;
+
+ private String grantorPrincipal;
+
+ public MSentryPrivilege() {this.roles = new HashSet<MSentryRole>();}
+
+ public MSentryPrivilege(String privilegeName, String privilegeScope,
+ String serverName, String dbName, String tableName, String URI,
+ String action) {
+ this.privilegeName = privilegeName;
+ this.privilegeScope = privilegeScope;
+ this.serverName = serverName;
+ this.dbName = dbName;
+ this.tableName = tableName;
+ this.URI = URI;
+ this.action = action;
+ this.roles = new HashSet<MSentryRole>();
+ }
+
+ public String getServerName() {
+ return serverName;
+ }
+
+ public void setServerName(String serverName) {
+ this.serverName = serverName;
+ }
+
+ public String getDbName() {
+ return dbName;
+ }
+
+ public void setDbName(String dbName) {
+ this.dbName = dbName;
+ }
+
+ public String getTableName() {
+ return tableName;
+ }
+
+ public void setTableName(String tableName) {
+ this.tableName = tableName;
+ }
+
+ public String getURI() {
+ return URI;
+ }
+
+ public void setURI(String uRI) {
+ URI = uRI;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public long getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(long createTime) {
+ this.createTime = createTime;
+ }
+
+ public String getGrantorPrincipal() {
+ return grantorPrincipal;
+ }
+
+ public void setGrantorPrincipal(String grantorPrincipal) {
+ this.grantorPrincipal = grantorPrincipal;
+ }
+
+ public String getPrivilegeScope() {
+ return privilegeScope;
+ }
+
+ public void setPrivilegeScope(String privilegeScope) {
+ this.privilegeScope = privilegeScope;
+ }
+
+ public String getPrivilegeName() {
+ return privilegeName;
+ }
+
+ public void setPrivilegeName(String privilegeName) {
+ this.privilegeName = privilegeName;
+ }
+
+ public void appendRoles(Set<MSentryRole> roles) {
+ this.roles.addAll(roles);
+ }
+
+ public void appendRole(MSentryRole role) {
+ this.roles.add(role);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryRole.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryRole.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryRole.java
new file mode 100644
index 0000000..cb1733b
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryRole.java
@@ -0,0 +1,104 @@
+/**
+ * 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.model;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class MSentryRole {
+
+ private String roleName;
+
+ // set of privileges granted to this role
+ Set<MSentryPrivilege> privileges;
+
+ // set of groups this role belongs to
+ Set<MSentryGroup> groups;
+
+ private long createTime;
+
+ private String grantorPrincipal;
+
+ public MSentryRole() {privileges = new HashSet<MSentryPrivilege>();}
+
+ MSentryRole(String roleName, long createTime, String grantorPrincipal,
+ Set<MSentryPrivilege> privileges, Set<MSentryGroup> groups) {
+ this.roleName = roleName;
+ this.createTime = createTime;
+ this.grantorPrincipal = grantorPrincipal;
+ this.privileges = privileges;
+ this.groups = groups;
+ }
+
+ public long getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(long createTime) {
+ this.createTime = createTime;
+ }
+
+ public String getGrantorPrincipal() {
+ return grantorPrincipal;
+ }
+
+ public void setGrantorPrincipal(String grantorPrincipal) {
+ this.grantorPrincipal = grantorPrincipal;
+ }
+
+ public String getRoleName() {
+ return roleName;
+ }
+
+ public void setRoleName(String roleName) {
+ this.roleName = roleName;
+ }
+
+ public void setPrivileges(Set<MSentryPrivilege> privileges) {
+ this.privileges = privileges;
+ }
+
+ public Set<MSentryPrivilege> getPrivileges() {
+ return privileges;
+ }
+
+ public void setGroups(Set<MSentryGroup> groups) {
+ this.groups = groups;
+ }
+
+ public Set<MSentryGroup> getGroups() {
+ return groups;
+ }
+
+ public void appendPrivileges(Set<MSentryPrivilege> privileges) {
+ this.privileges.addAll(privileges);
+ }
+
+ public void appendPrivilege(MSentryPrivilege privilege) {
+ this.privileges.add(privilege);
+ }
+
+ public void appendGroups(Set<MSentryGroup> groups) {
+ this.groups.addAll(groups);
+ }
+
+ public void removePrivileges() {
+ this.privileges.clear();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo
new file mode 100644
index 0000000..9715df1
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo
@@ -0,0 +1,125 @@
+<?xml version="1.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.
+-->
+<!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN"
+ "http://java.sun.com/dtd/jdo_2_0.dtd">
+<!--
+ Size Limitations:
+
+ Indexed VARCHAR: 767 bytes (MySQL running on InnoDB Engine http://bugs.mysql.com/bug.php?id=13315)
+ Non-indexed VARCHAR: 4000 bytes (max length on Oracle 9i/10g/11g)
+
+-->
+<jdo>
+ <package name="org.apache.sentry.provider.db.service.persistent.model">
+ <class name="MSentryGroup" identity-type="datastore" table="SENTRY_GROUPS" detachable="true">
+ <datastore-identity>
+ <column name="GROUP_ID"/>
+ </datastore-identity>
+ <field name="groupName">
+ <column name="GROUP_NAME" length="128" jdbc-type="VARCHAR"/>
+ <index name="SentryGroupName" unique="true"/>
+ </field>
+ <field name = "createTime">
+ <column name = "CREATE_TIME" jdbc-type="BIGINT"/>
+ </field>
+ <field name="grantorPrincipal">
+ <column name="GRANTOR_PRINCIPAL" length="4000" jdbc-type="VARCHAR"/>
+ </field>
+
+ <field name="roles" mapped-by="groups">
+ <collection element-type="org.apache.sentry.provider.db.service.persistent.model.MSentryRole"/>
+ </field>
+
+ </class>
+
+ <class name="MSentryRole" identity-type="datastore" table="SENTRY_ROLES" detachable="true">
+ <datastore-identity>
+ <column name="ROLE_ID"/>
+ </datastore-identity>
+ <field name="roleName">
+ <column name="ROLE_NAME" length="128" jdbc-type="VARCHAR"/>
+ <index name="SentryRoleNaME" unique="true"/>
+ </field>
+ <field name = "createTime">
+ <column name = "CREATE_TIME" jdbc-type="BIGINT"/>
+ </field>
+ <field name="grantorPrincipal">
+ <column name="GRANTOR_PRINCIPAL" length="4000" jdbc-type="VARCHAR"/>
+ </field>
+ <field name = "privileges" table="ROLES_PRIVILEGES" >
+ <collection element-type="org.apache.sentry.provider.db.service.persistent.model.MSentryPrivilege"/>
+ <join>
+ <column name="ROLE_ID"/>
+ </join>
+ <element>
+ <column name="PRIVILEGE_ID"/>
+ </element>
+ </field>
+
+ <field name = "groups" table="ROLES_GROUPS" >
+ <collection element-type="org.apache.sentry.provider.db.service.persistent.model.MSentryGroup"/>
+ <join>
+ <column name="ROLE_ID"/>
+ </join>
+ <element>
+ <column name="GROUP_ID"/>
+ </element>
+ </field>
+ </class>
+
+ <class name="MSentryPrivilege" identity-type="datastore" table="SENTRY_PRIVILEGES" detachable="true">
+ <datastore-identity>
+ <column name="PRIVILEGE_ID"/>
+ </datastore-identity>
+ <field name="privilegeName">
+ <column name="PRIVILEGE_NAME" length="128" jdbc-type="VARCHAR"/>
+ <index name="SentryPrivilegeName" unique="true"/>
+ </field>
+ <field name="privilegeScope">
+ <column name="PRIVILEGE_SCOPE" length="40" jdbc-type="VARCHAR"/>
+ </field>
+ <field name="serverName">
+ <column name="SERVER_NAME" length="4000" jdbc-type="VARCHAR"/>
+ </field>
+ <field name="dbName">
+ <column name="DB_NAME" length="4000" jdbc-type="VARCHAR"/>
+ </field>
+ <field name="tableName">
+ <column name="TABLE_NAME" length="4000" jdbc-type="VARCHAR"/>
+ </field>
+ <field name="URI">
+ <column name="URI" length="4000" jdbc-type="VARCHAR"/>
+ </field>
+ <field name="action">
+ <column name="ACTION" length="40" jdbc-type="VARCHAR"/>
+ </field>
+ <field name = "createTime">
+ <column name = "CREATE_TIME" jdbc-type="BIGINT"/>
+ </field>
+ <field name="grantorPrincipal">
+ <column name="GRANTOR_PRINCIPAL" length="4000" jdbc-type="VARCHAR"/>
+ </field>
+ <field name="roles" mapped-by="privileges">
+ <collection element-type="org.apache.sentry.provider.db.service.persistent.model.MSentryRole"/>
+ </field>
+ </class>
+
+ </package>
+</jdo>
+
[4/7] SENTRY-76 - Create basic thrift infrastructure for policy
service (Shreepadma via Brock)
Posted by br...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TCreateSentryPrivilegeRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TCreateSentryPrivilegeRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TCreateSentryPrivilegeRequest.java
new file mode 100644
index 0000000..62f930a
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TCreateSentryPrivilegeRequest.java
@@ -0,0 +1,607 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.policystore.api;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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 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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TCreateSentryPrivilegeRequest implements org.apache.thrift.TBase<TCreateSentryPrivilegeRequest, TCreateSentryPrivilegeRequest._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCreateSentryPrivilegeRequest");
+
+ 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 USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TCreateSentryPrivilegeRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TCreateSentryPrivilegeRequestTupleSchemeFactory());
+ }
+
+ private TSentryPolicyServiceVersion protocol_version; // required
+ private String userName; // 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 {
+ /**
+ *
+ * @see TSentryPolicyServiceVersion
+ */
+ PROTOCOL_VERSION((short)1, "protocol_version"),
+ USER_NAME((short)2, "userName"),
+ PRIVILEGE((short)3, "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: // USER_NAME
+ return USER_NAME;
+ case 3: // 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
+ 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.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TSentryPolicyServiceVersion.class)));
+ 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)));
+ 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(TCreateSentryPrivilegeRequest.class, metaDataMap);
+ }
+
+ public TCreateSentryPrivilegeRequest() {
+ this.protocol_version = org.apache.sentry.policystore.api.TSentryPolicyServiceVersion.V1;
+
+ }
+
+ public TCreateSentryPrivilegeRequest(
+ TSentryPolicyServiceVersion protocol_version,
+ String userName,
+ TSentryPrivilege privilege)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ this.userName = userName;
+ this.privilege = privilege;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TCreateSentryPrivilegeRequest(TCreateSentryPrivilegeRequest other) {
+ if (other.isSetProtocol_version()) {
+ this.protocol_version = other.protocol_version;
+ }
+ if (other.isSetUserName()) {
+ this.userName = other.userName;
+ }
+ if (other.isSetPrivilege()) {
+ this.privilege = new TSentryPrivilege(other.privilege);
+ }
+ }
+
+ public TCreateSentryPrivilegeRequest deepCopy() {
+ return new TCreateSentryPrivilegeRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = org.apache.sentry.policystore.api.TSentryPolicyServiceVersion.V1;
+
+ this.userName = null;
+ this.privilege = null;
+ }
+
+ /**
+ *
+ * @see TSentryPolicyServiceVersion
+ */
+ public TSentryPolicyServiceVersion getProtocol_version() {
+ return this.protocol_version;
+ }
+
+ /**
+ *
+ * @see TSentryPolicyServiceVersion
+ */
+ public void setProtocol_version(TSentryPolicyServiceVersion protocol_version) {
+ this.protocol_version = protocol_version;
+ }
+
+ public void unsetProtocol_version() {
+ this.protocol_version = null;
+ }
+
+ /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
+ public boolean isSetProtocol_version() {
+ return this.protocol_version != null;
+ }
+
+ public void setProtocol_versionIsSet(boolean value) {
+ if (!value) {
+ this.protocol_version = 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 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((TSentryPolicyServiceVersion)value);
+ }
+ break;
+
+ case USER_NAME:
+ if (value == null) {
+ unsetUserName();
+ } else {
+ setUserName((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 USER_NAME:
+ return getUserName();
+
+ 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 USER_NAME:
+ return isSetUserName();
+ case PRIVILEGE:
+ return isSetPrivilege();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TCreateSentryPrivilegeRequest)
+ return this.equals((TCreateSentryPrivilegeRequest)that);
+ return false;
+ }
+
+ public boolean equals(TCreateSentryPrivilegeRequest that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_protocol_version = true && this.isSetProtocol_version();
+ boolean that_present_protocol_version = true && that.isSetProtocol_version();
+ if (this_present_protocol_version || that_present_protocol_version) {
+ if (!(this_present_protocol_version && that_present_protocol_version))
+ return false;
+ if (!this.protocol_version.equals(that.protocol_version))
+ 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;
+ }
+
+ 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() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_protocol_version = true && (isSetProtocol_version());
+ builder.append(present_protocol_version);
+ if (present_protocol_version)
+ builder.append(protocol_version.getValue());
+
+ boolean present_userName = true && (isSetUserName());
+ builder.append(present_userName);
+ if (present_userName)
+ builder.append(userName);
+
+ boolean present_privilege = true && (isSetPrivilege());
+ builder.append(present_privilege);
+ if (present_privilege)
+ builder.append(privilege);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TCreateSentryPrivilegeRequest other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TCreateSentryPrivilegeRequest typedOther = (TCreateSentryPrivilegeRequest)other;
+
+ lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProtocol_version()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetUserName()).compareTo(typedOther.isSetUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userName, typedOther.userName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetPrivilege()).compareTo(typedOther.isSetPrivilege());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPrivilege()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilege, typedOther.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("TCreateSentryPrivilegeRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ if (this.protocol_version == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.protocol_version);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("userName:");
+ if (this.userName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.userName);
+ }
+ 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 (!isSetUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'userName' 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 {
+ 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 TCreateSentryPrivilegeRequestStandardSchemeFactory implements SchemeFactory {
+ public TCreateSentryPrivilegeRequestStandardScheme getScheme() {
+ return new TCreateSentryPrivilegeRequestStandardScheme();
+ }
+ }
+
+ private static class TCreateSentryPrivilegeRequestStandardScheme extends StandardScheme<TCreateSentryPrivilegeRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TCreateSentryPrivilegeRequest 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 = TSentryPolicyServiceVersion.findByValue(iprot.readI32());
+ struct.setProtocol_versionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // 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;
+ 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;
+ 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, TCreateSentryPrivilegeRequest struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.protocol_version != null) {
+ oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
+ oprot.writeI32(struct.protocol_version.getValue());
+ oprot.writeFieldEnd();
+ }
+ if (struct.userName != null) {
+ oprot.writeFieldBegin(USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.userName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.privilege != null) {
+ oprot.writeFieldBegin(PRIVILEGE_FIELD_DESC);
+ struct.privilege.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TCreateSentryPrivilegeRequestTupleSchemeFactory implements SchemeFactory {
+ public TCreateSentryPrivilegeRequestTupleScheme getScheme() {
+ return new TCreateSentryPrivilegeRequestTupleScheme();
+ }
+ }
+
+ private static class TCreateSentryPrivilegeRequestTupleScheme extends TupleScheme<TCreateSentryPrivilegeRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TCreateSentryPrivilegeRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version.getValue());
+ oprot.writeString(struct.userName);
+ struct.privilege.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TCreateSentryPrivilegeRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = TSentryPolicyServiceVersion.findByValue(iprot.readI32());
+ struct.setProtocol_versionIsSet(true);
+ struct.userName = iprot.readString();
+ struct.setUserNameIsSet(true);
+ struct.privilege = new TSentryPrivilege();
+ struct.privilege.read(iprot);
+ struct.setPrivilegeIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TCreateSentryPrivilegeResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TCreateSentryPrivilegeResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TCreateSentryPrivilegeResponse.java
new file mode 100644
index 0000000..528323b
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TCreateSentryPrivilegeResponse.java
@@ -0,0 +1,383 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.policystore.api;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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 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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TCreateSentryPrivilegeResponse implements org.apache.thrift.TBase<TCreateSentryPrivilegeResponse, TCreateSentryPrivilegeResponse._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCreateSentryPrivilegeResponse");
+
+ private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TCreateSentryPrivilegeResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TCreateSentryPrivilegeResponseTupleSchemeFactory());
+ }
+
+ private boolean success; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ SUCCESS((short)1, "success");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // SUCCESS
+ return SUCCESS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __SUCCESS_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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TCreateSentryPrivilegeResponse.class, metaDataMap);
+ }
+
+ public TCreateSentryPrivilegeResponse() {
+ }
+
+ public TCreateSentryPrivilegeResponse(
+ boolean success)
+ {
+ this();
+ this.success = success;
+ setSuccessIsSet(true);
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TCreateSentryPrivilegeResponse(TCreateSentryPrivilegeResponse other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.success = other.success;
+ }
+
+ public TCreateSentryPrivilegeResponse deepCopy() {
+ return new TCreateSentryPrivilegeResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ setSuccessIsSet(false);
+ this.success = false;
+ }
+
+ public boolean isSuccess() {
+ return this.success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ setSuccessIsSet(true);
+ }
+
+ public void unsetSuccess() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((Boolean)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return Boolean.valueOf(isSuccess());
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case SUCCESS:
+ return isSetSuccess();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TCreateSentryPrivilegeResponse)
+ return this.equals((TCreateSentryPrivilegeResponse)that);
+ return false;
+ }
+
+ public boolean equals(TCreateSentryPrivilegeResponse that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true;
+ boolean that_present_success = true;
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (this.success != that.success)
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_success = true;
+ builder.append(present_success);
+ if (present_success)
+ builder.append(success);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TCreateSentryPrivilegeResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TCreateSentryPrivilegeResponse typedOther = (TCreateSentryPrivilegeResponse)other;
+
+ lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSuccess()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("TCreateSentryPrivilegeResponse(");
+ boolean first = true;
+
+ sb.append("success:");
+ sb.append(this.success);
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetSuccess()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'success' 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 TCreateSentryPrivilegeResponseStandardSchemeFactory implements SchemeFactory {
+ public TCreateSentryPrivilegeResponseStandardScheme getScheme() {
+ return new TCreateSentryPrivilegeResponseStandardScheme();
+ }
+ }
+
+ private static class TCreateSentryPrivilegeResponseStandardScheme extends StandardScheme<TCreateSentryPrivilegeResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TCreateSentryPrivilegeResponse 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: // SUCCESS
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.success = iprot.readBool();
+ struct.setSuccessIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, TCreateSentryPrivilegeResponse struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ oprot.writeBool(struct.success);
+ oprot.writeFieldEnd();
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TCreateSentryPrivilegeResponseTupleSchemeFactory implements SchemeFactory {
+ public TCreateSentryPrivilegeResponseTupleScheme getScheme() {
+ return new TCreateSentryPrivilegeResponseTupleScheme();
+ }
+ }
+
+ private static class TCreateSentryPrivilegeResponseTupleScheme extends TupleScheme<TCreateSentryPrivilegeResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TCreateSentryPrivilegeResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeBool(struct.success);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TCreateSentryPrivilegeResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.success = iprot.readBool();
+ struct.setSuccessIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TCreateSentryRoleRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TCreateSentryRoleRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TCreateSentryRoleRequest.java
new file mode 100644
index 0000000..b1e3c04
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TCreateSentryRoleRequest.java
@@ -0,0 +1,607 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.policystore.api;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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 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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TCreateSentryRoleRequest implements org.apache.thrift.TBase<TCreateSentryRoleRequest, TCreateSentryRoleRequest._Fields>, java.io.Serializable, Cloneable {
+ 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 USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField ROLE_FIELD_DESC = new org.apache.thrift.protocol.TField("role", 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 TCreateSentryRoleRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TCreateSentryRoleRequestTupleSchemeFactory());
+ }
+
+ private TSentryPolicyServiceVersion protocol_version; // required
+ private String userName; // required
+ private TSentryRole role; // 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 {
+ /**
+ *
+ * @see TSentryPolicyServiceVersion
+ */
+ PROTOCOL_VERSION((short)1, "protocol_version"),
+ USER_NAME((short)2, "userName"),
+ ROLE((short)3, "role");
+
+ 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: // USER_NAME
+ return USER_NAME;
+ case 3: // ROLE
+ return ROLE;
+ 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.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TSentryPolicyServiceVersion.class)));
+ 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)));
+ tmpMap.put(_Fields.ROLE, new org.apache.thrift.meta_data.FieldMetaData("role", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ 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(TCreateSentryRoleRequest.class, metaDataMap);
+ }
+
+ public TCreateSentryRoleRequest() {
+ this.protocol_version = org.apache.sentry.policystore.api.TSentryPolicyServiceVersion.V1;
+
+ }
+
+ public TCreateSentryRoleRequest(
+ TSentryPolicyServiceVersion protocol_version,
+ String userName,
+ TSentryRole role)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ this.userName = userName;
+ this.role = role;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TCreateSentryRoleRequest(TCreateSentryRoleRequest other) {
+ if (other.isSetProtocol_version()) {
+ this.protocol_version = other.protocol_version;
+ }
+ if (other.isSetUserName()) {
+ this.userName = other.userName;
+ }
+ if (other.isSetRole()) {
+ this.role = new TSentryRole(other.role);
+ }
+ }
+
+ public TCreateSentryRoleRequest deepCopy() {
+ return new TCreateSentryRoleRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = org.apache.sentry.policystore.api.TSentryPolicyServiceVersion.V1;
+
+ this.userName = null;
+ this.role = null;
+ }
+
+ /**
+ *
+ * @see TSentryPolicyServiceVersion
+ */
+ public TSentryPolicyServiceVersion getProtocol_version() {
+ return this.protocol_version;
+ }
+
+ /**
+ *
+ * @see TSentryPolicyServiceVersion
+ */
+ public void setProtocol_version(TSentryPolicyServiceVersion protocol_version) {
+ this.protocol_version = protocol_version;
+ }
+
+ public void unsetProtocol_version() {
+ this.protocol_version = null;
+ }
+
+ /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
+ public boolean isSetProtocol_version() {
+ return this.protocol_version != null;
+ }
+
+ public void setProtocol_versionIsSet(boolean value) {
+ if (!value) {
+ this.protocol_version = 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 TSentryRole getRole() {
+ return this.role;
+ }
+
+ public void setRole(TSentryRole role) {
+ this.role = role;
+ }
+
+ public void unsetRole() {
+ this.role = null;
+ }
+
+ /** Returns true if field role is set (has been assigned a value) and false otherwise */
+ public boolean isSetRole() {
+ return this.role != null;
+ }
+
+ public void setRoleIsSet(boolean value) {
+ if (!value) {
+ this.role = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ if (value == null) {
+ unsetProtocol_version();
+ } else {
+ setProtocol_version((TSentryPolicyServiceVersion)value);
+ }
+ break;
+
+ case USER_NAME:
+ if (value == null) {
+ unsetUserName();
+ } else {
+ setUserName((String)value);
+ }
+ break;
+
+ case ROLE:
+ if (value == null) {
+ unsetRole();
+ } else {
+ setRole((TSentryRole)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return getProtocol_version();
+
+ case USER_NAME:
+ return getUserName();
+
+ case ROLE:
+ return getRole();
+
+ }
+ 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 USER_NAME:
+ return isSetUserName();
+ case ROLE:
+ return isSetRole();
+ }
+ 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 && this.isSetProtocol_version();
+ boolean that_present_protocol_version = true && that.isSetProtocol_version();
+ if (this_present_protocol_version || that_present_protocol_version) {
+ if (!(this_present_protocol_version && that_present_protocol_version))
+ return false;
+ if (!this.protocol_version.equals(that.protocol_version))
+ 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;
+ }
+
+ boolean this_present_role = true && this.isSetRole();
+ boolean that_present_role = true && that.isSetRole();
+ if (this_present_role || that_present_role) {
+ if (!(this_present_role && that_present_role))
+ return false;
+ if (!this.role.equals(that.role))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_protocol_version = true && (isSetProtocol_version());
+ builder.append(present_protocol_version);
+ if (present_protocol_version)
+ builder.append(protocol_version.getValue());
+
+ boolean present_userName = true && (isSetUserName());
+ builder.append(present_userName);
+ if (present_userName)
+ builder.append(userName);
+
+ boolean present_role = true && (isSetRole());
+ builder.append(present_role);
+ if (present_role)
+ builder.append(role);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TCreateSentryRoleRequest other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TCreateSentryRoleRequest typedOther = (TCreateSentryRoleRequest)other;
+
+ lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProtocol_version()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetUserName()).compareTo(typedOther.isSetUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userName, typedOther.userName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRole()).compareTo(typedOther.isSetRole());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRole()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.role, typedOther.role);
+ 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:");
+ if (this.protocol_version == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.protocol_version);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("userName:");
+ if (this.userName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.userName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("role:");
+ if (this.role == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.role);
+ }
+ 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 (!isSetUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'userName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRole()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'role' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (role != null) {
+ role.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 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 = TSentryPolicyServiceVersion.findByValue(iprot.readI32());
+ struct.setProtocol_versionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // 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;
+ case 3: // ROLE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.role = new TSentryRole();
+ struct.role.read(iprot);
+ struct.setRoleIsSet(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);
+ if (struct.protocol_version != null) {
+ oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
+ oprot.writeI32(struct.protocol_version.getValue());
+ oprot.writeFieldEnd();
+ }
+ if (struct.userName != null) {
+ oprot.writeFieldBegin(USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.userName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.role != null) {
+ oprot.writeFieldBegin(ROLE_FIELD_DESC);
+ struct.role.write(oprot);
+ 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.getValue());
+ oprot.writeString(struct.userName);
+ struct.role.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = TSentryPolicyServiceVersion.findByValue(iprot.readI32());
+ struct.setProtocol_versionIsSet(true);
+ struct.userName = iprot.readString();
+ struct.setUserNameIsSet(true);
+ struct.role = new TSentryRole();
+ struct.role.read(iprot);
+ struct.setRoleIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TCreateSentryRoleResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TCreateSentryRoleResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TCreateSentryRoleResponse.java
new file mode 100644
index 0000000..d1fee99
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/policystore/api/TCreateSentryRoleResponse.java
@@ -0,0 +1,383 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.policystore.api;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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 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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TCreateSentryRoleResponse implements org.apache.thrift.TBase<TCreateSentryRoleResponse, TCreateSentryRoleResponse._Fields>, java.io.Serializable, Cloneable {
+ 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 SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (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 boolean success; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ SUCCESS((short)1, "success");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // SUCCESS
+ return SUCCESS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __SUCCESS_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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TCreateSentryRoleResponse.class, metaDataMap);
+ }
+
+ public TCreateSentryRoleResponse() {
+ }
+
+ public TCreateSentryRoleResponse(
+ boolean success)
+ {
+ this();
+ this.success = success;
+ setSuccessIsSet(true);
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TCreateSentryRoleResponse(TCreateSentryRoleResponse other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.success = other.success;
+ }
+
+ public TCreateSentryRoleResponse deepCopy() {
+ return new TCreateSentryRoleResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ setSuccessIsSet(false);
+ this.success = false;
+ }
+
+ public boolean isSuccess() {
+ return this.success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ setSuccessIsSet(true);
+ }
+
+ public void unsetSuccess() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((Boolean)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return Boolean.valueOf(isSuccess());
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case SUCCESS:
+ return isSetSuccess();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TCreateSentryRoleResponse)
+ return this.equals((TCreateSentryRoleResponse)that);
+ return false;
+ }
+
+ public boolean equals(TCreateSentryRoleResponse that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true;
+ boolean that_present_success = true;
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (this.success != that.success)
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_success = true;
+ builder.append(present_success);
+ if (present_success)
+ builder.append(success);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TCreateSentryRoleResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TCreateSentryRoleResponse typedOther = (TCreateSentryRoleResponse)other;
+
+ lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSuccess()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("TCreateSentryRoleResponse(");
+ boolean first = true;
+
+ sb.append("success:");
+ sb.append(this.success);
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetSuccess()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'success' 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 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: // SUCCESS
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.success = iprot.readBool();
+ struct.setSuccessIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, TCreateSentryRoleResponse struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ oprot.writeBool(struct.success);
+ 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;
+ oprot.writeBool(struct.success);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.success = iprot.readBool();
+ struct.setSuccessIsSet(true);
+ }
+ }
+
+}
+
[7/7] git commit: SENTRY-76 - Create basic thrift infrastructure for
policy service (Shreepadma via Brock)
Posted by br...@apache.org.
SENTRY-76 - Create basic thrift infrastructure for policy service (Shreepadma via Brock)
Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/c6bec167
Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/c6bec167
Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/c6bec167
Branch: refs/heads/db_policy_store
Commit: c6bec16793a1e985ee9f3bd07727cc6c96b39262
Parents: b9aa0b7
Author: Brock Noland <br...@apache.org>
Authored: Fri Dec 27 12:51:35 2013 -0600
Committer: Brock Noland <br...@apache.org>
Committed: Fri Dec 27 12:51:35 2013 -0600
----------------------------------------------------------------------
pom.xml | 96 +-
sentry-provider/pom.xml | 1 +
sentry-provider/sentry-provider-db/pom.xml | 196 +
.../api/SentryThriftPolicyService.java | 4695 ++++++++++++++++++
.../api/TAlterSentryRoleAddGroupsRequest.java | 757 +++
.../api/TAlterSentryRoleAddGroupsResponse.java | 383 ++
.../TAlterSentryRoleDeleteGroupsRequest.java | 501 ++
.../TAlterSentryRoleDeleteGroupsResponse.java | 383 ++
.../api/TCreateSentryPrivilegeRequest.java | 607 +++
.../api/TCreateSentryPrivilegeResponse.java | 383 ++
.../api/TCreateSentryRoleRequest.java | 607 +++
.../api/TCreateSentryRoleResponse.java | 383 ++
.../api/TListSentryRolesRequest.java | 717 +++
.../api/TListSentryRolesResponse.java | 538 ++
.../api/TSentryAlreadyExistsException.java | 391 ++
.../sentry/policystore/api/TSentryGroup.java | 385 ++
.../api/TSentryNoSuchObjectException.java | 391 ++
.../api/TSentryPolicyServiceVersion.java | 42 +
.../policystore/api/TSentryPrivilege.java | 1210 +++++
.../sentry/policystore/api/TSentryRole.java | 740 +++
.../provider/db/service/model/MSentryGroup.java | 78 +
.../db/service/model/MSentryPrivilege.java | 141 +
.../provider/db/service/model/MSentryRole.java | 104 +
.../provider/db/service/model/package.jdo | 125 +
.../service/persistent/SentryPolicyStore.java | 406 ++
.../HiveMetaStoreSentryPolicyStoreHandler.java | 700 +++
.../thrift/SentryPolicyStoreHandler.java | 77 +
.../db/service/thrift/sentry_policystore.thrift | 134 +
28 files changed, 15154 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e74ef71..809cdb0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,11 +65,25 @@ limitations under the License.
<libthrift.version>0.9.0-cdh4-1</libthrift.version>
<hadoop.version>2.0.0-cdh4.4.0-SNAPSHOT</hadoop.version>
<zookeeper.version>3.4.5-cdh4.4.0-SNAPSHOT</zookeeper.version>
+ <libfb303.version>0.9.0</libfb303.version>
+ <ant.contrib.version>1.0b3</ant.contrib.version>
+ <maven.antrun.plugin.version>1.7</maven.antrun.plugin.version>
+ <maven.enforcer.plugin.version>1.3.1</maven.enforcer.plugin.version>
+ <build.helper.maven.plugin.version>1.8</build.helper.maven.plugin.version>
+ <datanucleus.maven.plugin.version>3.3.0-release</datanucleus.maven.plugin.version>
+ <datanucleus-api-jdo.version>3.2.1</datanucleus-api-jdo.version>
+ <datanucleus-core.version>3.2.2</datanucleus-core.version>
+ <datanucleus-rdbms.version>3.2.1</datanucleus-rdbms.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
+ <groupId>ant-contrib</groupId>
+ <artifactId>ant-contrib</artifactId>
+ <version>1.0b3</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>${derby.version}</version>
@@ -82,6 +96,12 @@ limitations under the License.
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libfb303</artifactId>
+ <version>${libfb303.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-common</artifactId>
<version>${hive.version}</version>
@@ -318,6 +338,24 @@ limitations under the License.
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>${maven.antrun.plugin.version}</version>
+ <dependencies>
+ <dependency>
+ <groupId>ant-contrib</groupId>
+ <artifactId>ant-contrib</artifactId>
+ <version>${ant.contrib.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
@@ -326,6 +364,30 @@ limitations under the License.
</configuration>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <version>${maven.enforcer.plugin.version}</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.16</version>
+ <configuration>
+ <forkMode>always</forkMode>
+ <environmentVariables>
+ <HADOOP_CLIENT_OPTS>-Xmx1000m -Dhive.log.dir=./target/</HADOOP_CLIENT_OPTS>
+ </environmentVariables>
+ <forkedProcessTimeoutInSeconds>900</forkedProcessTimeoutInSeconds>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <argLine>-Xms256m -Xmx1g</argLine>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<version>0.10</version>
@@ -356,35 +418,35 @@ limitations under the License.
<exclude>**/*.lck</exclude>
<!-- exclude generated solr config files -->
<exclude>**/solr/collection1/conf/**</exclude>
+ <!-- exclude generated thrift files -->
+ <exclude>**/gen/**</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
-
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.4</version>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>${build.helper.maven.plugin.version}</version>
</plugin>
-
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.16</version>
- <configuration>
- <forkMode>always</forkMode>
- <environmentVariables>
- <HADOOP_CLIENT_OPTS>-Xmx1000m -Dhive.log.dir=./target/</HADOOP_CLIENT_OPTS>
- </environmentVariables>
- <forkedProcessTimeoutInSeconds>900</forkedProcessTimeoutInSeconds>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- <argLine>-Xms256m -Xmx1g</argLine>
- </configuration>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-maven-plugin</artifactId>
+ <version>${datanucleus.maven.plugin.version}</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-core</artifactId>
+ <version>${datanucleus-core.version}</version>
+ </dependency>
+ </dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
+
+
<repositories>
<repository>
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/sentry-provider/pom.xml
----------------------------------------------------------------------
diff --git a/sentry-provider/pom.xml b/sentry-provider/pom.xml
index b1594cf..9bec058 100644
--- a/sentry-provider/pom.xml
+++ b/sentry-provider/pom.xml
@@ -32,6 +32,7 @@ limitations under the License.
<modules>
<module>sentry-provider-common</module>
<module>sentry-provider-file</module>
+ <module>sentry-provider-db</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c6bec167/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
new file mode 100644
index 0000000..38624c1
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/pom.xml
@@ -0,0 +1,196 @@
+<?xml version="1.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.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-provider</artifactId>
+ <version>1.3.0-incubating-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>sentry-provider-db</artifactId>
+ <name>Sentry Provider DB</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shiro</groupId>
+ <artifactId>shiro-core</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.sentry</groupId>
+ <artifactId>sentry-core-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-provider-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-metastore</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-shims</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libfb303</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>ant-contrib</groupId>
+ <artifactId>ant-contrib</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/main/java/org/apache/sentry/provider/db/service/model</source>
+ <source>src/gen/thrift/gen-javabean</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-maven-plugin</artifactId>
+ <configuration>
+ <api>JDO</api>
+ <verbose>true</verbose>
+ <metadataIncludes>**/*.jdo</metadataIncludes>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>enhance</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </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"/>
+ <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="." 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}/include -I ${basedir}/.. -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>