hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bus...@apache.org
Subject [hbase] branch master updated: HBASE-21794 Update the Coprocessor observer example given in section 111.1 of the ref guide.
Date Fri, 01 Feb 2019 16:24:18 GMT
This is an automated email from the ASF dual-hosted git repository.

busbey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new 64c3272  HBASE-21794 Update the Coprocessor observer example given in section 111.1
of the ref guide.
64c3272 is described below

commit 64c32720d606072a4c119c1184664eafcb19de3b
Author: Sakthi <sakthivel.azhaku@gmail.com>
AuthorDate: Wed Jan 30 13:08:31 2019 -0800

    HBASE-21794 Update the Coprocessor observer example given in section 111.1 of the ref
guide.
    
    Signed-off-by: Sean Busbey <busbey@apache.org>
---
 src/main/asciidoc/_chapters/cp.adoc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/main/asciidoc/_chapters/cp.adoc b/src/main/asciidoc/_chapters/cp.adoc
index abe334c..5fd80b4 100644
--- a/src/main/asciidoc/_chapters/cp.adoc
+++ b/src/main/asciidoc/_chapters/cp.adoc
@@ -483,6 +483,7 @@ The following Observer coprocessor prevents the details of the user `admin`
from
 returned in a `Get` or `Scan` of the `users` table.
 
 . Write a class that implements the
+link:https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/coprocessor/RegionCoprocessor.html[RegionCoprocessor],
 link:https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/coprocessor/RegionObserver.html[RegionObserver]
 class.
 
@@ -500,10 +501,9 @@ empty result. Otherwise, process the request as normal.
 
 Following are the implementation of the above steps:
 
-
 [source,java]
 ----
-public class RegionObserverExample implements RegionObserver {
+public class RegionObserverExample implements RegionCoprocessor, RegionObserver {
 
     private static final byte[] ADMIN = Bytes.toBytes("admin");
     private static final byte[] COLUMN_FAMILY = Bytes.toBytes("details");
@@ -511,6 +511,11 @@ public class RegionObserverExample implements RegionObserver {
     private static final byte[] VALUE = Bytes.toBytes("You can't see Admin details");
 
     @Override
+    public Optional<RegionObserver> getRegionObserver() {
+      return Optional.of(this);
+    }
+
+    @Override
     public void preGetOp(final ObserverContext<RegionCoprocessorEnvironment> e, final
Get get, final List<Cell> results)
     throws IOException {
 


Mime
View raw message