當前位置: 首頁>>代碼示例>>Java>>正文


Java HTableDescriptor.setOwner方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.HTableDescriptor.setOwner方法的典型用法代碼示例。如果您正苦於以下問題:Java HTableDescriptor.setOwner方法的具體用法?Java HTableDescriptor.setOwner怎麽用?Java HTableDescriptor.setOwner使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.HTableDescriptor的用法示例。


在下文中一共展示了HTableDescriptor.setOwner方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setUp

import org.apache.hadoop.hbase.HTableDescriptor; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
  // Create the test table (owner added to the _acl_ table)
  Admin admin = TEST_UTIL.getHBaseAdmin();
  HTableDescriptor htd = new HTableDescriptor(TEST_TABLE.getTableName());
  HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY);
  hcd.setMaxVersions(4);
  htd.setOwner(USER_OWNER);
  htd.addFamily(hcd);
  admin.createTable(htd, new byte[][] { Bytes.toBytes("s") });
  TEST_UTIL.waitTableEnabled(TEST_TABLE.getTableName());
  LOG.info("Sleeping a second because of HBASE-12581");
  Threads.sleep(1000);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:15,代碼來源:TestCellACLs.java

示例2: createTestTable

import org.apache.hadoop.hbase.HTableDescriptor; //導入方法依賴的package包/類
private void createTestTable(TableName tname) throws Exception {
  HTableDescriptor htd = new HTableDescriptor(tname);
  HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY);
  hcd.setMaxVersions(100);
  htd.addFamily(hcd);
  htd.setOwner(USER_OWNER);
  createTable(TEST_UTIL, htd, new byte[][]{Bytes.toBytes("s")});
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:9,代碼來源:TestAccessController.java

示例3: setUp

import org.apache.hadoop.hbase.HTableDescriptor; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
  // Create the test table (owner added to the _acl_ table)
  Admin admin = TEST_UTIL.getHBaseAdmin();
  HTableDescriptor htd = new HTableDescriptor(TEST_TABLE.getTableName());
  HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY);
  hcd.setMaxVersions(100);
  htd.addFamily(hcd);
  htd.setOwner(USER_OWNER);
  admin.createTable(htd, new byte[][] { Bytes.toBytes("s") });
  TEST_UTIL.waitUntilAllRegionsAssigned(TEST_TABLE.getTableName());

  Region region = TEST_UTIL.getHBaseCluster().getRegions(TEST_TABLE.getTableName()).get(0);
  RegionCoprocessorHost rcpHost = region.getCoprocessorHost();
  RCP_ENV = rcpHost.createEnvironment(AccessController.class, ACCESS_CONTROLLER,
    Coprocessor.PRIORITY_HIGHEST, 1, TEST_UTIL.getConfiguration());

  // Set up initial grants

  grantGlobal(TEST_UTIL, USER_ADMIN.getShortName(),
    Permission.Action.ADMIN,
    Permission.Action.CREATE,
    Permission.Action.READ,
    Permission.Action.WRITE);

  grantOnTable(TEST_UTIL, USER_RW.getShortName(),
    TEST_TABLE.getTableName(), TEST_FAMILY, null,
    Permission.Action.READ,
    Permission.Action.WRITE);

  // USER_CREATE is USER_RW plus CREATE permissions
  grantOnTable(TEST_UTIL, USER_CREATE.getShortName(),
    TEST_TABLE.getTableName(), null, null,
    Permission.Action.CREATE,
    Permission.Action.READ,
    Permission.Action.WRITE);

  grantOnTable(TEST_UTIL, USER_RO.getShortName(),
    TEST_TABLE.getTableName(), TEST_FAMILY, null,
    Permission.Action.READ);

  grantOnTable(TEST_UTIL, USER_QUAL.getShortName(),
    TEST_TABLE.getTableName(), TEST_FAMILY, TEST_Q1,
    Permission.Action.READ,
    Permission.Action.WRITE);

  assertEquals(5, AccessControlLists.getTablePermissions(TEST_UTIL.getConfiguration(),
    TEST_TABLE.getTableName()).size());
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:50,代碼來源:TestWithDisabledAuthorization.java

示例4: setUpTableAndUserPermissions

import org.apache.hadoop.hbase.HTableDescriptor; //導入方法依賴的package包/類
private static void setUpTableAndUserPermissions() throws Exception {
  HTableDescriptor htd = new HTableDescriptor(TEST_TABLE);
  HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY);
  hcd.setMaxVersions(100);
  htd.addFamily(hcd);
  htd.setOwner(USER_OWNER);
  createTable(TEST_UTIL, htd, new byte[][] { Bytes.toBytes("s") });

  Region region = TEST_UTIL.getHBaseCluster().getRegions(TEST_TABLE).get(0);
  RegionCoprocessorHost rcpHost = region.getCoprocessorHost();
  RCP_ENV = rcpHost.createEnvironment(AccessController.class, ACCESS_CONTROLLER,
    Coprocessor.PRIORITY_HIGHEST, 1, conf);

  // Set up initial grants

  grantGlobal(TEST_UTIL, USER_ADMIN.getShortName(),
    Permission.Action.ADMIN,
    Permission.Action.CREATE,
    Permission.Action.READ,
    Permission.Action.WRITE);

  grantOnTable(TEST_UTIL, USER_RW.getShortName(),
    TEST_TABLE, TEST_FAMILY, null,
    Permission.Action.READ,
    Permission.Action.WRITE);

  // USER_CREATE is USER_RW plus CREATE permissions
  grantOnTable(TEST_UTIL, USER_CREATE.getShortName(),
    TEST_TABLE, null, null,
    Permission.Action.CREATE,
    Permission.Action.READ,
    Permission.Action.WRITE);

  grantOnTable(TEST_UTIL, USER_RO.getShortName(),
    TEST_TABLE, TEST_FAMILY, null,
    Permission.Action.READ);

  grantOnTable(TEST_UTIL, USER_ADMIN_CF.getShortName(),
    TEST_TABLE, TEST_FAMILY,
    null, Permission.Action.ADMIN, Permission.Action.CREATE);

  grantGlobal(TEST_UTIL, toGroupEntry(GROUP_ADMIN), Permission.Action.ADMIN);
  grantGlobal(TEST_UTIL, toGroupEntry(GROUP_CREATE), Permission.Action.CREATE);
  grantGlobal(TEST_UTIL, toGroupEntry(GROUP_READ), Permission.Action.READ);
  grantGlobal(TEST_UTIL, toGroupEntry(GROUP_WRITE), Permission.Action.WRITE);

  assertEquals(5, AccessControlLists.getTablePermissions(conf, TEST_TABLE).size());
  try {
    assertEquals(5, AccessControlClient.getUserPermissions(systemUserConnection,
        TEST_TABLE.toString()).size());
  } catch (Throwable e) {
    LOG.error("error during call of AccessControlClient.getUserPermissions. ", e);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:55,代碼來源:TestAccessController.java


注:本文中的org.apache.hadoop.hbase.HTableDescriptor.setOwner方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。