2 * This is a common dao with basic CRUD operations and is not limited to any
3 * persistent layer implementation
5 * Copyright (C) 2008 Imran M Yousuf (imyousuf@smartitengineering.com)
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 3 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 package com
.smartitengineering
.dao
.impl
.hbase
.spi
;
21 import java
.util
.LinkedHashMap
;
22 import org
.apache
.hadoop
.hbase
.client
.Put
;
23 import org
.apache
.hadoop
.hbase
.client
.Result
;
26 * Convert an object from object to HBase row and vice-versa
29 public interface ObjectRowConverter
<T
> {
32 * Convert an object to its representive class-row tuple. The Class will later
33 * be used to determine which table to put the row into as well.
34 * @param instance The object instance to convert into updateable rows
35 * @return An ordered {@link java.util.Map} with related {@link Put}.
37 LinkedHashMap
<Class
, Put
> objectToRows(T instance
);
40 * Load an instance of the convertable object with the row. It might be needed
41 * to load more {@link Result} to be able to load the object.
42 * @param startRow The root row of this object.
43 * @return Instance of the object from persisted {@link Result result(s)}
45 T
rowsToObject(Result startRow
);