@SuppressWarnings("rawtypes") @Test public void testGetTableSummariesNoTables() throws Exception { Map<String, List> data = TableUtil.getTableSummaries(); assertEquals(0, data.get("tables").size()); }
@SuppressWarnings("rawtypes") public static Map<String, List> getTableSummaries() throws TException { CachingBlurClient client = Config.getCachingBlurClient(); List<Map<String, Object>> summaries = new ArrayList<Map<String, Object>>(); List<String> clusters = client.shardClusterList(); for (String cluster : clusters) { List<String> tables = client.tableListByCluster(cluster); for (String table : tables) { Map<String, Object> tableInfo = new HashMap<String, Object>(); tableInfo.put("cluster", cluster); tableInfo.put("name", table); try { TableDescriptor descriptor = client.describe(table); tableInfo.put("enabled", descriptor.isEnabled()); tableInfo.put("readonly", descriptor.isReadOnly()); if (descriptor.isEnabled()) { TableStats stats = client.tableStats(table); tableInfo.put("rows", stats.getRowCount()); tableInfo.put("records", stats.getRecordCount()); Schema schema = client.schema(table); tableInfo.put("families", new ArrayList<String>(schema.getFamilies().keySet())); } else { tableInfo.put("rows", "?"); tableInfo.put("records", "?"); tableInfo.put("families", new ArrayList<String>()); } } catch(Exception e) { tableInfo.put("error", e.getMessage()); } summaries.add(tableInfo); } } Map<String, List> data = new HashMap<String, List>(); data.put("tables", summaries); data.put("clusters", clusters); return data; }
TableUtil { @SuppressWarnings("rawtypes") public static Map<String, List> getTableSummaries() throws TException { CachingBlurClient client = Config.getCachingBlurClient(); List<Map<String, Object>> summaries = new ArrayList<Map<String, Object>>(); List<String> clusters = client.shardClusterList(); for (String cluster : clusters) { List<String> tables = client.tableListByCluster(cluster); for (String table : tables) { Map<String, Object> tableInfo = new HashMap<String, Object>(); tableInfo.put("cluster", cluster); tableInfo.put("name", table); try { TableDescriptor descriptor = client.describe(table); tableInfo.put("enabled", descriptor.isEnabled()); tableInfo.put("readonly", descriptor.isReadOnly()); if (descriptor.isEnabled()) { TableStats stats = client.tableStats(table); tableInfo.put("rows", stats.getRowCount()); tableInfo.put("records", stats.getRecordCount()); Schema schema = client.schema(table); tableInfo.put("families", new ArrayList<String>(schema.getFamilies().keySet())); } else { tableInfo.put("rows", "?"); tableInfo.put("records", "?"); tableInfo.put("families", new ArrayList<String>()); } } catch(Exception e) { tableInfo.put("error", e.getMessage()); } summaries.add(tableInfo); } } Map<String, List> data = new HashMap<String, List>(); data.put("tables", summaries); data.put("clusters", clusters); return data; } }
TableUtil { @SuppressWarnings("rawtypes") public static Map<String, List> getTableSummaries() throws TException { CachingBlurClient client = Config.getCachingBlurClient(); List<Map<String, Object>> summaries = new ArrayList<Map<String, Object>>(); List<String> clusters = client.shardClusterList(); for (String cluster : clusters) { List<String> tables = client.tableListByCluster(cluster); for (String table : tables) { Map<String, Object> tableInfo = new HashMap<String, Object>(); tableInfo.put("cluster", cluster); tableInfo.put("name", table); try { TableDescriptor descriptor = client.describe(table); tableInfo.put("enabled", descriptor.isEnabled()); tableInfo.put("readonly", descriptor.isReadOnly()); if (descriptor.isEnabled()) { TableStats stats = client.tableStats(table); tableInfo.put("rows", stats.getRowCount()); tableInfo.put("records", stats.getRecordCount()); Schema schema = client.schema(table); tableInfo.put("families", new ArrayList<String>(schema.getFamilies().keySet())); } else { tableInfo.put("rows", "?"); tableInfo.put("records", "?"); tableInfo.put("families", new ArrayList<String>()); } } catch(Exception e) { tableInfo.put("error", e.getMessage()); } summaries.add(tableInfo); } } Map<String, List> data = new HashMap<String, List>(); data.put("tables", summaries); data.put("clusters", clusters); return data; }  }
TableUtil { @SuppressWarnings("rawtypes") public static Map<String, List> getTableSummaries() throws TException { CachingBlurClient client = Config.getCachingBlurClient(); List<Map<String, Object>> summaries = new ArrayList<Map<String, Object>>(); List<String> clusters = client.shardClusterList(); for (String cluster : clusters) { List<String> tables = client.tableListByCluster(cluster); for (String table : tables) { Map<String, Object> tableInfo = new HashMap<String, Object>(); tableInfo.put("cluster", cluster); tableInfo.put("name", table); try { TableDescriptor descriptor = client.describe(table); tableInfo.put("enabled", descriptor.isEnabled()); tableInfo.put("readonly", descriptor.isReadOnly()); if (descriptor.isEnabled()) { TableStats stats = client.tableStats(table); tableInfo.put("rows", stats.getRowCount()); tableInfo.put("records", stats.getRecordCount()); Schema schema = client.schema(table); tableInfo.put("families", new ArrayList<String>(schema.getFamilies().keySet())); } else { tableInfo.put("rows", "?"); tableInfo.put("records", "?"); tableInfo.put("families", new ArrayList<String>()); } } catch(Exception e) { tableInfo.put("error", e.getMessage()); } summaries.add(tableInfo); } } Map<String, List> data = new HashMap<String, List>(); data.put("tables", summaries); data.put("clusters", clusters); return data; }  @SuppressWarnings("rawtypes") static Map<String, List> getTableSummaries(); static Map<String, Map<String, Map<String, Object>>> getSchema(String table); static List<String> getTerms(String table, String family, String column, String startWith); static void disableTable(String table); static void enableTable(String table); static void deleteTable(String table, boolean includeFiles); static void copyTable(String srcTable, String destTable, String destLocation, String cluster); }
TableUtil { @SuppressWarnings("rawtypes") public static Map<String, List> getTableSummaries() throws TException { CachingBlurClient client = Config.getCachingBlurClient(); List<Map<String, Object>> summaries = new ArrayList<Map<String, Object>>(); List<String> clusters = client.shardClusterList(); for (String cluster : clusters) { List<String> tables = client.tableListByCluster(cluster); for (String table : tables) { Map<String, Object> tableInfo = new HashMap<String, Object>(); tableInfo.put("cluster", cluster); tableInfo.put("name", table); try { TableDescriptor descriptor = client.describe(table); tableInfo.put("enabled", descriptor.isEnabled()); tableInfo.put("readonly", descriptor.isReadOnly()); if (descriptor.isEnabled()) { TableStats stats = client.tableStats(table); tableInfo.put("rows", stats.getRowCount()); tableInfo.put("records", stats.getRecordCount()); Schema schema = client.schema(table); tableInfo.put("families", new ArrayList<String>(schema.getFamilies().keySet())); } else { tableInfo.put("rows", "?"); tableInfo.put("records", "?"); tableInfo.put("families", new ArrayList<String>()); } } catch(Exception e) { tableInfo.put("error", e.getMessage()); } summaries.add(tableInfo); } } Map<String, List> data = new HashMap<String, List>(); data.put("tables", summaries); data.put("clusters", clusters); return data; }  @SuppressWarnings("rawtypes") static Map<String, List> getTableSummaries(); static Map<String, Map<String, Map<String, Object>>> getSchema(String table); static List<String> getTerms(String table, String family, String column, String startWith); static void disableTable(String table); static void enableTable(String table); static void deleteTable(String table, boolean includeFiles); static void copyTable(String srcTable, String destTable, String destLocation, String cluster);  }