From 15acbcd62cf8a73c86ea8bbc6ad50b9edfa2c43f Mon Sep 17 00:00:00 2001 From: Imran M Yousuf Date: Sun, 22 Aug 2010 14:57:24 +0600 Subject: [PATCH] Add abstract common dao implementation for common write dao In process add dependencies to HBase tests and smart abstract-dao. Also implement the fetch by id(s) operations among the read operations. Next will implement the search list/single object by reading the query parameters. Signed-off-by: Imran M Yousuf --- smart-hbase-dao/pom.xml | 9 + .../dao/impl/hbase/AbstractCommonDao.java | 261 +++++++++++++++++++++ .../com/smartitengineering/dao/impl/hbase/App.java | 13 - 3 files changed, 270 insertions(+), 13 deletions(-) create mode 100644 smart-hbase-dao/src/main/java/com/smartitengineering/dao/impl/hbase/AbstractCommonDao.java delete mode 100644 smart-hbase-dao/src/main/java/com/smartitengineering/dao/impl/hbase/App.java diff --git a/smart-hbase-dao/pom.xml b/smart-hbase-dao/pom.xml index ea4adaf..6288fa8 100644 --- a/smart-hbase-dao/pom.xml +++ b/smart-hbase-dao/pom.xml @@ -46,6 +46,15 @@ com.smartitengineering smart-dao-queryparam + + com.smartitengineering + smart-abstract-dao + + + org.apache.hbase + hbase + tests + diff --git a/smart-hbase-dao/src/main/java/com/smartitengineering/dao/impl/hbase/AbstractCommonDao.java b/smart-hbase-dao/src/main/java/com/smartitengineering/dao/impl/hbase/AbstractCommonDao.java new file mode 100644 index 0000000..7bb875d --- /dev/null +++ b/smart-hbase-dao/src/main/java/com/smartitengineering/dao/impl/hbase/AbstractCommonDao.java @@ -0,0 +1,261 @@ +/* + * This is a common dao with basic CRUD operations and is not limited to any + * persistent layer implementation + * + * Copyright (C) 2010 Imran M Yousuf (imyousuf@smartitengineering.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +package com.smartitengineering.dao.impl.hbase; + +import com.smartitengineering.dao.common.CommonReadDao; +import com.smartitengineering.dao.common.CommonWriteDao; +import com.smartitengineering.dao.common.queryparam.QueryParameter; +import com.smartitengineering.dao.impl.hbase.spi.ObjectRowConverter; +import com.smartitengineering.dao.impl.hbase.spi.SchemaInfoProvider; +import com.smartitengineering.domain.PersistentDTO; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.client.Delete; +import org.apache.hadoop.hbase.client.Get; +import org.apache.hadoop.hbase.client.HTableInterface; +import org.apache.hadoop.hbase.client.HTablePool; +import org.apache.hadoop.hbase.client.Put; +import org.apache.hadoop.hbase.client.Result; +import org.apache.hadoop.hbase.util.Bytes; + +/** + * + * @author imyousuf + */ +public class AbstractCommonDao