@Override
    public List<HBaseData> LoadData(HTableInterface hTable, String columnFamily, Object rowKey, Filter filter,
            String... columns) throws IOException
    {
        List<HBaseData> results = new ArrayList<HBaseData>();
        if (scanner == null)
        {

            // only in case of find by id
            Scan scan = null;
            if (rowKey != null)
            {
                byte[] rowKeyBytes = HBaseUtils.getBytes(rowKey);
                Get g = new Get(rowKeyBytes);

                // TODO: After more than one column family for 1 table. this
                // should work. currently failing for embeddable entities.
                if (columnFamily != null)
                {
                    g.addFamily(Bytes.toBytes(columnFamily));
                }

                if (filter != null)
                {
                    g.setFilter(filter);
                }
                Result result = hTable.get(g);

                if (result != null && result.list() != null)
                {
                    HBaseData data = null;
                    for (KeyValue value : result.list())
                    {
                        data = new HBaseData(columnFamily != null ? columnFamily : new String(value.getFamily()),
                                value.getRow());
                        break;
                    }

                    if (data != null)
                    {
                        data.setColumns(result.list());
                        results.add(data);
                    }

                }
                return results;

                // scan = new Scan(g);
            }
            else
            {
                scan = new Scan();
            }
            setScanCriteria(filter, columnFamily, null, scan, columns);
            scanner = hTable.getScanner(scan);
            resultsIter = scanner.iterator();
        }
        return scanResults(columnFamily, results);
    }
@ Override public List < HBaseData > LoadData ( HTableInterface hTable , String columnFamily , Object rowKey , Filter filter , String ... columns ) throws IOException { List < HBaseData > results = new ArrayList < HBaseData > ( ) ; if ( scanner == null ) { Scan scan = null ; if ( rowKey != null ) { byte [ ] rowKeyBytes = HBaseUtils . getBytes ( rowKey ) ; Get g = new Get ( rowKeyBytes ) ; if ( columnFamily != null ) { g . addFamily ( Bytes . toBytes ( columnFamily ) ) ; } if ( filter != null ) { g . setFilter ( filter ) ; } Result result = hTable . get ( g ) ; if ( result != null && result . list ( ) != null ) { HBaseData data = null ; for ( KeyValue value : result . list ( ) ) { data = new HBaseData ( columnFamily != null ? columnFamily : new String ( value . getFamily ( ) ) , value . getRow ( ) ) ; break ; } if ( data != null ) { data . setColumns ( result . list ( ) ) ; results . add ( data ) ; } } return results ; } else { scan = new Scan ( ) ; } setScanCriteria ( filter , columnFamily , null , scan , columns ) ; scanner = hTable . getScanner ( scan ) ; resultsIter = scanner . iterator ( ) ; } return scanResults ( columnFamily , results ) ; }
/*
(non-Javadoc)

@see
com.impetus.client.hbase.Reader#LoadData(org.apache.hadoop.hbase.client
.HTable, java.lang.String, java.lang.String)