private HashMap<String, String[][]> getObjectList( ResultScanner resultScan, byte[][] family, List<byte[]> rowKeyList) { String tableFamilies; // = new table; String data[][]; String rowKey; HashMap<String, String[][]> tableDataList = new HashMap<String, String[][]>(); long k = 0; for (Result rows : resultScan) { System.out.println("Rows passed : " + (++k)); for (int i = 0; i < family.length; i++) { tableFamilies = Bytes.toString(family[i]); rowKey = Bytes.toString(rows.getRow()); rowKeyList.add(rows.getRow()); if (tblMngr.getDataFiller(rows, tableFamilies)) { data = tblMngr.getResultMap(); tableFamilies = tableFamilies + "," + rowKey; tableDataList.put(tableFamilies, data); } } } return tableDataList; }
public void insertRowToDb(String[][] tableData, String colFamily) { String rowKey = tableData[0][0]; Put resourcePut = new Put(Bytes.toBytes(rowKey)); String[] userDataList = new String[tableData.length]; String[] userColList = new String[tableData.length]; String valueString = null; byte[] putValue = null; String action = null; for (int i = 0; i < tableData.length; i++) { userDataList[i] = tableData[i][0]; userColList[i] = tableData[i][1]; } for (int i = 1; i < userDataList.length; i++) { valueString = userDataList[i]; if (HBaseManagerViewTable.coloumnTypeList.containsKey(userColList[i])) { action = HBaseManagerViewTable.coloumnTypeList.get(userColList[i]); putValue = HBaseTableManager.getConvertedValue(valueString, action, userColList[i]); } else { putValue = Bytes.toBytes(userDataList[i]); } resourcePut.add(Bytes.toBytes(colFamily), Bytes.toBytes(userColList[i]), putValue); } _insert(resourcePut); }
public static ResultScanner getAllFamilyList( String startRowRange, String stopRowRange, byte[][] cfs, String ctableName) { Scan scan = new Scan(); scan.setStartRow(Bytes.toBytes(startRowRange)); for (byte[] family : cfs) { scan.addFamily(family); } if (stopRowRange != null) { scan.setStopRow(Bytes.toBytes(stopRowRange)); } ResultScanner resultScanner = null; try { resultScanner = tblMngr.getTable(ctableName).getScanner(scan); } catch (Exception e) { } return resultScanner; }
public static ResultScanner getList( String startRowRange, String stopRowRange, byte[] cf1, byte[] cf2, long limit, FilterList filterList, String ctableName) { Scan scan = new Scan(); scan.addFamily(cf1); scan.setStartRow(Bytes.toBytes(startRowRange)); if (stopRowRange != null) { scan.setStopRow(Bytes.toBytes(stopRowRange)); } if (limit != 0) { filterList.addFilter(new PageFilter(limit)); } else { filterList.addFilter(new PageFilter(100)); } scan.setFilter(filterList); ResultScanner resultScanner = null; try { resultScanner = tblMngr.getTable(ctableName).getScanner(scan); } catch (Exception e) { } return resultScanner; }
private void populateAvailableTables() { String[] tables = HBaseTableManager.getAllTableNames(); for (int i = 0; i < tables.length; i++) listBackupAllTablesModel.addElement(tables[i]); }
public String[] getTableNames() { return HBaseTableManager.getAllTableNames(); }
public String[] getColoumnFamilyVersions(String tableName) { return tblMngr.getColFamilyVersions(tblMngr.getTable(tableName)); }
public static void setTable(String tableName1) { table = tblMngr.getTable(tableName1); }
public HbaseManagerTableGetter(String tablename) { table = tblMngr.getTable(tablename); }