You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by sd...@apache.org on 2015/08/14 09:28:49 UTC

[15/50] [abbrv] incubator-sentry git commit: SENTRY-802: SentryService: Log error if you processor cannot be registered (Sravya Tirukkovalur, Reviewed by: Lenni Kuff)

SENTRY-802: SentryService: Log error if you processor cannot be registered (Sravya Tirukkovalur, Reviewed by: Lenni Kuff)


Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/9dff149d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/9dff149d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/9dff149d

Branch: refs/heads/hive_plugin_v2
Commit: 9dff149d657632a533f939f8c2541c9f190439f2
Parents: fe8e7d9
Author: Sravya Tirukkovalur <sr...@clouera.com>
Authored: Mon Jul 13 13:32:25 2015 -0700
Committer: Sravya Tirukkovalur <sr...@clouera.com>
Committed: Mon Jul 13 13:32:25 2015 -0700

----------------------------------------------------------------------
 .../apache/sentry/hdfs/SentryHDFSServiceProcessorFactory.java | 3 ++-
 .../org/apache/sentry/service/thrift/ProcessorFactory.java    | 5 ++---
 .../java/org/apache/sentry/service/thrift/SentryService.java  | 7 ++++++-
 3 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/9dff149d/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHDFSServiceProcessorFactory.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHDFSServiceProcessorFactory.java b/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHDFSServiceProcessorFactory.java
index d35de75..286dc29 100644
--- a/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHDFSServiceProcessorFactory.java
+++ b/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryHDFSServiceProcessorFactory.java
@@ -96,10 +96,11 @@ public class SentryHDFSServiceProcessorFactory extends ProcessorFactory{
     super(conf);
   }
 
-
+  @Override
   public boolean register(TMultiplexedProcessor multiplexedProcessor) throws Exception {
     SentryHDFSServiceProcessor sentryServiceHandler =
         new SentryHDFSServiceProcessor();
+    LOGGER.info("Calling registerProcessor from SentryHDFSServiceProcessorFactory");
     TProcessor processor = new ProcessorWrapper(sentryServiceHandler);
     multiplexedProcessor.registerProcessor(
         SentryHDFSServiceClient.SENTRY_HDFS_SERVICE_NAME, processor);

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/9dff149d/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ProcessorFactory.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ProcessorFactory.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ProcessorFactory.java
index 88ef24f..a3bb6ab 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ProcessorFactory.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ProcessorFactory.java
@@ -22,11 +22,10 @@ import org.apache.thrift.TMultiplexedProcessor;
 
 public abstract class ProcessorFactory {
   protected final Configuration conf;
+
   public ProcessorFactory(Configuration conf) {
     this.conf = conf;
   }
 
-  public boolean register(TMultiplexedProcessor processor) throws Exception {
-    return false;
-  }
+  public abstract boolean register(TMultiplexedProcessor processor) throws Exception;
 }

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/9dff149d/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
index 3a8653b..1af7a8b 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
@@ -191,9 +191,14 @@ public class SentryService implements Callable {
       try {
         Constructor<?> constructor = clazz
             .getConstructor(Configuration.class);
+        LOGGER.info("ProcessorFactory being used: " + clazz.getCanonicalName());
         ProcessorFactory factory = (ProcessorFactory) constructor
             .newInstance(conf);
-        registeredProcessor = factory.register(processor) || registeredProcessor;
+        boolean status = factory.register(processor);
+        if(!status) {
+          LOGGER.error("Failed to register " + clazz.getCanonicalName());
+        }
+        registeredProcessor = status || registeredProcessor;
       } catch (Exception e) {
         throw new IllegalStateException("Could not create "
             + processorFactory, e);