diff --git a/pom.xml b/pom.xml
index 186cb4ea6..ec142f8ef 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,89 +1,133 @@
- 4.0.0
- com.nhn.hippo
- hippo-commons
- 0.0.1
- hippo-commons
- jar
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ 4.0.0
+ com.nhn.hippo
+ hippo-commons
+ 0.0.1
+ hippo-commons
+ jar
${thrift.executable.property}
+ 3.1.2.RELEASE
-
-
- com.springsource.repository.bundles.release
- SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases
- http://repository.springsource.com/maven/bundles/release
-
-
- com.springsource.repository.bundles.external
- SpringSource Enterprise Bundle Repository - External Bundle Releases
- http://repository.springsource.com/maven/bundles/external
-
-
- spring-milestone
- Spring Maven MILESTONE Repository
- http://maven.springframework.org/milestone
-
-
- jboss-public-repository-group
- JBoss Public Maven Repository Group
- https://repository.jboss.org/nexus/content/groups/public/
-
-
- nhn.release.repository
- http://repo.nhncorp.com/maven2
-
- false
-
-
- true
-
-
-
- nhn.snapshot.repository
- http://repo.nhncorp.com/m2-snapshot-repository
-
- always
- fail
- true
-
-
- false
-
-
-
+
+
+ com.springsource.repository.bundles.release
+ SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases
+ http://repository.springsource.com/maven/bundles/release
+
+
+ com.springsource.repository.bundles.external
+ SpringSource Enterprise Bundle Repository - External Bundle Releases
+ http://repository.springsource.com/maven/bundles/external
+
+
+ spring-milestone
+ Spring Maven MILESTONE Repository
+ http://maven.springframework.org/milestone
+
+
+ jboss-public-repository-group
+ JBoss Public Maven Repository Group
+ https://repository.jboss.org/nexus/content/groups/public/
+
+
+ nhn.release.repository
+ http://repo.nhncorp.com/maven2
+
+ false
+
+
+ true
+
+
+
+ nhn.snapshot.repository
+ http://repo.nhncorp.com/m2-snapshot-repository
+
+ always
+ fail
+ true
+
+
+ false
+
+
+
-
-
- org.apache.hadoop
- hadoop-core
- 1.0.1
-
-
- org.apache.thrift
- libthrift
- 0.8.0
-
-
- org.apache.hbase
- hbase
- 0.94.1
-
-
- org.slf4j
- slf4j-api
- 1.5.8
- provided
-
+
+
- org.slf4j
- slf4j-jdk14
- 1.5.8
+ org.apache.hadoop
+ hadoop-core
+ 1.0.1
+ compile
+ true
+
+
+ org.apache.thrift
+ libthrift
+ 0.8.0
+
+
+
+ org.apache.hbase
+ hbase
+ 0.94.1
+ compile
+ true
+
+
+
+ org.springframework
+ spring-core
+ ${spring.version}
+ compile
+ true
+
+
+ org.springframework
+ org.springframework.orm
+ ${spring.version}
+ compile
+ true
+
+
+ org.springframework.data
+ spring-data-hadoop
+ 1.0.0.M2
+ compile
+ true
+
+
+ org.springframework
+ spring-context-support
+
+
+ org.springframework
+ spring-core
+
+
+ org.apache.hbase
+ hbase
+
+
+
+
+ org.slf4j
+ slf4j-api
+ 1.5.8
+ compile
+ true
+
+
+ org.slf4j
+ slf4j-jdk14
+ 1.5.8
test
-
+
junit
junit
@@ -91,94 +135,94 @@
test
- org.mockito
- mockito-all
- 1.9.0
+ org.mockito
+ mockito-all
+ 1.9.0
test
-
-
+
+
-
-
-
- ${basedir}/src/main/java
-
- **/*.java
-
-
-
- true
- ${basedir}/src/main/resources
-
-
+
+
+
+ ${basedir}/src/main/java
+
+ **/*.java
+
+
+
+ true
+ ${basedir}/src/main/resources
+
+
-
-
- ${basedir}/src/test/java
-
- **/*.java
-
-
-
- true
- ${basedir}/src/test/resources
-
-
+
+
+ ${basedir}/src/test/java
+
+ **/*.java
+
+
+
+ true
+ ${basedir}/src/test/resources
+
+
-
-
- maven-resources-plugin
- 2.5
-
- UTF-8
-
-
+
+
+ maven-resources-plugin
+ 2.5
+
+ UTF-8
+
+
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.6
- 1.6
- true
- true
- utf-8
- true
-
-
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 1.6
+ 1.6
+ true
+ true
+ utf-8
+ true
+
+
-
- org.apache.maven.plugins
- maven-jar-plugin
- 2.4
-
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.4
+
com.profiler.TomcatProfiler
-
-
+
+
-
- org.apache.maven.plugins
- maven-dependency-plugin
- 2.4
-
-
- copy-dependencies
- process-resources
-
- copy-dependencies
-
-
- ${basedir}/target/dependency
- true
- true
-
-
-
-
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 2.4
+
+
+ copy-dependencies
+ process-resources
+
+ copy-dependencies
+
+
+ ${basedir}/target/dependency
+ true
+ true
+
+
+
+
@@ -197,59 +241,59 @@
-
+
-
-
-
-
-
- withThrift
-
-
-
- maven-antrun-plugin
-
-
- generate-sources
- generate-sources
-
-
+
+
+
+
+
+ withThrift
+
+
+
+ maven-antrun-plugin
+
+
+ generate-sources
+ generate-sources
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
- run
-
-
-
-
-
-
-
-
-
+
+
+
+ run
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/profiler/common/hbase/HbaseOperations2.java b/src/main/java/com/profiler/common/hbase/HbaseOperations2.java
new file mode 100644
index 000000000..1b40cc234
--- /dev/null
+++ b/src/main/java/com/profiler/common/hbase/HbaseOperations2.java
@@ -0,0 +1,58 @@
+package com.profiler.common.hbase;
+
+import org.apache.hadoop.hbase.client.Put;
+import org.springframework.data.hadoop.hbase.HbaseOperations;
+import org.springframework.data.hadoop.hbase.RowMapper;
+
+import java.util.List;
+
+/**
+ *
+ */
+public interface HbaseOperations2 extends HbaseOperations {
+ /**
+ * Gets an individual row from the given table. The content is mapped by the given action.
+ *
+ * @param tableName target table
+ * @param rowName row name
+ * @param mapper row mapper
+ * @return object mapping the target row
+ */
+ T get(String tableName, byte[] rowName, final RowMapper mapper);
+
+ /**
+ * Gets an individual row from the given table. The content is mapped by the given action.
+ *
+ * @param tableName target table
+ * @param rowName row name
+ * @param familyName column family
+ * @param mapper row mapper
+ * @return object mapping the target row
+ */
+ T get(String tableName, byte[] rowName, byte[] familyName, final RowMapper mapper);
+
+ /**
+ * Gets an individual row from the given table. The content is mapped by the given action.
+ *
+ * @param tableName target table
+ * @param rowName row name
+ * @param familyName family
+ * @param qualifier column qualifier
+ * @param mapper row mapper
+ * @return object mapping the target row
+ */
+ T get(String tableName, final byte[] rowName, final byte[] familyName, final byte[] qualifier, final RowMapper mapper);
+
+
+ void put(String tableName, final byte[] rowName, final byte[] familyName, final byte[] qualifier, final byte[] value);
+
+ void put(String tableName, final byte[] rowName, final byte[] familyName, final byte[] qualifier, final Long timestamp, final byte[] value);
+
+ void put(String tableName, final byte[] rowName, final byte[] familyName, final byte[] qualifier, final T value, final ValueMapper mapper);
+
+ void put(String tableName, final byte[] rowName, final byte[] familyName, final byte[] qualifier, final Long timestamp, final T value, final ValueMapper mapper);
+
+ void put(String tableName, final Put put);
+
+ void put(String tableName, final List puts);
+}
diff --git a/src/main/java/com/profiler/common/hbase/HbaseTemplate2.java b/src/main/java/com/profiler/common/hbase/HbaseTemplate2.java
new file mode 100644
index 000000000..20f36b0ba
--- /dev/null
+++ b/src/main/java/com/profiler/common/hbase/HbaseTemplate2.java
@@ -0,0 +1,109 @@
+package com.profiler.common.hbase;
+
+import org.apache.hadoop.hbase.client.*;
+import org.springframework.data.hadoop.hbase.*;
+
+import java.util.List;
+
+/**
+ *
+ */
+public class HbaseTemplate2 extends HbaseTemplate implements HbaseOperations2 {
+
+ @Override
+ public T get(String tableName, byte[] rowName, RowMapper mapper) {
+ return get(tableName, rowName, null, null, mapper);
+ }
+
+ @Override
+ public T get(String tableName, byte[] rowName, byte[] familyName, RowMapper mapper) {
+ return get(tableName, rowName, familyName, null, mapper);
+ }
+
+ @Override
+ public T get(String tableName, final byte[] rowName, final byte[] familyName, final byte[] qualifier, final RowMapper mapper) {
+ return execute(tableName, new TableCallback() {
+ @Override
+ public T doInTable(HTable htable) throws Throwable {
+ Get get = new Get(rowName);
+ if (familyName != null) {
+ if (qualifier != null) {
+ get.addColumn(familyName, qualifier);
+ }
+ else {
+ get.addFamily(familyName);
+ }
+ }
+ Result result = htable.get(get);
+ return mapper.mapRow(result, 0);
+ }
+ });
+ }
+
+
+ public void put(String tableName, final byte[] rowName, final byte[] familyName, final byte[] qualifier, final byte[] value) {
+ put(tableName, rowName, familyName, qualifier, null, value);
+ }
+
+ public void put(String tableName, final byte[] rowName, final byte[] familyName, final byte[] qualifier, final Long timestamp, final byte[] value) {
+ execute(tableName, new TableCallback() {
+ @Override
+ public Object doInTable(HTable htable) throws Throwable {
+ Put put = new Put(rowName);
+ if (familyName != null) {
+ if(timestamp == null) {
+ put.add(familyName, qualifier, value);
+ } else {
+ put.add(familyName, qualifier, timestamp, value);
+ }
+ }
+ htable.put(put);
+ return null;
+ }
+ });
+ }
+
+ public void put(String tableName, final byte[] rowName, final byte[] familyName, final byte[] qualifier, final T value, final ValueMapper mapper) {
+ put(tableName, rowName, familyName, qualifier, null, value, mapper);
+ }
+
+ public void put(String tableName, final byte[] rowName, final byte[] familyName, final byte[] qualifier, final Long timestamp, final T value, final ValueMapper mapper) {
+ execute(tableName, new TableCallback() {
+ @Override
+ public T doInTable(HTable htable) throws Throwable {
+ Put put = new Put(rowName);
+ byte[] bytes = mapper.mapValue(value);
+ if (familyName != null) {
+ if(timestamp == null) {
+ put.add(familyName, qualifier, bytes);
+ } else {
+ put.add(familyName, qualifier, timestamp, bytes);
+ }
+ }
+ htable.put(put);
+ return null;
+ }
+ });
+ }
+
+ public void put(String tableName, final Put put) {
+ execute(tableName, new TableCallback() {
+ @Override
+ public T doInTable(HTable htable) throws Throwable {
+ htable.put(put);
+ return null;
+ }
+ });
+ }
+
+ public void put(String tableName, final List puts) {
+ execute(tableName, new TableCallback() {
+ @Override
+ public T doInTable(HTable htable) throws Throwable {
+ htable.put(puts);
+ return null;
+ }
+ });
+ }
+
+}
diff --git a/src/main/java/com/profiler/common/hbase/ValueMapper.java b/src/main/java/com/profiler/common/hbase/ValueMapper.java
new file mode 100644
index 000000000..0bb6dc24e
--- /dev/null
+++ b/src/main/java/com/profiler/common/hbase/ValueMapper.java
@@ -0,0 +1,8 @@
+package com.profiler.common.hbase;
+
+/**
+ *
+ */
+public interface ValueMapper {
+ byte[] mapValue(T value);
+}