sentryStore.createSentryRole(roleName1, grantor);
sentryStore.createSentryRole(roleName2, grantor);
sentryStore.createSentryRole(roleName3, grantor);
TSentryPrivilege privilege_tbl1 = new TSentryPrivilege();
privilege_tbl1.setPrivilegeScope("TABLE");
privilege_tbl1.setServerName("server1");
privilege_tbl1.setDbName("db1");
privilege_tbl1.setTableName(table1);
privilege_tbl1.setGrantorPrincipal(grantor);
privilege_tbl1.setCreateTime(System.currentTimeMillis());
privilege_tbl1.setPrivilegeName(SentryStore
.constructPrivilegeName(privilege_tbl1));
TSentryPrivilege privilege_tbl1_insert = new TSentryPrivilege(
privilege_tbl1);
privilege_tbl1_insert.setAction(AccessConstants.INSERT);
privilege_tbl1_insert.setPrivilegeName(SentryStore
.constructPrivilegeName(privilege_tbl1_insert));
TSentryPrivilege privilege_tbl1_select = new TSentryPrivilege(
privilege_tbl1);
privilege_tbl1_select.setAction(AccessConstants.SELECT);
privilege_tbl1_select.setPrivilegeName(SentryStore
.constructPrivilegeName(privilege_tbl1_select));
TSentryPrivilege privilege_tbl1_all = new TSentryPrivilege(privilege_tbl1);
privilege_tbl1_all.setAction(AccessConstants.ALL);
privilege_tbl1_all.setPrivilegeName(SentryStore
.constructPrivilegeName(privilege_tbl1_all));
sentryStore.alterSentryRoleGrantPrivilege(roleName1, privilege_tbl1_insert);
sentryStore.alterSentryRoleGrantPrivilege(roleName2, privilege_tbl1_select);
sentryStore.alterSentryRoleGrantPrivilege(roleName3, privilege_tbl1_all);