Java Code Examples for org.apache.hadoop.hbase.TableName#getNameWithNamespaceInclAsString()
The following examples show how to use
org.apache.hadoop.hbase.TableName#getNameWithNamespaceInclAsString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HBaseAtlasHook.java From atlas with Apache License 2.0 | 6 votes |
private void deleteTableInstance(HBaseOperationContext hbaseOperationContext) { TableName tableName = hbaseOperationContext.getTableName(); String nameSpaceName = tableName.getNamespaceAsString(); if (nameSpaceName == null) { nameSpaceName = tableName.getNameWithNamespaceInclAsString(); } String tableNameStr = tableName.getNameAsString(); String tableQName = getTableQualifiedName(getMetadataNamespace(), nameSpaceName, tableNameStr); AtlasObjectId tableId = new AtlasObjectId(HBaseDataTypes.HBASE_TABLE.getName(), REFERENCEABLE_ATTRIBUTE_NAME, tableQName); LOG.info("Delete Table {}", tableQName); hbaseOperationContext.addMessage(new EntityDeleteRequestV2(hbaseOperationContext.getUser(), Collections.singletonList(tableId))); }
Example 2
Source File: HBaseAtlasHook.java From atlas with Apache License 2.0 | 6 votes |
private void deleteColumnFamilyInstance(HBaseOperationContext hbaseOperationContext) { TableName tableName = hbaseOperationContext.getTableName(); String nameSpaceName = tableName.getNamespaceAsString(); if (nameSpaceName == null) { nameSpaceName = tableName.getNameWithNamespaceInclAsString(); } String tableNameStr = tableName.getNameAsString(); String columnFamilyName = hbaseOperationContext.getColummFamily(); String columnFamilyQName = getColumnFamilyQualifiedName(getMetadataNamespace(), nameSpaceName, tableNameStr, columnFamilyName); AtlasObjectId columnFamilyId = new AtlasObjectId(HBaseDataTypes.HBASE_COLUMN_FAMILY.getName(), REFERENCEABLE_ATTRIBUTE_NAME, columnFamilyQName); LOG.info("Delete ColumnFamily {}", columnFamilyQName); hbaseOperationContext.addMessage(new EntityDeleteRequestV2(hbaseOperationContext.getUser(), Collections.singletonList(columnFamilyId))); }
Example 3
Source File: HBaseAtlasHook.java From atlas with Apache License 2.0 | 6 votes |
private HBaseOperationContext handleHBaseColumnFamilyOperation(ColumnFamilyDescriptor columnFamilyDescriptor, TableName tableName, String columnFamily, OPERATION operation, UserGroupInformation ugi, String userName) { if (LOG.isDebugEnabled()) { LOG.debug("==> HBaseAtlasHook.handleHBaseColumnFamilyOperation()"); } String owner = userName; Map<String, String> hbaseConf = new HashMap<>(); String tableNameSpace = tableName.getNamespaceAsString(); if (tableNameSpace == null) { tableNameSpace = tableName.getNameWithNamespaceInclAsString(); } if (columnFamilyDescriptor != null) { hbaseConf = columnFamilyDescriptor.getConfiguration(); } HBaseOperationContext hbaseOperationContext = new HBaseOperationContext(tableNameSpace, tableName, columnFamilyDescriptor, columnFamily, operation, ugi, userName, owner, hbaseConf); createAtlasInstances(hbaseOperationContext); if (LOG.isDebugEnabled()) { LOG.debug("<== HBaseAtlasHook.handleHBaseColumnFamilyOperation(): {}", hbaseOperationContext); } return hbaseOperationContext; }
Example 4
Source File: TestAccessController.java From hbase with Apache License 2.0 | 6 votes |
@Test public void testAccessControlClientUserPerms() throws Exception { final TableName tableName = TableName.valueOf(name.getMethodName()); createTestTable(tableName); try { final String regex = tableName.getNameWithNamespaceInclAsString(); User testUserPerms = User.createUserForTesting(conf, "testUserPerms", new String[0]); assertEquals(0, testUserPerms.runAs(getPrivilegedAction(regex)).size()); // Grant TABLE ADMIN privs to testUserPerms grantOnTable(TEST_UTIL, testUserPerms.getShortName(), tableName, null, null, Action.ADMIN); List<UserPermission> perms = testUserPerms.runAs(getPrivilegedAction(regex)); assertNotNull(perms); // Superuser, testUserPerms assertEquals(2, perms.size()); } finally { deleteTable(TEST_UTIL, tableName); } }
Example 5
Source File: HBaseAtlasHook.java From atlas with Apache License 2.0 | 5 votes |
private HBaseOperationContext handleHBaseTableOperation(TableDescriptor tableDescriptor, TableName tableName, OPERATION operation, UserGroupInformation ugi, String userName) { if (LOG.isDebugEnabled()) { LOG.debug("==> HBaseAtlasHook.handleHBaseTableOperation()"); } Map<String, String> hbaseConf = null; String owner = null; String tableNameSpace = null; TableName hbaseTableName = null; ColumnFamilyDescriptor[] columnFamilyDescriptors = null; if (tableDescriptor != null) { owner = tableDescriptor.getOwnerString(); hbaseConf = null; hbaseTableName = tableDescriptor.getTableName(); if (hbaseTableName != null) { tableNameSpace = hbaseTableName.getNamespaceAsString(); if (tableNameSpace == null) { tableNameSpace = hbaseTableName.getNameWithNamespaceInclAsString(); } } } if (owner == null) { owner = userName; } if (tableDescriptor != null) { columnFamilyDescriptors = tableDescriptor.getColumnFamilies(); } HBaseOperationContext hbaseOperationContext = new HBaseOperationContext(tableNameSpace, tableDescriptor, tableName, columnFamilyDescriptors, operation, ugi, userName, owner, hbaseConf); createAtlasInstances(hbaseOperationContext); if (LOG.isDebugEnabled()) { LOG.debug("<== HBaseAtlasHook.handleHBaseTableOperation(): {}", hbaseOperationContext); } return hbaseOperationContext; }
Example 6
Source File: ReplicationSink.java From hbase with Apache License 2.0 | 5 votes |
private void buildBulkLoadHFileMap( final Map<String, List<Pair<byte[], List<String>>>> bulkLoadHFileMap, TableName table, BulkLoadDescriptor bld) throws IOException { List<StoreDescriptor> storesList = bld.getStoresList(); int storesSize = storesList.size(); for (int j = 0; j < storesSize; j++) { StoreDescriptor storeDescriptor = storesList.get(j); List<String> storeFileList = storeDescriptor.getStoreFileList(); int storeFilesSize = storeFileList.size(); hfilesReplicated += storeFilesSize; for (int k = 0; k < storeFilesSize; k++) { byte[] family = storeDescriptor.getFamilyName().toByteArray(); // Build hfile relative path from its namespace String pathToHfileFromNS = getHFilePath(table, bld, storeFileList.get(k), family); String tableName = table.getNameWithNamespaceInclAsString(); List<Pair<byte[], List<String>>> familyHFilePathsList = bulkLoadHFileMap.get(tableName); if (familyHFilePathsList != null) { boolean foundFamily = false; for (Pair<byte[], List<String>> familyHFilePathsPair : familyHFilePathsList) { if (Bytes.equals(familyHFilePathsPair.getFirst(), family)) { // Found family already present, just add the path to the existing list familyHFilePathsPair.getSecond().add(pathToHfileFromNS); foundFamily = true; break; } } if (!foundFamily) { // Family not found, add this family and its hfile paths pair to the list addFamilyAndItsHFilePathToTableInMap(family, pathToHfileFromNS, familyHFilePathsList); } } else { // Add this table entry into the map addNewTableEntryInMap(bulkLoadHFileMap, family, pathToHfileFromNS, tableName); } } } }