Skip to content

Commit

Permalink
upgrade maven jar version
Browse files Browse the repository at this point in the history
  • Loading branch information
ponfee committed Jul 13, 2023
1 parent ce1d7f5 commit 6a6edd1
Show file tree
Hide file tree
Showing 22 changed files with 236 additions and 346 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# commons-hbase

## 简介
**定位为提供对hbase操作的组件(类似hibernate对关系数据库操作的封装)**
## Introduction
**commons-hbase is ORM framework for Hbase, Just like Hibernate for relational databases.**

## 使用说明
- has schema case:[**`CustomHbaseBeanDaoTest`**](https://github.com/ponfee/commons-hbase/blob/master/src/test/java/code/ponfee/hbase/test/CustomHbaseBeanDaoTest.java)
- non schema case:[**`CustomHbaseMapDaoTest`**](https://github.com/ponfee/commons-hbase/blob/master/src/test/java/code/ponfee/hbase/test/CustomHbaseMapDaoTest.java)
## Usage
- strict schema case:[**`CustomHbaseBeanDaoTest`**](src/test/java/cn/ponfee/hbase/test/CustomHbaseBeanDaoTest.java)
- lenient schema case:[**`CustomHbaseMapDaoTest`**](src/test/java/cn/ponfee/hbase/test/CustomHbaseMapDaoTest.java)
89 changes: 49 additions & 40 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,80 +3,82 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>code.ponfee</groupId>
<groupId>cn.ponfee</groupId>
<artifactId>commons-hbase</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>commons-hbase</name>

<properties>
<hadoop.version>2.9.2</hadoop.version>
<spring.version>4.3.24.RELEASE</spring.version>
<spring-framework.version>4.3.9.RELEASE</spring-framework.version>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>code.ponfee</groupId>
<groupId>cn.ponfee</groupId>
<artifactId>commons-core</artifactId>
<version>2.2-SNAPSHOT</version>
<version>1.4</version>
<exclusions>
<exclusion>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<groupId>org.springframework</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>com.caucho</groupId>
<artifactId>hessian</artifactId>
<groupId>org.bouncycastle</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
<groupId>org.mybatis</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<groupId>io.protostuff</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<groupId>org.apache.tika</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<groupId>com.alibaba</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
</exclusion>
<exclusion>
<groupId>aspose</groupId>
<artifactId>words-jdk16</artifactId>
<groupId>javax.money</groupId>
<artifactId>money-api</artifactId>
</exclusion>
<exclusion>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<groupId>org.javamoney</groupId>
<artifactId>moneta</artifactId>
</exclusion>
<exclusion>
<groupId>org.mozilla.intl</groupId>
<artifactId>chardet</artifactId>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</exclusion>
<exclusion>
<groupId>com.caucho</groupId>
<artifactId>hessian</artifactId>
</exclusion>
<exclusion>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
</exclusion>
<exclusion>
<groupId>cpdetector</groupId>
<artifactId>cpdetector</artifactId>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
</exclusion>
<exclusion>
<groupId>third-jce</groupId>
<artifactId>third-jce</artifactId>
<groupId>com.monitorjbl</groupId>
<artifactId>xlsx-streamer</artifactId>
</exclusion>
<exclusion>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
</exclusion>
</exclusions>
</dependency>
Expand Down Expand Up @@ -212,5 +214,12 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring-framework.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
package code.ponfee.hbase;
package cn.ponfee.hbase;

import static code.ponfee.hbase.HbaseUtils.nextStartRowKey;
import cn.ponfee.commons.collect.ByteArrayWrapper;
import cn.ponfee.commons.concurrent.MultithreadExecutors;
import cn.ponfee.hbase.model.HbaseEntity;
import cn.ponfee.hbase.model.PageQueryBuilder;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Scan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.hadoop.hbase.HbaseTemplate;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Comparator;
Expand All @@ -17,20 +28,7 @@
import java.util.function.BiConsumer;
import java.util.function.Consumer;

import javax.annotation.Resource;

import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Scan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.hadoop.hbase.HbaseTemplate;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import code.ponfee.commons.collect.ByteArrayWrapper;
import code.ponfee.commons.concurrent.MultithreadExecutor;
import code.ponfee.hbase.model.HbaseEntity;
import code.ponfee.hbase.model.PageQueryBuilder;
import static cn.ponfee.hbase.HbaseUtils.nextStartRowKey;

/**
* The Hbase dao common base class
Expand All @@ -43,7 +41,7 @@
public abstract class HbaseBatchDao<T extends HbaseEntity<R>, R extends Serializable & Comparable<? super R>>
extends HbaseDao<T, R> {

private static Logger logger = LoggerFactory.getLogger(HbaseBatchDao.class);
private static final Logger logger = LoggerFactory.getLogger(HbaseBatchDao.class);

protected @Resource ThreadPoolTaskExecutor taskExecutor;

Expand Down Expand Up @@ -209,7 +207,7 @@ private static boolean join(CompletionService<Boolean> service,
int round, String operation) {
try {
AtomicBoolean result = new AtomicBoolean(true);
MultithreadExecutor.join(
MultithreadExecutors.join(
service, round,
b -> result.set(result.get() & b)
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,42 +1,20 @@
package code.ponfee.hbase;

import static code.ponfee.hbase.HbaseUtils.fromBytes;
import static code.ponfee.hbase.HbaseUtils.toBytes;
import static code.ponfee.hbase.model.HbaseMap.ROW_KEY_NAME;
import static code.ponfee.hbase.model.HbaseMap.ROW_NUM_NAME;
import static com.google.common.base.CaseFormat.LOWER_CAMEL;
import static com.google.common.base.CaseFormat.LOWER_UNDERSCORE;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import static org.apache.commons.lang3.StringUtils.substringBefore;
import static org.apache.hadoop.hbase.CellUtil.cloneQualifier;
import static org.apache.hadoop.hbase.CellUtil.cloneValue;

import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import javax.annotation.Nonnull;
import javax.annotation.Resource;

package cn.ponfee.hbase;

import cn.ponfee.commons.base.TimestampProvider;
import cn.ponfee.commons.io.Closeables;
import cn.ponfee.commons.model.SortOrder;
import cn.ponfee.commons.reflect.*;
import cn.ponfee.commons.serial.NullSerializer;
import cn.ponfee.commons.serial.Serializer;
import cn.ponfee.commons.util.Bytes;
import cn.ponfee.commons.util.ObjectUtils;
import cn.ponfee.hbase.annotation.HbaseField;
import cn.ponfee.hbase.annotation.HbaseTable;
import cn.ponfee.hbase.model.*;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.ArrayUtils;
Expand All @@ -46,52 +24,34 @@
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.NamespaceDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.filter.CompareFilter;
import org.apache.hadoop.hbase.filter.Filter;
import org.apache.hadoop.hbase.filter.FilterList;
import org.apache.hadoop.hbase.client.*;
import org.apache.hadoop.hbase.filter.*;
import org.apache.hadoop.hbase.filter.FilterList.Operator;
import org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter;
import org.apache.hadoop.hbase.filter.InclusiveStopFilter;
import org.apache.hadoop.hbase.filter.PageFilter;
import org.apache.hadoop.hbase.filter.PrefixFilter;
import org.apache.hadoop.hbase.filter.RegexStringComparator;
import org.apache.hadoop.hbase.filter.RowFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.hadoop.hbase.HbaseTemplate;
import org.springframework.data.hadoop.hbase.RowMapper;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
import javax.annotation.Nonnull;
import javax.annotation.Resource;
import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.*;
import java.util.Map.Entry;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import code.ponfee.commons.base.TimestampProvider;
import code.ponfee.commons.io.Closeables;
import code.ponfee.commons.model.SortOrder;
import code.ponfee.commons.reflect.BeanMaps;
import code.ponfee.commons.reflect.CglibUtils;
import code.ponfee.commons.reflect.ClassUtils;
import code.ponfee.commons.reflect.Fields;
import code.ponfee.commons.reflect.GenericUtils;
import code.ponfee.commons.serial.NullSerializer;
import code.ponfee.commons.serial.Serializer;
import code.ponfee.commons.util.Bytes;
import code.ponfee.commons.util.ObjectUtils;
import code.ponfee.hbase.annotation.HbaseField;
import code.ponfee.hbase.annotation.HbaseTable;
import code.ponfee.hbase.model.Column;
import code.ponfee.hbase.model.HbaseEntity;
import code.ponfee.hbase.model.HbaseBean;
import code.ponfee.hbase.model.HbaseMap;
import code.ponfee.hbase.model.PageQueryBuilder;
import static cn.ponfee.hbase.HbaseUtils.fromBytes;
import static cn.ponfee.hbase.HbaseUtils.toBytes;
import static cn.ponfee.hbase.model.HbaseMap.ROW_KEY_NAME;
import static cn.ponfee.hbase.model.HbaseMap.ROW_NUM_NAME;
import static com.google.common.base.CaseFormat.LOWER_CAMEL;
import static com.google.common.base.CaseFormat.LOWER_UNDERSCORE;
import static org.apache.commons.lang3.StringUtils.*;
import static org.apache.hadoop.hbase.CellUtil.cloneQualifier;
import static org.apache.hadoop.hbase.CellUtil.cloneValue;

/**
* The Hbase dao common base class
Expand All @@ -102,7 +62,7 @@
*/
public abstract class HbaseDao<T extends HbaseEntity<R>, R extends Serializable & Comparable<? super R>> {

private static Logger logger = LoggerFactory.getLogger(HbaseDao.class);
private static final Logger logger = LoggerFactory.getLogger(HbaseDao.class);

private static final Map<Class<? extends Serializer>, Serializer> REGISTERED_SERIALIZER =
new /*ConcurrentHashMap*/HashMap<>();
Expand Down Expand Up @@ -223,15 +183,15 @@ public <F> T convert(F from, Consumer<T> action) {
} else {
to = ObjectUtils.newInstance(this.entityType);
if (Map.class.isAssignableFrom(this.entityType)) {
if (Map.class.isInstance(from)) {
if (from instanceof Map) {
((Map) to).putAll((Map<?, ?>) from);
} else {
((Map) to).putAll(BeanMaps.CGLIB.toMap(from));
}
} else if (Map.class.isInstance(from)) {
} else if (from instanceof Map) {
BeanMaps.CGLIB.copyFromMap((Map) from, to);
} else {
CglibUtils.copyProperties(from, to);
BeanCopiers.copy(from, to);
}
}
if (action != null) {
Expand Down
Loading

0 comments on commit 6a6edd1

Please sign in to comment.