ThemisMasterObserver extends BaseMasterObserver { public static List<String> getThemisTables(HConnection connection) throws IOException { List<String> tableNames = new ArrayList<String>(); HBaseAdmin admin = null; try { admin = new HBaseAdmin(connection); HTableDescriptor[] tables = admin.listTables(); for (HTableDescriptor table : tables) { if (isThemisEnableTable(table)) { tableNames.add(table.getNameAsString()); } } } catch (IOException e) { LOG.error("get table names fail", e); throw e; } finally { if (admin != null) { admin.close(); } } return tableNames; }  @Override void start(CoprocessorEnvironment ctx); @Override void stop(CoprocessorEnvironment ctx); @Override void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
      HTableDescriptor desc, HRegionInfo[] regions); @Override void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
      List<HTableDescriptor> descriptors); static boolean isThemisEnableFamily(HColumnDescriptor desc); static boolean isThemisEnableTable(HTableDescriptor desc); static List<String> getThemisTables(HConnection connection); static String getThemisExpiredTsZNodePath(ZooKeeperWatcher zk); static long getThemisExpiredTsFromZk(ZooKeeperWatcher zk); static long getThemisExpiredTsFromZk(ZooKeeperWatcher zk, String path); void setExpiredTsToZk(long currentExpiredTs); void cleanLockBeforeTimestamp(long ts); static final String RETURNED_THEMIS_TABLE_DESC; static final String THEMIS_ENABLE_KEY; static final String THEMIS_EXPIRED_TIMESTAMP_CALCULATE_PERIOD_KEY; static final String THEMIS_EXPIRED_DATA_CLEAN_ENABLE_KEY; static final String THEMIS_EXPIRED_TIMESTAMP_ZNODE_NAME; }
@Test public void testGetThemisTables() throws IOException { List<String> themisTableNames = ThemisMasterObserver.getThemisTables(connection); Assert.assertTrue(themisTableNames.contains(Bytes.toString(TABLENAME))); Assert.assertTrue(themisTableNames.contains(Bytes.toString(ANOTHER_TABLENAME))); }