diff --git a/hbase-examples/pom.xml b/hbase-examples/pom.xml index e95d6a22fbb..08bff98c694 100644 --- a/hbase-examples/pom.xml +++ b/hbase-examples/pom.xml @@ -29,7 +29,12 @@ hbase-examples Apache HBase - Examples Examples of HBase usage - + + + 3.11.4 + @@ -62,9 +67,50 @@ compile + + com.google.protobuf:protoc:${internal.protobuf.version}:exe:${os.detected.classifier} + true + + + com.google.code.maven-replacer-plugin + replacer + 1.5.3 + + + process-sources + + replace + + + + + ${basedir}/target/generated-sources/ + + **/*.java + + + true + + + ([^\.])com.google.protobuf + $1org.apache.hbase.thirdparty.com.google.protobuf + + + (public)(\W+static)?(\W+final)?(\W+class) + @javax.annotation.Generated("proto") $1$2$3$4 + + + + (@javax.annotation.Generated\("proto"\) ){2} + $1 + + + + net.revelc.code warbucks-maven-plugin @@ -87,6 +133,10 @@ org.apache.hbase.thirdparty hbase-shaded-netty + + org.apache.hbase + hbase-protocol-shaded + org.apache.hbase hbase-common diff --git a/hbase-examples/src/main/java/org/apache/hadoop/hbase/types/PBCell.java b/hbase-examples/src/main/java/org/apache/hadoop/hbase/types/PBCell.java index 9962797d3dd..9946b020d03 100644 --- a/hbase-examples/src/main/java/org/apache/hadoop/hbase/types/PBCell.java +++ b/hbase-examples/src/main/java/org/apache/hadoop/hbase/types/PBCell.java @@ -17,13 +17,14 @@ */ package org.apache.hadoop.hbase.types; -import com.google.protobuf.CodedInputStream; -import com.google.protobuf.CodedOutputStream; import java.io.IOException; import org.apache.hadoop.hbase.example.protobuf.generated.CellMessage; import org.apache.hadoop.hbase.util.PositionedByteRange; import org.apache.yetus.audience.InterfaceAudience; +import org.apache.hbase.thirdparty.com.google.protobuf.CodedInputStream; +import org.apache.hbase.thirdparty.com.google.protobuf.CodedOutputStream; + /** * An example for using protobuf objects with {@link DataType} API. */ diff --git a/hbase-examples/src/main/java/org/apache/hadoop/hbase/types/PBType.java b/hbase-examples/src/main/java/org/apache/hadoop/hbase/types/PBType.java index 8c6a1d9660f..c9dc382bb17 100644 --- a/hbase-examples/src/main/java/org/apache/hadoop/hbase/types/PBType.java +++ b/hbase-examples/src/main/java/org/apache/hadoop/hbase/types/PBType.java @@ -17,15 +17,19 @@ */ package org.apache.hadoop.hbase.types; -import com.google.protobuf.CodedInputStream; -import com.google.protobuf.CodedOutputStream; -import com.google.protobuf.Message; import org.apache.hadoop.hbase.util.Order; import org.apache.hadoop.hbase.util.PositionedByteRange; import org.apache.yetus.audience.InterfaceAudience; +import org.apache.hbase.thirdparty.com.google.protobuf.CodedInputStream; +import org.apache.hbase.thirdparty.com.google.protobuf.CodedOutputStream; +import org.apache.hbase.thirdparty.com.google.protobuf.Message; + /** * A base-class for {@link DataType} implementations backed by protobuf. See {@link PBCell}. + *

+ * Notice that, in hbase we always uses our own shaded version of protobuf, but you are free to use + * the original version of protobuf in your own project. */ @InterfaceAudience.Private public abstract class PBType implements DataType { @@ -59,6 +63,7 @@ public abstract class PBType implements DataType { * {@code src}'s position after consuming from the stream. *

* For example: + * *

    * Foo.Builder builder = ...
    * CodedInputStream is = inputStreamFromByteRange(src);
@@ -76,6 +81,7 @@ public abstract class PBType implements DataType {
    * {@code dst}'s position after writing to the stream.
    * 

* For example: + * *

    * CodedOutputStream os = outputStreamFromByteRange(dst);
    * int before = os.spaceLeft(), after, written;
diff --git a/hbase-protocol-shaded/src/main/protobuf/server/coprocessor/examples/BulkDelete.proto b/hbase-examples/src/main/protobuf/BulkDelete.proto
similarity index 100%
rename from hbase-protocol-shaded/src/main/protobuf/server/coprocessor/examples/BulkDelete.proto
rename to hbase-examples/src/main/protobuf/BulkDelete.proto
diff --git a/hbase-protocol-shaded/src/main/protobuf/server/coprocessor/examples/RefreshHFiles.proto b/hbase-examples/src/main/protobuf/RefreshHFiles.proto
similarity index 100%
rename from hbase-protocol-shaded/src/main/protobuf/server/coprocessor/examples/RefreshHFiles.proto
rename to hbase-examples/src/main/protobuf/RefreshHFiles.proto
diff --git a/hbase-protocol-shaded/src/main/protobuf/server/coprocessor/examples/RowCount.proto b/hbase-examples/src/main/protobuf/RowCount.proto
similarity index 100%
rename from hbase-protocol-shaded/src/main/protobuf/server/coprocessor/examples/RowCount.proto
rename to hbase-examples/src/main/protobuf/RowCount.proto
diff --git a/hbase-examples/src/test/java/org/apache/hadoop/hbase/types/TestPBCell.java b/hbase-examples/src/test/java/org/apache/hadoop/hbase/types/TestPBCell.java
index 5ca3cf4e5cd..7c193d3b655 100644
--- a/hbase-examples/src/test/java/org/apache/hadoop/hbase/types/TestPBCell.java
+++ b/hbase-examples/src/test/java/org/apache/hadoop/hbase/types/TestPBCell.java
@@ -19,7 +19,6 @@ package org.apache.hadoop.hbase.types;
 
 import static org.junit.Assert.assertEquals;
 
-import com.google.protobuf.ByteString;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.example.protobuf.generated.CellMessage;
 import org.apache.hadoop.hbase.testclassification.MiscTests;
@@ -30,6 +29,8 @@ import org.junit.ClassRule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
+import org.apache.hbase.thirdparty.com.google.protobuf.ByteString;
+
 @Category({ SmallTests.class, MiscTests.class })
 public class TestPBCell {
 
diff --git a/hbase-protocol-shaded/pom.xml b/hbase-protocol-shaded/pom.xml
index 2b3c7fe9827..6d8b0ab5775 100644
--- a/hbase-protocol-shaded/pom.xml
+++ b/hbase-protocol-shaded/pom.xml
@@ -33,20 +33,10 @@
     true
     
-    3.5.1-1
+    -->
+    3.11.4
   
   
-    
-      
-        src/main/
-        
-          **/*.proto
-        
-      
-    
     
       
       
@@ -88,7 +78,6 @@
             
             
               com.google.protobuf:protoc:${internal.protobuf.version}:exe:${os.detected.classifier}
-              false
               true