RangerAuthorizationCoprocessor implements AccessControlService.Interface, RegionCoprocessor, MasterCoprocessor, RegionServerCoprocessor, MasterObserver, RegionObserver, RegionServerObserver, EndpointObserver, BulkLoadObserver, Coprocessor { Map<String, Set<String>> getColumnFamilies(Map<byte[], ? extends Collection<?>> families) { if (families == null) { return Collections.<String, Set<String>>emptyMap(); } Map<String, Set<String>> result = new HashMap<String, Set<String>>(); for (Map.Entry<byte[], ? extends Collection<?>> anEntry : families.entrySet()) { byte[] familyBytes = anEntry.getKey(); String family = Bytes.toString(familyBytes); if (family == null || family.isEmpty()) { LOG.error("Unexpected Input: got null or empty column family (key) in families map! Ignoring..."); } else { Collection<?> columnCollection = anEntry.getValue(); if (CollectionUtils.isEmpty(columnCollection)) { result.put(family, Collections.<String> emptySet()); } else { Iterator<String> columnIterator = new ColumnIterator(columnCollection); Set<String> columns = new HashSet<String>(); try { while (columnIterator.hasNext()) { String column = columnIterator.next(); columns.add(column); } } catch (Throwable t) { LOG.error("Exception encountered when converting family-map to set of columns. Ignoring and returning empty set of columns for family[" + family + "]", t); LOG.error("Ignoring exception and returning empty set of columns for family[" + family +"]"); columns.clear(); } result.put(family, columns); } } } return result; }  @Override Optional<RegionObserver> getRegionObserver(); @Override Optional<MasterObserver> getMasterObserver(); @Override Optional<EndpointObserver> getEndpointObserver(); @Override Optional<BulkLoadObserver> getBulkLoadObserver(); @Override Optional<RegionServerObserver> getRegionServerObserver(); @Override void postScannerClose(ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s); @Override RegionScanner postScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Scan scan, RegionScanner s); @Override void postStartMaster(ObserverContext<MasterCoprocessorEnvironment> ctx); @Override Iterable<Service> getServices(); @Override Result preAppend(ObserverContext<RegionCoprocessorEnvironment> c, Append append); @Override void preAssign(ObserverContext<MasterCoprocessorEnvironment> c, RegionInfo regionInfo); @Override void preBalance(ObserverContext<MasterCoprocessorEnvironment> c); @Override void preBalanceSwitch(ObserverContext<MasterCoprocessorEnvironment> c, boolean newValue); @Override void preBulkLoadHFile(ObserverContext<RegionCoprocessorEnvironment> ctx, List<Pair<byte[], String>> familyPaths); @Override boolean preCheckAndDelete(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, byte[] qualifier, CompareOperator compareOp, ByteArrayComparable comparator, Delete delete, boolean result); @Override boolean preCheckAndPut(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, byte[] qualifier, CompareOperator compareOp, ByteArrayComparable comparator, Put put, boolean result); @Override void preCloneSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, SnapshotDescription snapshot, TableDescriptor hTableDescriptor); @Override void preClose(ObserverContext<RegionCoprocessorEnvironment> e, boolean abortRequested); @Override InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e, Store store, InternalScanner scanner,ScanType scanType, CompactionLifeCycleTracker tracker, CompactionRequest request); @Override void preCompactSelection(ObserverContext<RegionCoprocessorEnvironment> e, Store store, List<? extends StoreFile> candidates, CompactionLifeCycleTracker tracker); @Override void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> c, TableDescriptor desc, RegionInfo[] regions); @Override void preDelete(ObserverContext<RegionCoprocessorEnvironment> c, Delete delete, WALEdit edit, Durability durability); @Override void preDeleteSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, SnapshotDescription snapshot); @Override void preDeleteTable(ObserverContext<MasterCoprocessorEnvironment> c, TableName tableName); @Override void preDisableTable(ObserverContext<MasterCoprocessorEnvironment> c, TableName tableName); @Override void preEnableTable(ObserverContext<MasterCoprocessorEnvironment> c, TableName tableName); @Override boolean preExists(ObserverContext<RegionCoprocessorEnvironment> c, Get get, boolean exists); @Override void preFlush(ObserverContext<RegionCoprocessorEnvironment> e, FlushLifeCycleTracker tracker); @Override Result preIncrement(ObserverContext<RegionCoprocessorEnvironment> c, Increment increment); @Override void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> c, TableName tableName, TableDescriptor htd); @Override void preMove(ObserverContext<MasterCoprocessorEnvironment> c, RegionInfo region, ServerName srcServer, ServerName destServer); @Override void preAbortProcedure(ObserverContext<MasterCoprocessorEnvironment> observerContext, long procId); @Override void postGetProcedures(ObserverContext<MasterCoprocessorEnvironment> observerContext); @Override void preOpen(ObserverContext<RegionCoprocessorEnvironment> e); @Override void preRestoreSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, SnapshotDescription snapshot, TableDescriptor hTableDescriptor); @Override void preScannerClose(ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s); @Override boolean preScannerNext(ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s, List<Result> result, int limit, boolean hasNext); @Override void preScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Scan scan); @Override void preShutdown(ObserverContext<MasterCoprocessorEnvironment> c); @Override void preSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, SnapshotDescription snapshot, TableDescriptor hTableDescriptor); @Override void preStopMaster(ObserverContext<MasterCoprocessorEnvironment> c); @Override void preStopRegionServer(ObserverContext<RegionServerCoprocessorEnvironment> env); @Override void preUnassign(ObserverContext<MasterCoprocessorEnvironment> c, RegionInfo regionInfo, boolean force); @Override void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
      final String userName, final GlobalQuotaSettings quotas); @Override void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
      final String userName, final TableName tableName, final GlobalQuotaSettings quotas); @Override void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
      final String userName, final String namespace, final GlobalQuotaSettings quotas); @Override void preSetTableQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
      final TableName tableName, final GlobalQuotaSettings quotas); @Override void preSetNamespaceQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
      final String namespace, final GlobalQuotaSettings quotas); @Override void start(CoprocessorEnvironment env); @Override void prePut(ObserverContext<RegionCoprocessorEnvironment> c, Put put, WALEdit edit, Durability durability); @Override void preGetOp(final ObserverContext<RegionCoprocessorEnvironment> rEnv, final Get get, final List<Cell> result); @Override void preRegionOffline(ObserverContext<MasterCoprocessorEnvironment> c, RegionInfo regionInfo); @Override void preCreateNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx, NamespaceDescriptor ns); @Override void preDeleteNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx, String namespace); @Override void preModifyNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx, NamespaceDescriptor ns); @Override void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx, List<TableName> tableNamesList, List<TableDescriptor> descriptors, String regex); void prePrepareBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx, PrepareBulkLoadRequest request); void preCleanupBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx, CleanupBulkLoadRequest request); @Override Message preEndpointInvocation(ObserverContext<RegionCoprocessorEnvironment> ctx,
										 Service service, String methodName, Message request); @Override void grant(RpcController controller, AccessControlProtos.GrantRequest request, RpcCallback<AccessControlProtos.GrantResponse> done); @Override void revoke(RpcController controller, AccessControlProtos.RevokeRequest request, RpcCallback<AccessControlProtos.RevokeResponse> done); @Override void checkPermissions(RpcController controller, AccessControlProtos.CheckPermissionsRequest request, RpcCallback<AccessControlProtos.CheckPermissionsResponse> done); @Override void getUserPermissions(RpcController controller, AccessControlProtos.GetUserPermissionsRequest request,
			RpcCallback<AccessControlProtos.GetUserPermissionsResponse> done);  }
@Test public void test_getColumnFamilies_firewalling() { RangerAuthorizationCoprocessor _coprocessor = new RangerAuthorizationCoprocessor(); Map<String, Set<String>> result = _coprocessor.getColumnFamilies(null); assertNotNull(result); assertTrue(result.isEmpty()); }