当前位置: 首页>>代码示例>>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;未经允许,请勿转载。