You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by rm...@apache.org on 2015/10/28 00:30:42 UTC
[1/4] incubator-ranger git commit: RANGER-586:Ranger plugins should
not add dependent libraries to component's CLASSPATH
Repository: incubator-ranger
Updated Branches:
refs/heads/master 11f73cd8a -> a2c729021
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-yarn-plugin-shim/src/main/java/org/apache/ranger/authorization/yarn/authorizer/RangerYarnAuthorizer.java
----------------------------------------------------------------------
diff --git a/ranger-yarn-plugin-shim/src/main/java/org/apache/ranger/authorization/yarn/authorizer/RangerYarnAuthorizer.java b/ranger-yarn-plugin-shim/src/main/java/org/apache/ranger/authorization/yarn/authorizer/RangerYarnAuthorizer.java
new file mode 100644
index 0000000..289d1c0
--- /dev/null
+++ b/ranger-yarn-plugin-shim/src/main/java/org/apache/ranger/authorization/yarn/authorizer/RangerYarnAuthorizer.java
@@ -0,0 +1,205 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.authorization.yarn.authorizer;
+
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.security.authorize.AccessControlList;
+import org.apache.hadoop.yarn.security.AccessType;
+import org.apache.hadoop.yarn.security.PrivilegedEntity;
+import org.apache.hadoop.yarn.security.YarnAuthorizationProvider;
+import org.apache.ranger.plugin.classloader.RangerPluginClassLoader;
+
+
+
+public class RangerYarnAuthorizer extends YarnAuthorizationProvider {
+ private static final Log LOG = LogFactory.getLog(RangerYarnAuthorizer.class);
+
+ private static final String RANGER_PLUGIN_TYPE = "yarn";
+ private static final String[] RANGER_PLUGIN_LIB_DIR = new String[] {"lib/ranger-yarn-plugin"};
+ private static final String RANGER_YARN_AUTHORIZER_IMPL_CLASSNAME = "org.apache.ranger.authorization.yarn.authorizer.RangerYarnAuthorizer";
+
+ private YarnAuthorizationProvider yarnAuthorizationProviderImpl = null;
+ private static RangerPluginClassLoader rangerPluginClassLoader = null;
+
+ public RangerYarnAuthorizer() {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerYarnAuthorizer.RangerYarnAuthorizer()");
+ }
+
+ this.init();
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerYarnAuthorizer.RangerYarnAuthorizer()");
+ }
+ }
+
+ private void init(){
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerYarnAuthorizer.init()");
+ }
+
+ try {
+
+ rangerPluginClassLoader = RangerPluginClassLoader.getInstance(RANGER_PLUGIN_TYPE, this.getClass());
+
+ @SuppressWarnings("unchecked")
+ Class<YarnAuthorizationProvider> cls = (Class<YarnAuthorizationProvider>) Class.forName(RANGER_YARN_AUTHORIZER_IMPL_CLASSNAME, true, rangerPluginClassLoader);
+
+ activatePluginClassLoader();
+
+ yarnAuthorizationProviderImpl = cls.newInstance();
+ } catch (Exception e) {
+ // check what need to be done
+ LOG.error("Error Enabling RangerYarnPluing", e);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerYarnAuthorizer.init()");
+ }
+ }
+
+ @Override
+ public void init(Configuration conf) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerYarnAuthorizer.init()");
+ }
+
+ try {
+ activatePluginClassLoader();
+
+ yarnAuthorizationProviderImpl.init(conf);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerYarnAuthorizer.start()");
+ }
+ }
+
+ @Override
+ public boolean checkPermission(AccessType accessType, PrivilegedEntity target, UserGroupInformation user) {
+
+ boolean ret = false;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerYarnAuthorizer.checkPermission()");
+ }
+
+ try {
+ activatePluginClassLoader();
+
+ ret = yarnAuthorizationProviderImpl.checkPermission(accessType, target, user);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerYarnAuthorizer.checkPermission()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void setPermission(PrivilegedEntity target, Map<AccessType, AccessControlList> acls, UserGroupInformation ugi) {
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerYarnAuthorizer.setPermission()");
+ }
+
+ try {
+ activatePluginClassLoader();
+
+ yarnAuthorizationProviderImpl.setPermission(target, acls, ugi);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerYarnAuthorizer.setPermission()");
+ }
+ }
+
+ @Override
+ public void setAdmins(AccessControlList acls, UserGroupInformation ugi) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerYarnAuthorizer.setAdmins()");
+ }
+
+ try {
+ activatePluginClassLoader();
+
+ yarnAuthorizationProviderImpl.setAdmins(acls, ugi);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerYarnAuthorizer.setAdmins()");
+ }
+ }
+
+ @Override
+ public boolean isAdmin(UserGroupInformation ugi) {
+
+ boolean ret = false;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerYarnAuthorizer.setAdmins()");
+ }
+
+ try {
+ activatePluginClassLoader();
+
+ ret = yarnAuthorizationProviderImpl.isAdmin(ugi);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerYarnAuthorizer.setAdmins()");
+ }
+
+ return ret;
+ }
+
+ private void activatePluginClassLoader() {
+ if(rangerPluginClassLoader != null) {
+ rangerPluginClassLoader.activate();
+ }
+ }
+
+ private void deactivatePluginClassLoader() {
+ if(rangerPluginClassLoader != null) {
+ rangerPluginClassLoader.deactivate();
+ }
+ }
+
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/src/main/assembly/hbase-agent.xml
----------------------------------------------------------------------
diff --git a/src/main/assembly/hbase-agent.xml b/src/main/assembly/hbase-agent.xml
index 0f22066..0ffc65c 100644
--- a/src/main/assembly/hbase-agent.xml
+++ b/src/main/assembly/hbase-agent.xml
@@ -28,21 +28,34 @@
<binaries>
<includeDependencies>false</includeDependencies>
<unpack>false</unpack>
+ <directoryMode>755</directoryMode>
+ <fileMode>644</fileMode>
+ <outputDirectory>/lib</outputDirectory>
+ </binaries>
+ <includes>
+ <include>security_plugins.ranger-hbase-plugin-shim:ranger-hbase-plugin-shim</include>
+ <include>security_plugins.ranger-plugin-classloader:ranger-plugin-classloader</include>
+ </includes>
+ </moduleSet>
+ <moduleSet>
+ <binaries>
+ <includeDependencies>false</includeDependencies>
+ <unpack>false</unpack>
<directoryMode>755</directoryMode>
<fileMode>644</fileMode>
<dependencySets>
<dependencySet>
- <outputDirectory>/lib</outputDirectory>
+ <outputDirectory>/lib/ranger-hbase-plugin-impl</outputDirectory>
<includes>
<include>com.google.code.gson:gson*</include>
<include>org.eclipse.persistence:eclipselink</include>
- <include>org.apache.httpcomponents:httpmime:jar:${httpcomponent.httpmime.version}</include>
- <include>org.noggit:noggit:jar:${noggit.version}</include>
+ <include>org.apache.httpcomponents:httpmime:jar:${httpcomponent.httpmime.version}</include>
+ <include>org.noggit:noggit:jar:${noggit.version}</include>
</includes>
<unpack>false</unpack>
</dependencySet>
</dependencySets>
- <outputDirectory>/lib</outputDirectory>
+ <outputDirectory>/lib/ranger-hbase-plugin-impl</outputDirectory>
</binaries>
<includes>
<include>org.apache.ranger:ranger_solrj</include>
@@ -55,7 +68,7 @@
</moduleSet>
<moduleSet>
<binaries>
- <includeDependencies>false</includeDependencies>
+ <includeDependencies>true</includeDependencies>
<dependencySets>
<dependencySet>
<outputDirectory>/install/lib</outputDirectory>
@@ -67,7 +80,7 @@
<include>commons-io:commons-io:jar:${commons.io.version}</include>
<include>commons-lang:commons-lang</include>
<include>commons-logging:commons-logging:jar:${commons.logging.version}</include>
- <include>com.google.guava:guava:jar:${guava.version}</include>
+ <include>com.google.guava:guava:jar:${google.guava.version}</include>
<include>org.hamcrest:hamcrest-all</include>
<include>junit:junit</include>
<include>org.slf4j:slf4j-api:jar:${slf4j-api.version}</include>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/src/main/assembly/hdfs-agent.xml
----------------------------------------------------------------------
diff --git a/src/main/assembly/hdfs-agent.xml b/src/main/assembly/hdfs-agent.xml
index 2c18001..deec461 100644
--- a/src/main/assembly/hdfs-agent.xml
+++ b/src/main/assembly/hdfs-agent.xml
@@ -24,39 +24,24 @@
<baseDirectory>${project.name}-${project.version}-hdfs-plugin</baseDirectory>
<includeBaseDirectory>true</includeBaseDirectory>
<moduleSets>
+
<moduleSet>
<binaries>
<includeDependencies>false</includeDependencies>
<unpack>false</unpack>
<directoryMode>755</directoryMode>
<fileMode>644</fileMode>
- <dependencySets>
- <dependencySet>
- <outputDirectory>/lib</outputDirectory>
- <includes>
- <include>com.google.code.gson:gson*</include>
- <include>org.eclipse.persistence:javax.persistence</include>
- <include>org.eclipse.persistence:eclipselink</include>
- <include>org.apache.httpcomponents:httpmime:jar:${httpcomponent.httpmime.version}</include>
- <include>org.noggit:noggit:jar:${noggit.version}</include>
- </includes>
- <unpack>false</unpack>
- </dependencySet>
- </dependencySets>
- <outputDirectory>/lib</outputDirectory>
+ <outputDirectory>/lib</outputDirectory>
</binaries>
<includes>
- <include>org.apache.ranger:ranger_solrj</include>
- <include>security_plugins.ranger-plugins-audit:ranger-plugins-audit</include>
- <include>security_plugins.ranger-plugins-cred:ranger-plugins-cred</include>
- <include>security_plugins.ranger-plugins-impl:ranger-plugins-impl</include>
- <include>security_plugins.ranger-plugins-common:ranger-plugins-common</include>
- <include>security_plugins.ranger-hdfs-plugin:ranger-hdfs-plugin</include>
- </includes>
+ <include>security_plugins.ranger-hdfs-plugin-shim:ranger-hdfs-plugin-shim</include>
+ <include>security_plugins.ranger-plugin-classloader:ranger-plugin-classloader</include>
+ </includes>
</moduleSet>
+
<moduleSet>
<binaries>
- <includeDependencies>false</includeDependencies>
+ <includeDependencies>true</includeDependencies>
<dependencySets>
<dependencySet>
<outputDirectory>/install/lib</outputDirectory>
@@ -68,9 +53,9 @@
<include>commons-io:commons-io:jar:${commons.io.version}</include>
<include>commons-lang:commons-lang</include>
<include>commons-logging:commons-logging:jar:${commons.logging.version}</include>
- <include>com.google.guava:guava:jar:${guava.version}</include>
+ <include>com.google.guava:guava:jar:${google.guava.version}</include>
<include>org.hamcrest:hamcrest-all</include>
- <include>junit:junit</include>
+ <include>junit:junit:${junit.version}</include>
<include>org.slf4j:slf4j-api:jar:${slf4j-api.version}</include>
<include>org.apache.hadoop:hadoop-common:jar:${hadoop-common.version}</include>
<include>org.apache.hadoop:hadoop-auth:jar:${hadoop-common.version}</include>
@@ -85,6 +70,38 @@
<include>org.apache.ranger:credentialbuilder</include>
</includes>
</moduleSet>
+
+ <moduleSet>
+ <binaries>
+ <includeDependencies>true</includeDependencies>
+ <unpack>false</unpack>
+ <directoryMode>755</directoryMode>
+ <fileMode>644</fileMode>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>/lib/ranger-hdfs-plugin-impl</outputDirectory>
+ <includes>
+ <include>com.google.code.gson:gson*</include>
+ <include>org.eclipse.persistence:javax.persistence</include>
+ <include>org.eclipse.persistence:eclipselink</include>
+ <include>org.apache.httpcomponents:httpmime:jar:${httpcomponent.httpmime.version}</include>
+ <include>org.noggit:noggit:jar:${noggit.version}</include>
+ </includes>
+ <unpack>false</unpack>
+ </dependencySet>
+ </dependencySets>
+ <outputDirectory>/lib/ranger-hdfs-plugin-impl</outputDirectory>
+ </binaries>
+ <includes>
+ <include>org.apache.ranger:ranger_solrj</include>
+ <include>security_plugins.ranger-plugins-audit:ranger-plugins-audit</include>
+ <include>security_plugins.ranger-plugins-cred:ranger-plugins-cred</include>
+ <include>security_plugins.ranger-plugins-impl:ranger-plugins-impl</include>
+ <include>security_plugins.ranger-plugins-common:ranger-plugins-common</include>
+ <include>security_plugins.ranger-hdfs-plugin:ranger-hdfs-plugin</include>
+ </includes>
+ </moduleSet>
+
</moduleSets>
<fileSets>
<!-- conf.templates for enable -->
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/src/main/assembly/hive-agent.xml
----------------------------------------------------------------------
diff --git a/src/main/assembly/hive-agent.xml b/src/main/assembly/hive-agent.xml
index d21c6b8..9122547 100644
--- a/src/main/assembly/hive-agent.xml
+++ b/src/main/assembly/hive-agent.xml
@@ -24,6 +24,19 @@
<baseDirectory>${project.name}-${project.version}-hive-plugin</baseDirectory>
<includeBaseDirectory>true</includeBaseDirectory>
<moduleSets>
+ <moduleSet>
+ <binaries>
+ <includeDependencies>false</includeDependencies>
+ <unpack>false</unpack>
+ <directoryMode>755</directoryMode>
+ <fileMode>644</fileMode>
+ <outputDirectory>/lib</outputDirectory>
+ </binaries>
+ <includes>
+ <include>security_plugins.ranger-hive-plugin-shim:ranger-hive-plugin-shim</include>
+ <include>security_plugins.ranger-plugin-classloader:ranger-plugin-classloader</include>
+ </includes>
+ </moduleSet>
<moduleSet>
<binaries>
<includeDependencies>false</includeDependencies>
@@ -32,18 +45,18 @@
<fileMode>644</fileMode>
<dependencySets>
<dependencySet>
- <outputDirectory>/lib</outputDirectory>
+ <outputDirectory>/lib/ranger-hive-plugin-impl</outputDirectory>
<includes>
<include>com.google.code.gson:gson*</include>
<include>org.eclipse.persistence:eclipselink</include>
<include>org.eclipse.persistence:javax.persistence</include>
- <include>org.apache.httpcomponents:httpmime:jar:${httpcomponent.httpmime.version}</include>
- <include>org.noggit:noggit:jar:${noggit.version}</include>
+ <include>org.apache.httpcomponents:httpmime:jar:${httpcomponent.httpmime.version}</include>
+ <include>org.noggit:noggit:jar:${noggit.version}</include>
</includes>
<unpack>false</unpack>
</dependencySet>
</dependencySets>
- <outputDirectory>/lib</outputDirectory>
+ <outputDirectory>/lib/ranger-hive-plugin-impl</outputDirectory>
</binaries>
<includes>
<include>org.apache.ranger:ranger_solrj</include>
@@ -56,7 +69,7 @@
</moduleSet>
<moduleSet>
<binaries>
- <includeDependencies>false</includeDependencies>
+ <includeDependencies>true</includeDependencies>
<dependencySets>
<dependencySet>
<outputDirectory>/install/lib</outputDirectory>
@@ -68,7 +81,7 @@
<include>commons-io:commons-io:jar:${commons.io.version}</include>
<include>commons-lang:commons-lang</include>
<include>commons-logging:commons-logging:jar:${commons.logging.version}</include>
- <include>com.google.guava:guava:jar:${guava.version}</include>
+ <include>com.google.guava:guava:jar:${google.guava.version}</include>
<include>org.hamcrest:hamcrest-all</include>
<include>junit:junit</include>
<include>org.slf4j:slf4j-api:jar:${slf4j-api.version}</include>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/src/main/assembly/knox-agent.xml
----------------------------------------------------------------------
diff --git a/src/main/assembly/knox-agent.xml b/src/main/assembly/knox-agent.xml
index 4806343..dc73f69 100644
--- a/src/main/assembly/knox-agent.xml
+++ b/src/main/assembly/knox-agent.xml
@@ -24,6 +24,21 @@
<baseDirectory>${project.name}-${project.version}-knox-plugin</baseDirectory>
<includeBaseDirectory>true</includeBaseDirectory>
<moduleSets>
+
+ <moduleSet>
+ <binaries>
+ <includeDependencies>false</includeDependencies>
+ <unpack>false</unpack>
+ <directoryMode>755</directoryMode>
+ <fileMode>644</fileMode>
+ <outputDirectory>/lib</outputDirectory>
+ </binaries>
+ <includes>
+ <include>security_plugins.ranger-knox-plugin-shim:ranger-knox-plugin-shim</include>
+ <include>security_plugins.ranger-plugin-classloader:ranger-plugin-classloader</include>
+ </includes>
+ </moduleSet>
+
<moduleSet>
<binaries>
<includeDependencies>false</includeDependencies>
@@ -32,10 +47,10 @@
<fileMode>644</fileMode>
<dependencySets>
<dependencySet>
- <outputDirectory>/lib</outputDirectory>
+ <outputDirectory>/lib/ranger-knox-plugin-impl</outputDirectory>
<includes>
<include>commons-configuration:commons-configuration</include>
- <include>com.google.code.gson:gson*</include>
+ <include>com.google.code.gson:gson*</include>
<include>org.apache.httpcomponents:httpmime:jar:${httpcomponent.httpmime.version}</include>
<include>org.noggit:noggit:jar:${noggit.version}</include>
<include>com.google.protobuf:protobuf-java:jar:${protobuf-java.version}</include>
@@ -45,7 +60,7 @@
<unpack>false</unpack>
</dependencySet>
</dependencySets>
- <outputDirectory>/lib</outputDirectory>
+ <outputDirectory>/lib/ranger-knox-plugin-impl</outputDirectory>
</binaries>
<includes>
<include>org.apache.ranger:ranger_solrj</include>
@@ -72,7 +87,7 @@
<include>commons-io:commons-io:jar:${commons.io.version}</include>
<include>commons-lang:commons-lang</include>
<include>commons-logging:commons-logging:jar:${commons.logging.version}</include>
- <include>com.google.guava:guava:jar:${guava.version}</include>
+ <include>com.google.guava:guava:jar:${google.guava.version}</include>
<include>org.hamcrest:hamcrest-all</include>
<include>junit:junit</include>
<include>org.slf4j:slf4j-api:jar:${slf4j-api.version}</include>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/src/main/assembly/plugin-kafka.xml
----------------------------------------------------------------------
diff --git a/src/main/assembly/plugin-kafka.xml b/src/main/assembly/plugin-kafka.xml
index 3727bde..31498e5 100644
--- a/src/main/assembly/plugin-kafka.xml
+++ b/src/main/assembly/plugin-kafka.xml
@@ -20,14 +20,28 @@
<includeBaseDirectory>true</includeBaseDirectory>
<moduleSets>
<moduleSet>
+ <binaries>
+ <includeDependencies>false</includeDependencies>
+ <unpack>false</unpack>
+ <directoryMode>755</directoryMode>
+ <fileMode>644</fileMode>
+ <outputDirectory>/lib</outputDirectory>
+ </binaries>
+ <includes>
+ <include>security_plugins.ranger-kafka-plugin-shim:ranger-kafka-plugin-shim</include>
+ <include>security_plugins.ranger-plugin-classloader:ranger-plugin-classloader</include>
+ </includes>
+ </moduleSet>
+
+ <moduleSet>
<binaries>
- <includeDependencies>false</includeDependencies>
+ <includeDependencies>true</includeDependencies>
<unpack>false</unpack>
<directoryMode>755</directoryMode>
<fileMode>644</fileMode>
<dependencySets>
<dependencySet>
- <outputDirectory>/lib</outputDirectory>
+ <outputDirectory>lib/ranger-kafka-plugin-impl</outputDirectory>
<unpack>false</unpack>
<includes>
<include>commons-configuration:commons-configuration:jar:${commons.configuration.version}
@@ -38,6 +52,7 @@
</include>
<include>org.apache.hadoop:hadoop-auth:jar:${hadoop-common.version}
</include>
+ <include>org.apache.hadoop:hadoop-hdfs:jar:${hadoop.version}</include>
<include>com.google.code.gson:gson</include>
<include>org.eclipse.persistence:eclipselink</include>
<include>org.eclipse.persistence:javax.persistence</include>
@@ -47,7 +62,7 @@
</include>
<include>commons-lang:commons-lang</include>
<include>commons-io:commons-io</include>
- <include>com.google.guava:guava:jar:${guava.version}</include>
+ <include>com.google.guava:guava:jar:${google.guava.version}</include>
<include>org.apache.httpcomponents:httpclient:jar:${httpcomponent.httpclient.version}
</include>
<include>org.apache.httpcomponents:httpcore:jar:${httpcomponent.httpcore.version}
@@ -59,7 +74,6 @@
<include>org.codehaus.jackson:jackson-jaxrs</include>
<include>org.codehaus.jackson:jackson-mapper-asl</include>
<include>org.codehaus.jackson:jackson-xc</include>
-
</includes>
</dependencySet>
<dependencySet>
@@ -77,7 +91,7 @@
<include>commons-lang:commons-lang:jar:${commons.lang.version}
</include>
<include>commons-logging:commons-logging</include>
- <include>com.google.guava:guava:jar:${guava.version}</include>
+ <include>com.google.guava:guava:jar:${google.guava.version}</include>
<include>org.hamcrest:hamcrest-all</include>
<include>junit:junit</include>
<include>org.slf4j:slf4j-api:jar:${slf4j-api.version}</include>
@@ -91,20 +105,14 @@
</includes>
</dependencySet>
</dependencySets>
- <outputDirectory>/lib</outputDirectory>
+ <outputDirectory>lib/ranger-kafka-plugin-impl</outputDirectory>
</binaries>
<includes>
+ <include>security_plugins.ranger-kafka-plugin:ranger-kafka-plugin</include>
<include>org.apache.ranger:ranger_solrj</include>
- <include>security_plugins.ranger-plugins-audit:ranger-plugins-audit
- </include>
- <include>security_plugins.ranger-plugins-cred:ranger-plugins-cred
- </include>
- <include>security_plugins.ranger-plugins-impl:ranger-plugins-impl
- </include>
- <include>security_plugins.ranger-plugins-common:ranger-plugins-common
- </include>
- <include>security_plugins.ranger-kafka-plugin:ranger-kafka-plugin
- </include>
+ <include>security_plugins.ranger-plugins-audit:ranger-plugins-audit</include>
+ <include>security_plugins.ranger-plugins-cred:ranger-plugins-cred</include>
+ <include>security_plugins.ranger-plugins-common:ranger-plugins-common</include>
</includes>
</moduleSet>
<moduleSet>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/src/main/assembly/plugin-yarn.xml
----------------------------------------------------------------------
diff --git a/src/main/assembly/plugin-yarn.xml b/src/main/assembly/plugin-yarn.xml
index a791bba..6f8e33b 100644
--- a/src/main/assembly/plugin-yarn.xml
+++ b/src/main/assembly/plugin-yarn.xml
@@ -24,6 +24,20 @@
<baseDirectory>${project.name}-${project.version}-yarn-plugin</baseDirectory>
<includeBaseDirectory>true</includeBaseDirectory>
<moduleSets>
+ <moduleSet>
+ <binaries>
+ <includeDependencies>false</includeDependencies>
+ <unpack>false</unpack>
+ <directoryMode>755</directoryMode>
+ <fileMode>644</fileMode>
+ <outputDirectory>/lib</outputDirectory>
+ </binaries>
+ <includes>
+ <include>security_plugins.ranger-yarn-plugin-shim:ranger-yarn-plugin-shim</include>
+ <include>security_plugins.ranger-plugin-classloader:ranger-plugin-classloader</include>
+ </includes>
+ </moduleSet>
+
<moduleSet>
<binaries>
<includeDependencies>false</includeDependencies>
@@ -32,7 +46,7 @@
<fileMode>644</fileMode>
<dependencySets>
<dependencySet>
- <outputDirectory>/lib</outputDirectory>
+ <outputDirectory>/lib/ranger-yarn-plugin-impl</outputDirectory>
<unpack>false</unpack>
<includes>
<include>org.apache.hadoop:hadoop-common:jar:${hadoop-common.version}</include>
@@ -54,8 +68,8 @@
<include>commons-configuration:commons-configuration:jar:${commons.configuration.version}</include>
<include>commons-io:commons-io:jar:${commons.io.version}</include>
<include>commons-lang:commons-lang:jar:${commons.lang.version}</include>
- <include>commons-logging:commons-logging</include>
- <include>com.google.guava:guava:jar:${guava.version}</include>
+ <include>commons-logging:commons-logging:jar:${commons.logging.version}</include>
+ <include>com.google.guava:guava:jar:${google.guava.version}</include>
<include>org.hamcrest:hamcrest-all</include>
<include>junit:junit</include>
<include>org.slf4j:slf4j-api:jar:${slf4j-api.version}</include>
@@ -66,7 +80,7 @@
</includes>
</dependencySet>
</dependencySets>
- <outputDirectory>/lib</outputDirectory>
+ <outputDirectory>/lib/ranger-yarn-plugin-impl</outputDirectory>
</binaries>
<includes>
<include>org.apache.ranger:ranger_solrj</include>
@@ -79,7 +93,7 @@
</moduleSet>
<moduleSet>
<binaries>
- <includeDependencies>false</includeDependencies>
+ <includeDependencies>true</includeDependencies>
<outputDirectory>/install/lib</outputDirectory>
<unpack>false</unpack>
</binaries>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/src/main/assembly/storm-agent.xml
----------------------------------------------------------------------
diff --git a/src/main/assembly/storm-agent.xml b/src/main/assembly/storm-agent.xml
index 12ec052..a5f4b2c 100644
--- a/src/main/assembly/storm-agent.xml
+++ b/src/main/assembly/storm-agent.xml
@@ -30,9 +30,22 @@
<unpack>false</unpack>
<directoryMode>755</directoryMode>
<fileMode>644</fileMode>
+ <outputDirectory>/lib</outputDirectory>
+ </binaries>
+ <includes>
+ <include>security_plugins.ranger-storm-plugin-shim:ranger-storm-plugin-shim</include>
+ <include>security_plugins.ranger-plugin-classloader:ranger-plugin-classloader</include>
+ </includes>
+ </moduleSet>
+ <moduleSet>
+ <binaries>
+ <includeDependencies>true</includeDependencies>
+ <unpack>false</unpack>
+ <directoryMode>755</directoryMode>
+ <fileMode>644</fileMode>
<dependencySets>
<dependencySet>
- <outputDirectory>/lib</outputDirectory>
+ <outputDirectory>lib/ranger-storm-plugin-impl</outputDirectory>
<unpack>false</unpack>
<includes>
<include>commons-configuration:commons-configuration:jar:${commons.configuration.version}</include>
@@ -44,7 +57,7 @@
<include>commons-collections:commons-collections</include>
<include>com.sun.jersey:jersey-bundle</include>
<include>commons-logging:commons-logging:jar:${commons.logging.version}</include>
- <include>com.google.guava:guava:jar:${guava.version}</include>
+ <include>com.google.guava:guava:jar:${google.guava.version}</include>
<include>org.codehaus.jackson:jackson-jaxrs:jar:${codehaus.jackson.version}</include>
<include>org.codehaus.jackson:jackson-core-asl:jar:${codehaus.jackson.storm.version}</include>
<include>org.codehaus.jackson:jackson-mapper-asl:jar:${codehaus.jackson.storm.version}</include>
@@ -55,7 +68,7 @@
<include>com.google.protobuf:protobuf-java:jar:${protobuf-java.version}</include>
<include>org.apache.hadoop:hadoop-hdfs:jar:${hadoop.version}</include>
<include>org.apache.htrace:htrace-core:jar:${htrace-core.version}</include>
- <include>commons-cli:commons-cli:jar:${commons.cli.version}</include>
+ <include>commons-cli:commons-cli:jar:${commons.cli.version}</include>
<include>commons-lang:commons-lang:jar:${commons.lang.version}</include>
<include>commons-io:commons-io:jar:${commons.io.version}</include>
</includes>
@@ -72,7 +85,7 @@
<include>commons-io:commons-io:jar:${commons.io.version}</include>
<include>commons-lang:commons-lang:jar:${commons.lang.version}</include>
<include>commons-logging:commons-logging</include>
- <include>com.google.guava:guava:jar:${guava.version}</include>
+ <include>com.google.guava:guava:jar:${google.guava.version}</include>
<include>org.hamcrest:hamcrest-all</include>
<include>junit:junit</include>
<include>org.slf4j:slf4j-api:jar:${slf4j-api.version}</include>
@@ -83,7 +96,7 @@
</includes>
</dependencySet>
</dependencySets>
- <outputDirectory>/lib</outputDirectory>
+ <outputDirectory>lib/ranger-storm-plugin-impl</outputDirectory>
</binaries>
<includes>
<include>org.apache.ranger:ranger_solrj</include>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/storm-agent/src/main/java/com/xasecure/authorization/storm/authorizer/XaSecureStormAuthorizer.java
----------------------------------------------------------------------
diff --git a/storm-agent/src/main/java/com/xasecure/authorization/storm/authorizer/XaSecureStormAuthorizer.java b/storm-agent/src/main/java/com/xasecure/authorization/storm/authorizer/XaSecureStormAuthorizer.java
deleted file mode 100644
index 723dd79..0000000
--- a/storm-agent/src/main/java/com/xasecure/authorization/storm/authorizer/XaSecureStormAuthorizer.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.xasecure.authorization.storm.authorizer;
-
-import org.apache.ranger.authorization.storm.authorizer.RangerStormAuthorizer;
-
-/**
- * This class exists only to provide for seamless upgrade/downgrade capabilities. Class name is in storm conf which must allow for seamles upgrade and downgrade.
- * Thus when class names were changed XaSecure* -> Ranger* this shell class serves to allow for seamles upgrade as well as downgrade.
- *
- * This class is final because if one needs to customize coprocessor it is expected that RangerStormAuthorizer would be modified/extended as that is
- * the "real" authorizer! This class, hence, should NEVER be more than an EMPTY shell!
- */
-final public class XaSecureStormAuthorizer extends RangerStormAuthorizer {
-}
[3/4] incubator-ranger git commit: RANGER-586:Ranger plugins should
not add dependent libraries to component's CLASSPATH
Posted by rm...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-hbase-plugin-shim/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessor.java
----------------------------------------------------------------------
diff --git a/ranger-hbase-plugin-shim/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessor.java b/ranger-hbase-plugin-shim/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessor.java
new file mode 100644
index 0000000..a9b3cad
--- /dev/null
+++ b/ranger-hbase-plugin-shim/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessor.java
@@ -0,0 +1,3701 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ranger.authorization.hbase;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.NavigableSet;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellScanner;
+import org.apache.hadoop.hbase.Coprocessor;
+import org.apache.hadoop.hbase.CoprocessorEnvironment;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.NamespaceDescriptor;
+import org.apache.hadoop.hbase.ServerName;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Append;
+import org.apache.hadoop.hbase.client.Delete;
+import org.apache.hadoop.hbase.client.Durability;
+import org.apache.hadoop.hbase.client.Get;
+import org.apache.hadoop.hbase.client.Increment;
+import org.apache.hadoop.hbase.client.Mutation;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.coprocessor.BulkLoadObserver;
+import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
+import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
+import org.apache.hadoop.hbase.coprocessor.MasterObserver;
+import org.apache.hadoop.hbase.coprocessor.ObserverContext;
+import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
+import org.apache.hadoop.hbase.coprocessor.RegionObserver;
+import org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessorEnvironment;
+import org.apache.hadoop.hbase.coprocessor.RegionServerObserver;
+import org.apache.hadoop.hbase.filter.ByteArrayComparable;
+import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
+import org.apache.hadoop.hbase.io.FSDataInputStreamWrapper;
+import org.apache.hadoop.hbase.io.Reference;
+import org.apache.hadoop.hbase.io.hfile.CacheConfig;
+import org.apache.hadoop.hbase.master.RegionPlan;
+import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos;
+import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.CheckPermissionsRequest;
+import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.CheckPermissionsResponse;
+import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GetUserPermissionsRequest;
+import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GetUserPermissionsResponse;
+import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GrantRequest;
+import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GrantResponse;
+import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.RevokeRequest;
+import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.RevokeResponse;
+import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.WALEntry;
+import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
+import org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.Quotas;
+import org.apache.hadoop.hbase.protobuf.generated.SecureBulkLoadProtos.CleanupBulkLoadRequest;
+import org.apache.hadoop.hbase.protobuf.generated.SecureBulkLoadProtos.PrepareBulkLoadRequest;
+import org.apache.hadoop.hbase.regionserver.DeleteTracker;
+import org.apache.hadoop.hbase.regionserver.InternalScanner;
+import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
+import org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress;
+import org.apache.hadoop.hbase.regionserver.Region;
+import org.apache.hadoop.hbase.regionserver.Region.Operation;
+import org.apache.hadoop.hbase.regionserver.RegionScanner;
+import org.apache.hadoop.hbase.regionserver.ScanType;
+import org.apache.hadoop.hbase.regionserver.Store;
+import org.apache.hadoop.hbase.regionserver.StoreFile;
+import org.apache.hadoop.hbase.regionserver.StoreFile.Reader;
+import org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest;
+import org.apache.hadoop.hbase.regionserver.wal.HLogKey;
+import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
+import org.apache.hadoop.hbase.replication.ReplicationEndpoint;
+import org.apache.hadoop.hbase.security.access.RangerAccessControlLists;
+import org.apache.hadoop.hbase.util.Pair;
+import org.apache.hadoop.hbase.wal.WALKey;
+import org.apache.ranger.plugin.classloader.RangerPluginClassLoader;
+
+import com.google.common.collect.ImmutableList;
+import com.google.protobuf.RpcCallback;
+import com.google.protobuf.RpcController;
+import com.google.protobuf.Service;
+
+public class RangerAuthorizationCoprocessor implements MasterObserver, RegionObserver, RegionServerObserver, BulkLoadObserver, AccessControlProtos.AccessControlService.Interface, CoprocessorService, Coprocessor {
+
+ public static final Log LOG = LogFactory.getLog(RangerAuthorizationCoprocessor.class);
+ private static final String RANGER_PLUGIN_TYPE = "hbase";
+ private static final String[] RANGER_PLUGIN_LIB_DIR = new String[] {"lib/ranger-hbase-plugin"};
+ private static final String RANGER_HBASE_AUTHORIZER_IMPL_CLASSNAME = "org.apache.ranger.authorization.hbase.RangerAuthorizationCoprocessor";
+ private static final String ACCESSCONTROLLISTS_CLASSNAME = "org.apache.hadoop.hbase.security.access.AccessControlLists";
+
+ private static RangerPluginClassLoader rangerPluginClassLoader = null;
+
+ private Object impl = null;
+ private MasterObserver implMasterObserver = null;
+ private RegionObserver implRegionObserver = null;
+ private RegionServerObserver implRegionServerObserver = null;
+ private BulkLoadObserver implBulkLoadObserver = null;
+ private AccessControlProtos.AccessControlService.Interface implAccessControlService = null;
+ private CoprocessorService implCoprocessorService = null;
+
+ public RangerAuthorizationCoprocessor() {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.RangerAuthorizationCoprocessor()");
+ }
+
+ this.init();
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.RangerAuthorizationCoprocessor()");
+ }
+ }
+
+ private void init(){
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.init()");
+ }
+
+ try {
+
+ rangerPluginClassLoader = RangerPluginClassLoader.getInstance(RANGER_PLUGIN_TYPE, this.getClass());
+
+ @SuppressWarnings("unchecked")
+ Class<?> cls = Class.forName(RANGER_HBASE_AUTHORIZER_IMPL_CLASSNAME, true, rangerPluginClassLoader);
+
+ activatePluginClassLoader();
+
+ impl = cls.newInstance();
+ implMasterObserver = (MasterObserver)impl;
+ implRegionObserver = (RegionObserver)impl;
+ implRegionServerObserver = (RegionServerObserver)impl;
+ implBulkLoadObserver = (BulkLoadObserver)impl;
+ implAccessControlService = (AccessControlProtos.AccessControlService.Interface)impl;
+ implCoprocessorService = (CoprocessorService)impl;
+
+ } catch (Exception e) {
+ // check what need to be done
+ LOG.error("Error Enabling RangerHdfsPluing", e);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.init()");
+ }
+ }
+
+ @Override
+ public Service getService() {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.getService()");
+ }
+ Service ret = null;
+ try {
+ activatePluginClassLoader();
+ ret = implCoprocessorService.getService();
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.getService()" + ret);
+ }
+
+ return ret;
+ }
+
+
+ @Override
+ public void postScannerClose(ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postScannerClose()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postScannerClose(c, s);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postScannerClose()");
+ }
+ }
+
+ @Override
+ public RegionScanner postScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Scan scan, RegionScanner s) throws IOException {
+ RegionScanner ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postScannerOpen()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.postScannerOpen(c, scan, s);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postScannerOpen()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void postStartMaster(ObserverContext<MasterCoprocessorEnvironment> ctx) throws IOException {
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postStartMaster()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.postStartMaster(ctx);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postStartMaster()");
+ }
+
+ }
+
+ @Override
+ public void preAddColumn(ObserverContext<MasterCoprocessorEnvironment> c,TableName tableName, HColumnDescriptor column) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preAddColumn()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preAddColumn(c, tableName, column);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preAddColumn()");
+ }
+ }
+
+ @Override
+ public Result preAppend(ObserverContext<RegionCoprocessorEnvironment> c, Append append) throws IOException {
+ Result ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preAppend()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.preAppend(c, append);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preAppend()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void preAssign(ObserverContext<MasterCoprocessorEnvironment> c, HRegionInfo regionInfo) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preAssign()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preAssign(c, regionInfo);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preAssign()");
+ }
+ }
+
+ @Override
+ public void preBalance(ObserverContext<MasterCoprocessorEnvironment> c) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preBalance()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preBalance(c);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preBalance()");
+ }
+ }
+
+ @Override
+ public boolean preBalanceSwitch(ObserverContext<MasterCoprocessorEnvironment> c, boolean newValue) throws IOException {
+ boolean ret = false;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preBalanceSwitch()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implMasterObserver.preBalanceSwitch(c, newValue);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preBalanceSwitch()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void preBulkLoadHFile(ObserverContext<RegionCoprocessorEnvironment> ctx, List<Pair<byte[], String>> familyPaths) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preBulkLoadHFile()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preBulkLoadHFile(ctx, familyPaths);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preBulkLoadHFile()");
+ }
+
+ }
+
+ @Override
+ public boolean preCheckAndDelete(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp, ByteArrayComparable comparator, Delete delete, boolean result) throws IOException {
+ boolean ret = false;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preCheckAndDelete()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.preCheckAndDelete(c, row, family, qualifier, compareOp,comparator, delete, result);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preCheckAndDelete()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public boolean preCheckAndPut(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp, ByteArrayComparable comparator, Put put, boolean result) throws IOException {
+ boolean ret = false;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preCheckAndPut()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.preCheckAndPut(c, row, family, qualifier, compareOp, comparator,put, result);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preCheckAndPut()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void preCloneSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, SnapshotDescription snapshot, HTableDescriptor hTableDescriptor) throws IOException {
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preCloneSnapshot()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preCloneSnapshot(ctx, snapshot, hTableDescriptor);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preCloneSnapshot()");
+ }
+ }
+
+ @Override
+ public void preClose(ObserverContext<RegionCoprocessorEnvironment> e,boolean abortRequested) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preClose()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preClose(e, abortRequested);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preClose()");
+ }
+ }
+
+ @Override
+ public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e, Store store, InternalScanner scanner, ScanType scanType) throws IOException {
+ InternalScanner ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preCompact()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.preCompact(e, store, scanner, scanType);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preCompact()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void preCompactSelection(ObserverContext<RegionCoprocessorEnvironment> e, Store store,List<StoreFile> candidates) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preCompactSelection()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preCompactSelection(e, store, candidates);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preCompactSelection()");
+ }
+ }
+
+ @Override
+ public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> c, HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preCreateTable()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preCreateTable(c, desc, regions);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preCreateTable()");
+ }
+ }
+
+ @Override
+ public void preDelete(ObserverContext<RegionCoprocessorEnvironment> c, Delete delete, WALEdit edit, Durability durability) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preDelete()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preDelete(c, delete, edit, durability);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preDelete()");
+ }
+ }
+
+ @Override
+ public void preDeleteColumn(ObserverContext<MasterCoprocessorEnvironment> c,TableName tableName, byte[] col) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preDeleteColumn()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preDeleteColumn(c, tableName, col);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preDeleteColumn()");
+ }
+ }
+
+ @Override
+ public void preDeleteSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, SnapshotDescription snapshot) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preDeleteSnapshot()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preDeleteSnapshot(ctx, snapshot);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preDeleteSnapshot()");
+ }
+ }
+
+ @Override
+ public void preDeleteTable(ObserverContext<MasterCoprocessorEnvironment> c, TableName tableName) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preDeleteTable()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preDeleteTable(c, tableName);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preDeleteTable()");
+ }
+ }
+
+ @Override
+ public void preDisableTable(ObserverContext<MasterCoprocessorEnvironment> c, TableName tableName) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preDisableTable()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preDisableTable(c, tableName);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preDisableTable()");
+ }
+ }
+
+ @Override
+ public void preEnableTable(ObserverContext<MasterCoprocessorEnvironment> c, TableName tableName) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preEnableTable()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preEnableTable(c, tableName);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preEnableTable()");
+ }
+ }
+
+ @Override
+ public boolean preExists(ObserverContext<RegionCoprocessorEnvironment> c, Get get, boolean exists) throws IOException {
+ boolean ret = false;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preExists()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.preExists(c, get, exists);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preExists()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void preFlush(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preFlush()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preFlush(e);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preFlush()");
+ }
+ }
+
+ @Override
+ public void preGetClosestRowBefore( ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, Result result) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preGetClosestRowBefore()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preGetClosestRowBefore(c, row, family, result);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preGetClosestRowBefore()");
+ }
+ }
+
+ @Override
+ public Result preIncrement(ObserverContext<RegionCoprocessorEnvironment> c, Increment increment) throws IOException {
+ Result ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preIncrement()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.preIncrement(c, increment);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preIncrement()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public long preIncrementColumnValue(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row,byte[] family, byte[] qualifier, long amount, boolean writeToWAL) throws IOException {
+ long ret;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preIncrementColumnValue()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.preIncrementColumnValue(c, row, family, qualifier, amount,writeToWAL);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preIncrementColumnValue()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void preModifyColumn( ObserverContext<MasterCoprocessorEnvironment> c, TableName tableName, HColumnDescriptor descriptor) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preModifyColumn()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preModifyColumn(c, tableName, descriptor);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preModifyColumn()");
+ }
+ }
+
+ @Override
+ public void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> c, TableName tableName, HTableDescriptor htd) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preModifyTable()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preModifyTable(c, tableName, htd);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preModifyTable()");
+ }
+ }
+
+ @Override
+ public void preMove(ObserverContext<MasterCoprocessorEnvironment> c, HRegionInfo region, ServerName srcServer, ServerName destServer) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preMove()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preMove(c, region, srcServer, destServer);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preMove()");
+ }
+ }
+
+ @Override
+ public void preOpen(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preOpen()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preOpen(e);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preOpen()");
+ }
+ }
+
+ @Override
+ public void preRestoreSnapshot( ObserverContext<MasterCoprocessorEnvironment> ctx, SnapshotDescription snapshot, HTableDescriptor hTableDescriptor) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preRestoreSnapshot()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preRestoreSnapshot(ctx, snapshot, hTableDescriptor);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preRestoreSnapshot()");
+ }
+ }
+
+ @Override
+ public void preScannerClose(ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preScannerClose()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preScannerClose(c, s);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preScannerClose()");
+ }
+ }
+
+ @Override
+ public boolean preScannerNext(ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s, List<Result> result, int limit, boolean hasNext) throws IOException {
+ boolean ret = false;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preScannerNext()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.preScannerNext(c, s, result, limit, hasNext);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preScannerNext()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public RegionScanner preScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Scan scan, RegionScanner s) throws IOException {
+ RegionScanner ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preScannerOpen()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.preScannerOpen(c, scan, s);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preScannerOpen()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void preShutdown(ObserverContext<MasterCoprocessorEnvironment> c) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preShutdown()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preShutdown(c);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preShutdown()");
+ }
+ }
+
+ @Override
+ public void preSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, SnapshotDescription snapshot, HTableDescriptor hTableDescriptor) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preSnapshot()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preSnapshot(ctx, snapshot, hTableDescriptor);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preSnapshot()");
+ }
+ }
+
+ @Override
+ public void preSplit(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preSplit()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preSplit(e);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preSplit()");
+ }
+ }
+
+ @Override
+ public void preStopMaster(ObserverContext<MasterCoprocessorEnvironment> c) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preStopMaster()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preStopMaster(c);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preStopMaster()");
+ }
+ }
+
+ @Override
+ public void preStopRegionServer( ObserverContext<RegionServerCoprocessorEnvironment> env) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preStopRegionServer()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionServerObserver.preStopRegionServer(env);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preStopRegionServer()");
+ }
+ }
+
+ @Override
+ public void preUnassign(ObserverContext<MasterCoprocessorEnvironment> c, HRegionInfo regionInfo, boolean force) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preUnassign()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preUnassign(c, regionInfo, force);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preUnassign()");
+ }
+ }
+
+ @Override
+ public void preSetUserQuota(ObserverContext<MasterCoprocessorEnvironment> ctx, String userName, Quotas quotas) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preSetUserQuota()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preSetUserQuota(ctx, userName, quotas);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preSetUserQuota()");
+ }
+ }
+
+ @Override
+ public void preSetUserQuota( ObserverContext<MasterCoprocessorEnvironment> ctx, String userName, TableName tableName, Quotas quotas) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preSetUserQuota()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preSetUserQuota(ctx, userName, tableName, quotas);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preSetUserQuota()");
+ }
+ }
+
+ @Override
+ public void preSetUserQuota(ObserverContext<MasterCoprocessorEnvironment> ctx, String userName, String namespace, Quotas quotas) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preSetUserQuota()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preSetUserQuota(ctx, userName, namespace, quotas);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preSetUserQuota()");
+ }
+ }
+
+ @Override
+ public void preSetTableQuota(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName, Quotas quotas) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preSetTableQuota()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preSetTableQuota(ctx, tableName, quotas);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preSetTableQuota()");
+ }
+ }
+
+ @Override
+ public void preSetNamespaceQuota(ObserverContext<MasterCoprocessorEnvironment> ctx, String namespace, Quotas quotas) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preSetNamespaceQuota()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preSetNamespaceQuota(ctx, namespace, quotas);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preSetNamespaceQuota()");
+ }
+ }
+
+ @Override
+ public void start(CoprocessorEnvironment env) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.start()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.start(env);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.start()");
+ }
+ }
+
+ @Override
+ public void prePut(ObserverContext<RegionCoprocessorEnvironment> c, Put put, WALEdit edit, Durability durability) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.prePut()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.prePut(c, put, edit, durability);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.prePut()");
+ }
+ }
+
+ @Override
+ public void preGetOp(ObserverContext<RegionCoprocessorEnvironment> rEnv, Get get, List<Cell> result) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preGetOp()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preGetOp(rEnv, get, result);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preGetOp()");
+ }
+ }
+
+ @Override
+ public void preRegionOffline( ObserverContext<MasterCoprocessorEnvironment> c,HRegionInfo regionInfo) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preRegionOffline()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preRegionOffline(c, regionInfo);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preRegionOffline()");
+ }
+ }
+
+ @Override
+ public void preCreateNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx,NamespaceDescriptor ns) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preCreateNamespace()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preCreateNamespace(ctx, ns);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preCreateNamespace()");
+ }
+ }
+
+ @Override
+ public void preDeleteNamespace( ObserverContext<MasterCoprocessorEnvironment> ctx, String namespace) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preDeleteNamespace()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preDeleteNamespace(ctx, namespace);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preDeleteNamespace()");
+ }
+ }
+
+ @Override
+ public void preModifyNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx, NamespaceDescriptor ns) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preModifyNamespace()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preModifyNamespace(ctx, ns);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preModifyNamespace()");
+ }
+ }
+
+ @Override
+ public void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx, List<TableName> tableNamesList, List<HTableDescriptor> descriptors, String regex) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postGetTableDescriptors()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.postGetTableDescriptors(ctx, tableNamesList, descriptors, regex);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postGetTableDescriptors()");
+ }
+ }
+
+ @Override
+ public void preMerge(ObserverContext<RegionServerCoprocessorEnvironment> ctx, Region regionA, Region regionB) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preMerge()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionServerObserver.preMerge(ctx, regionA, regionB);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preMerge()");
+ }
+ }
+
+ @Override
+ public void prePrepareBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx, PrepareBulkLoadRequest request) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.prePrepareBulkLoad()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implBulkLoadObserver.prePrepareBulkLoad(ctx, request);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.prePrepareBulkLoad()");
+ }
+ }
+
+ @Override
+ public void preCleanupBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx, CleanupBulkLoadRequest request) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preCleanupBulkLoad()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implBulkLoadObserver.preCleanupBulkLoad(ctx, request);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preCleanupBulkLoad()");
+ }
+ }
+
+ @Override
+ public void grant(RpcController controller, GrantRequest request, RpcCallback<GrantResponse> done) {
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.grant()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implAccessControlService.grant(controller, request, done);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.grant()");
+ }
+ }
+
+ @Override
+ public void revoke(RpcController controller, RevokeRequest request, RpcCallback<RevokeResponse> done) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.revoke()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implAccessControlService.revoke(controller, request, done);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.revoke()");
+ }
+ }
+
+ @Override
+ public void checkPermissions(RpcController controller, CheckPermissionsRequest request, RpcCallback<CheckPermissionsResponse> done) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.checkPermissions()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implAccessControlService.checkPermissions(controller, request, done);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.checkPermissions()");
+ }
+ }
+
+ @Override
+ public void getUserPermissions(RpcController controller, GetUserPermissionsRequest request, RpcCallback<GetUserPermissionsResponse> done) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.getUserPermissions()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implAccessControlService.getUserPermissions(controller, request, done);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.getUserPermissions()");
+ }
+ }
+
+ @Override
+ public void stop(CoprocessorEnvironment env) throws IOException {
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.stop()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.stop(env);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.stop()");
+ }
+ }
+
+ @Override
+ public void postMerge(ObserverContext<RegionServerCoprocessorEnvironment> c, Region regionA, Region regionB, Region mergedRegion) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postMerge()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionServerObserver.postMerge(c,regionA, regionB, mergedRegion);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postMerge()");
+ }
+ }
+
+ @Override
+ public void preMergeCommit(ObserverContext<RegionServerCoprocessorEnvironment> ctx, Region regionA, Region regionB, List<Mutation> metaEntries) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preMergeCommit()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionServerObserver.preMergeCommit(ctx ,regionA, regionB, metaEntries);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preMergeCommit()");
+ }
+ }
+
+ @Override
+ public void postMergeCommit(ObserverContext<RegionServerCoprocessorEnvironment> ctx, Region regionA, Region regionB, Region mergedRegion) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postMergeCommit()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionServerObserver.postMergeCommit(ctx ,regionA, regionB, mergedRegion);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postMergeCommit()");
+ }
+ }
+
+ @Override
+ public void preRollBackMerge(ObserverContext<RegionServerCoprocessorEnvironment> ctx,Region regionA, Region regionB) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preRollBackMerge()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionServerObserver.preRollBackMerge(ctx ,regionA, regionB);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preRollBackMerge()");
+ }
+ }
+
+ @Override
+ public void postRollBackMerge(ObserverContext<RegionServerCoprocessorEnvironment> ctx, Region regionA, Region regionB) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postRollBackMerge()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionServerObserver.postRollBackMerge(ctx ,regionA, regionB);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postRollBackMerge()");
+ }
+ }
+
+ @Override
+ public void preRollWALWriterRequest(ObserverContext<RegionServerCoprocessorEnvironment> ctx) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preRollWALWriterRequest()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionServerObserver.preRollWALWriterRequest(ctx);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preRollWALWriterRequest()");
+ }
+ }
+
+ @Override
+ public void postRollWALWriterRequest(ObserverContext<RegionServerCoprocessorEnvironment> ctx) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postRollWALWriterRequest()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionServerObserver.postRollWALWriterRequest(ctx);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postRollWALWriterRequest()");
+ }
+ }
+
+ @Override
+ public ReplicationEndpoint postCreateReplicationEndPoint(ObserverContext<RegionServerCoprocessorEnvironment> ctx, ReplicationEndpoint endpoint) {
+
+ ReplicationEndpoint ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postCreateReplicationEndPoint()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionServerObserver.postCreateReplicationEndPoint(ctx,endpoint);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postCreateReplicationEndPoint()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void preReplicateLogEntries(ObserverContext<RegionServerCoprocessorEnvironment> ctx, List<WALEntry> entries, CellScanner cells) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preReplicateLogEntries()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionServerObserver.preReplicateLogEntries(ctx, entries, cells);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preReplicateLogEntries()");
+ }
+ }
+
+ @Override
+ public void postReplicateLogEntries(ObserverContext<RegionServerCoprocessorEnvironment> ctx, List<WALEntry> entries, CellScanner cells) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postReplicateLogEntries()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionServerObserver.postReplicateLogEntries(ctx, entries, cells);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postReplicateLogEntries()");
+ }
+ }
+
+ @Override
+ public void postOpen(ObserverContext<RegionCoprocessorEnvironment> c) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postOpen()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postOpen(c);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postOpen()");
+ }
+ }
+
+ @Override
+ public void postLogReplay(ObserverContext<RegionCoprocessorEnvironment> c) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postLogReplay()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postLogReplay(c);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postLogReplay()");
+ }
+ }
+
+ @Override
+ public InternalScanner preFlushScannerOpen( ObserverContext<RegionCoprocessorEnvironment> c, Store store, KeyValueScanner memstoreScanner, InternalScanner s) throws IOException {
+
+ InternalScanner ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preFlushScannerOpen()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.preFlushScannerOpen(c, store, memstoreScanner, s);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preFlushScannerOpen()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public InternalScanner preFlush(ObserverContext<RegionCoprocessorEnvironment> c, Store store, InternalScanner scanner) throws IOException {
+
+ InternalScanner ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preFlush()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.preFlush(c, store, scanner);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preFlush()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void postFlush(ObserverContext<RegionCoprocessorEnvironment> c) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postFlush()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postFlush(c);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postFlush()");
+ }
+ }
+
+ @Override
+ public void postFlush(ObserverContext<RegionCoprocessorEnvironment> c, Store store, StoreFile resultFile) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postFlush()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postFlush(c, store, resultFile);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postFlush()");
+ }
+ }
+
+ @Override
+ public void preCompactSelection(ObserverContext<RegionCoprocessorEnvironment> c, Store store, List<StoreFile> candidates, CompactionRequest request) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preCompactSelection()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preCompactSelection(c, store, candidates, request);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preCompactSelection()");
+ }
+ }
+
+ @Override
+ public void postCompactSelection(ObserverContext<RegionCoprocessorEnvironment> c, Store store, ImmutableList<StoreFile> selected, CompactionRequest request) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postCompactSelection()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postCompactSelection(c, store, selected, request);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postCompactSelection()");
+ }
+ }
+
+ @Override
+ public void postCompactSelection( ObserverContext<RegionCoprocessorEnvironment> c, Store store, ImmutableList<StoreFile> selected) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postCompactSelection()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postCompactSelection(c, store, selected);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postCompactSelection()");
+ }
+ }
+
+ @Override
+ public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> c, Store store, InternalScanner scanner, ScanType scanType, CompactionRequest request) throws IOException {
+
+ InternalScanner ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preCompact()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preCompact(c, store, scanner, scanType, request);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preCompact()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public InternalScanner preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store, List<? extends KeyValueScanner> scanners, ScanType scanType,
+ long earliestPutTs, InternalScanner s, CompactionRequest request) throws IOException {
+ InternalScanner ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preCompactScannerOpen()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preCompactScannerOpen(c, store, scanners, scanType, earliestPutTs, s,request);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preCompactScannerOpen()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public InternalScanner preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store, List<? extends KeyValueScanner> scanners, ScanType scanType,
+ long earliestPutTs, InternalScanner s) throws IOException {
+ InternalScanner ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preCompactScannerOpen()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preCompactScannerOpen(c, store, scanners, scanType, earliestPutTs, s);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preCompactScannerOpen()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void postCompact(ObserverContext<RegionCoprocessorEnvironment> c, Store store, StoreFile resultFile, CompactionRequest request) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postCompact()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postCompact(c, store, resultFile, request);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postCompact()");
+ }
+ }
+
+ @Override
+ public void postCompact(ObserverContext<RegionCoprocessorEnvironment> c, Store store, StoreFile resultFile) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postCompact()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postCompact(c, store, resultFile);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postCompact()");
+ }
+ }
+
+ @Override
+ public void preSplit(ObserverContext<RegionCoprocessorEnvironment> c, byte[] splitRow) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preSplit()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preSplit(c, splitRow);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preSplit()");
+ }
+ }
+
+ @Override
+ public void postSplit(ObserverContext<RegionCoprocessorEnvironment> c, Region l, Region r) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postSplit()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postSplit(c, l, r);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postSplit()");
+ }
+ }
+
+ @Override
+ public void preSplitBeforePONR(ObserverContext<RegionCoprocessorEnvironment> ctx, byte[] splitKey, List<Mutation> metaEntries) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preSplitBeforePONR()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preSplitBeforePONR(ctx, splitKey, metaEntries);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preSplitBeforePONR()");
+ }
+ }
+
+ @Override
+ public void preSplitAfterPONR(ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preSplitAfterPONR()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preSplitAfterPONR(ctx);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preSplitAfterPONR()");
+ }
+ }
+
+ @Override
+ public void preRollBackSplit(ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preRollBackSplit()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preRollBackSplit(ctx);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preRollBackSplit()");
+ }
+ }
+
+ @Override
+ public void postRollBackSplit(ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postRollBackSplit()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postRollBackSplit(ctx);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postRollBackSplit()");
+ }
+ }
+
+ @Override
+ public void postCompleteSplit(ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postCompleteSplit()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postCompleteSplit(ctx);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postCompleteSplit()");
+ }
+ }
+
+ @Override
+ public void postClose(ObserverContext<RegionCoprocessorEnvironment> c, boolean abortRequested) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postClose()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postClose(c,abortRequested);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postClose()");
+ }
+ }
+
+ @Override
+ public void postGetClosestRowBefore(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, Result result) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postGetClosestRowBefore()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postGetClosestRowBefore(c, row, family, result);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postGetClosestRowBefore()");
+ }
+ }
+
+ @Override
+ public void postGetOp(ObserverContext<RegionCoprocessorEnvironment> c, Get get, List<Cell> result) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postGetOp()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postGetOp(c, get, result);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postGetOp()");
+ }
+ }
+
+ @Override
+ public boolean postExists(ObserverContext<RegionCoprocessorEnvironment> c, Get get, boolean exists) throws IOException {
+
+ boolean ret = false;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postExists()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.postExists(c, get, exists);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postExists()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void postPut(ObserverContext<RegionCoprocessorEnvironment> c, Put put, WALEdit edit, Durability durability) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postPut()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postPut(c, put, edit, durability);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postPut()");
+ }
+ }
+
+ @Override
+ public void prePrepareTimeStampForDeleteVersion( ObserverContext<RegionCoprocessorEnvironment> c, Mutation mutation, Cell cell, byte[] byteNow, Get get) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.prePrepareTimeStampForDeleteVersion()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.prePrepareTimeStampForDeleteVersion(c, mutation, cell, byteNow, get);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.prePrepareTimeStampForDeleteVersion()");
+ }
+ }
+
+ @Override
+ public void postDelete(ObserverContext<RegionCoprocessorEnvironment> c, Delete delete, WALEdit edit, Durability durability) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postDelete()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postDelete(c, delete, edit, durability);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postDelete()");
+ }
+ }
+
+ @Override
+ public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preBatchMutate()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preBatchMutate(c, miniBatchOp);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preBatchMutate()");
+ }
+ }
+
+ @Override
+ public void postBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postBatchMutate()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postBatchMutate(c, miniBatchOp);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postBatchMutate()");
+ }
+ }
+
+ @Override
+ public void postStartRegionOperation(ObserverContext<RegionCoprocessorEnvironment> ctx, Operation operation) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postStartRegionOperation()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postStartRegionOperation(ctx, operation);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postStartRegionOperation()");
+ }
+ }
+
+ @Override
+ public void postCloseRegionOperation(ObserverContext<RegionCoprocessorEnvironment> ctx, Operation operation) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postCloseRegionOperation()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postCloseRegionOperation(ctx, operation);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postCloseRegionOperation()");
+ }
+ }
+
+ @Override
+ public void postBatchMutateIndispensably(ObserverContext<RegionCoprocessorEnvironment> ctx, MiniBatchOperationInProgress<Mutation> miniBatchOp, boolean success) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postBatchMutateIndispensably()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postBatchMutateIndispensably(ctx, miniBatchOp, success);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postBatchMutateIndispensably()");
+ }
+ }
+
+ @Override
+ public boolean preCheckAndPutAfterRowLock(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp,
+ ByteArrayComparable comparator, Put put, boolean result) throws IOException {
+ boolean ret = false;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preCheckAndPutAfterRowLock()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.preCheckAndPutAfterRowLock(c, row, family, qualifier, compareOp, comparator, put, result);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preCheckAndPutAfterRowLock()");
+ }
+ return ret;
+ }
+
+ @Override
+ public boolean postCheckAndPut(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp,
+ ByteArrayComparable comparator, Put put, boolean result) throws IOException {
+ boolean ret = false;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postCheckAndPut()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.postCheckAndPut(c, row, family, qualifier, compareOp, comparator, put, result);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postCheckAndPut()");
+ }
+ return ret;
+ }
+
+ @Override
+ public boolean preCheckAndDeleteAfterRowLock(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp,
+ ByteArrayComparable comparator, Delete delete, boolean result) throws IOException {
+ boolean ret = false;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preCheckAndDeleteAfterRowLock()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.preCheckAndDeleteAfterRowLock(c, row, family, qualifier, compareOp, comparator, delete, result);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preCheckAndDeleteAfterRowLock()");
+ }
+ return ret;
+ }
+
+ @Override
+ public boolean postCheckAndDelete(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row,byte[] family, byte[] qualifier, CompareOp compareOp,
+ ByteArrayComparable comparator, Delete delete, boolean result) throws IOException {
+ boolean ret = false;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postCheckAndDelete()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.postCheckAndDelete(c, row, family, qualifier, compareOp, comparator, delete, result);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postCheckAndDelete()");
+ }
+ return ret;
+ }
+
+ @Override
+ public long postIncrementColumnValue(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, byte[] qualifier, long amount, boolean writeToWAL, long result) throws IOException {
+ long ret = 0;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postIncrementColumnValue()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.postIncrementColumnValue(c, row, family, qualifier, amount, writeToWAL, result);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postIncrementColumnValue()");
+ }
+ return ret;
+ }
+
+ @Override
+ public Result preAppendAfterRowLock(ObserverContext<RegionCoprocessorEnvironment> c, Append append) throws IOException {
+ Result ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preAppendAfterRowLock()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.preAppendAfterRowLock(c, append);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preAppendAfterRowLock()");
+ }
+ return ret;
+ }
+
+ @Override
+ public Result postAppend(ObserverContext<RegionCoprocessorEnvironment> c, Append append, Result result) throws IOException {
+ Result ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postAppend()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.postAppend(c, append, result);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postAppend()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public Result preIncrementAfterRowLock(ObserverContext<RegionCoprocessorEnvironment> c, Increment increment) throws IOException {
+ Result ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preIncrementAfterRowLock()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.preIncrementAfterRowLock(c, increment);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preIncrementAfterRowLock()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public Result postIncrement(ObserverContext<RegionCoprocessorEnvironment> c, Increment increment, Result result) throws IOException {
+ Result ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postIncrement()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.postIncrement(c, increment, result );
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postIncrement()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public KeyValueScanner preStoreScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store, Scan scan, NavigableSet<byte[]> targetCols, KeyValueScanner s) throws IOException {
+ KeyValueScanner ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preStoreScannerOpen()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.preStoreScannerOpen(c, store, scan, targetCols, s);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preStoreScannerOpen()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public boolean postScannerNext( ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s, List<Result> result, int limit, boolean hasNext) throws IOException {
+ boolean ret = false;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postScannerNext()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.postScannerNext(c, s, result, limit, hasNext);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postScannerNext()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public boolean postScannerFilterRow( ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s, byte[] currentRow, int offset, short length, boolean hasMore) throws IOException {
+
+ boolean ret = false;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postScannerFilterRow()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.postScannerFilterRow(c, s, currentRow, offset, length, hasMore);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postScannerFilterRow()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void preWALRestore(ObserverContext<? extends RegionCoprocessorEnvironment> ctx, HRegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preWALRestore()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.preWALRestore(ctx, info, logKey, logEdit);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preWALRestore()");
+ }
+ }
+
+ @Override
+ public void postWALRestore( ObserverContext<? extends RegionCoprocessorEnvironment> ctx, HRegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postWALRestore()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implRegionObserver.postWALRestore(ctx, info, logKey, logEdit);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postWALRestore()");
+ }
+ }
+
+ @Override
+ public boolean postBulkLoadHFile(ObserverContext<RegionCoprocessorEnvironment> ctx, List<Pair<byte[], String>> familyPaths, boolean hasLoaded) throws IOException {
+
+ boolean ret = false;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postBulkLoadHFile()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.postBulkLoadHFile(ctx, familyPaths, hasLoaded);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postBulkLoadHFile()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public Reader preStoreFileReaderOpen(ObserverContext<RegionCoprocessorEnvironment> ctx, FileSystem fs, Path p, FSDataInputStreamWrapper in, long size,
+ CacheConfig cacheConf, Reference r, Reader reader) throws IOException {
+ Reader ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preStoreFileReaderOpen()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.preStoreFileReaderOpen(ctx, fs, p, in, size, cacheConf, r, reader);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preStoreFileReaderOpen()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public Reader postStoreFileReaderOpen(ObserverContext<RegionCoprocessorEnvironment> ctx, FileSystem fs, Path p, FSDataInputStreamWrapper in, long size,
+ CacheConfig cacheConf, Reference r, Reader reader) throws IOException {
+ Reader ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postStoreFileReaderOpen()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.postStoreFileReaderOpen(ctx, fs, p, in, size, cacheConf, r, reader);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postStoreFileReaderOpen()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public Cell postMutationBeforeWAL(ObserverContext<RegionCoprocessorEnvironment> ctx, MutationType opType, Mutation mutation, Cell oldCell, Cell newCell) throws IOException {
+ Cell ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postMutationBeforeWAL()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.postMutationBeforeWAL(ctx, opType, mutation, oldCell, newCell);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postMutationBeforeWAL()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public DeleteTracker postInstantiateDeleteTracker( ObserverContext<RegionCoprocessorEnvironment> ctx, DeleteTracker delTracker) throws IOException {
+ DeleteTracker ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postInstantiateDeleteTracker()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ ret = implRegionObserver.postInstantiateDeleteTracker(ctx, delTracker);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postInstantiateDeleteTracker()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postCreateTable()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.postCreateTable(ctx, desc, regions);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postCreateTable()");
+ }
+ }
+
+ @Override
+ public void preCreateTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preCreateTableHandler()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preCreateTableHandler(ctx, desc, regions);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preCreateTableHandler()");
+ }
+ }
+
+ @Override
+ public void postCreateTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postCreateTableHandler()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.postCreateTableHandler(ctx, desc, regions);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postCreateTableHandler()");
+ }
+ }
+
+ @Override
+ public void postDeleteTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postDeleteTable()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.postDeleteTable(ctx, tableName);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postDeleteTable()");
+ }
+ }
+
+ @Override
+ public void preDeleteTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx,TableName tableName) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preDeleteTableHandler()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preDeleteTableHandler(ctx, tableName);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preDeleteTableHandler()");
+ }
+ }
+
+ @Override
+ public void postDeleteTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postDeleteTableHandler()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.postDeleteTableHandler(ctx, tableName);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postDeleteTableHandler()");
+ }
+ }
+
+ @Override
+ public void preTruncateTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preTruncateTable()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preTruncateTable(ctx, tableName);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preTruncateTable()");
+ }
+ }
+
+ @Override
+ public void postTruncateTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postTruncateTable()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.postTruncateTable(ctx, tableName);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postTruncateTable()");
+ }
+ }
+
+ @Override
+ public void preTruncateTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preTruncateTableHandler()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preTruncateTableHandler(ctx, tableName);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preTruncateTableHandler()");
+ }
+ }
+
+ @Override
+ public void postTruncateTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postTruncateTableHandler()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.postTruncateTableHandler(ctx, tableName);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postTruncateTableHandler()");
+ }
+ }
+
+ @Override
+ public void postModifyTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName, HTableDescriptor htd) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postModifyTable()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.postModifyTable(ctx, tableName, htd);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postModifyTable()");
+ }
+ }
+
+ @Override
+ public void preModifyTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx,TableName tableName, HTableDescriptor htd) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preModifyTableHandler()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preModifyTableHandler(ctx, tableName, htd);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preModifyTableHandler()");
+ }
+ }
+
+ @Override
+ public void postModifyTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName, HTableDescriptor htd) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postModifyTableHandler()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.postModifyTableHandler(ctx, tableName, htd);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postModifyTableHandler()");
+ }
+ }
+
+ @Override
+ public void postAddColumn(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName, HColumnDescriptor column) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postAddColumn()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.postAddColumn(ctx, tableName, column);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postAddColumn()");
+ }
+ }
+
+ @Override
+ public void preAddColumnHandler(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName, HColumnDescriptor column) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preAddColumnHandler()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preAddColumnHandler(ctx, tableName, column);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preAddColumnHandler()");
+ }
+ }
+
+ @Override
+ public void postAddColumnHandler(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName, HColumnDescriptor column) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postAddColumnHandler()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.postAddColumnHandler(ctx, tableName, column);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postAddColumnHandler()");
+ }
+ }
+
+ @Override
+ public void postModifyColumn(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName, HColumnDescriptor descriptor) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postModifyColumn()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.postModifyColumn(ctx, tableName, descriptor);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postModifyColumn()");
+ }
+ }
+
+ @Override
+ public void preModifyColumnHandler(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName, HColumnDescriptor descriptor) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.preModifyColumnHandler()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.preModifyColumnHandler(ctx, tableName, descriptor);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.preModifyColumnHandler()");
+ }
+ }
+
+ @Override
+ public void postModifyColumnHandler(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName, HColumnDescriptor descriptor) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postModifyColumnHandler()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.postModifyColumnHandler(ctx, tableName, descriptor);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerAuthorizationCoprocessor.postModifyColumnHandler()");
+ }
+ }
+
+ @Override
+ public void postDeleteColumn(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName, byte[] c) throws IOException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerAuthorizationCoprocessor.postDeleteColumn()");
+ }
+
+ try {
+ activatePluginClassLoader();
+ implMasterObserver.postDeleteColumn(ctx, tableName, c);
+ } finally {
+ dea
<TRUNCATED>
[2/4] incubator-ranger git commit: RANGER-586:Ranger plugins should
not add dependent libraries to component's CLASSPATH
Posted by rm...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-hbase-plugin-shim/src/main/test/org/apache/hadoop/hbase/security/access/RangerAccessControlListsTest.java
----------------------------------------------------------------------
diff --git a/ranger-hbase-plugin-shim/src/main/test/org/apache/hadoop/hbase/security/access/RangerAccessControlListsTest.java b/ranger-hbase-plugin-shim/src/main/test/org/apache/hadoop/hbase/security/access/RangerAccessControlListsTest.java
new file mode 100644
index 0000000..aa66d08
--- /dev/null
+++ b/ranger-hbase-plugin-shim/src/main/test/org/apache/hadoop/hbase/security/access/RangerAccessControlListsTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.hadoop.hbase.security.access;
+
+import java.io.IOException;
+
+import org.apache.hadoop.hbase.master.MasterServices;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class RangerAccessControlListsTest {
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testInit() {
+ IOException exceptionFound = null ;
+ try {
+ MasterServices service = null ;
+ RangerAccessControlLists.init(service) ;
+ } catch (IOException e) {
+ exceptionFound = e ;
+ }
+ Assert.assertFalse("Expected to get a NullPointerExecution after init method Execution - Found [" + exceptionFound + "]", (!(exceptionFound != null && exceptionFound.getCause() instanceof NullPointerException))) ;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-hdfs-plugin-shim/pom.xml
----------------------------------------------------------------------
diff --git a/ranger-hdfs-plugin-shim/pom.xml b/ranger-hdfs-plugin-shim/pom.xml
new file mode 100644
index 0000000..a44abb3
--- /dev/null
+++ b/ranger-hdfs-plugin-shim/pom.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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>security_plugins.ranger-hdfs-plugin-shim</groupId>
+ <artifactId>ranger-hdfs-plugin-shim</artifactId>
+ <name>Hdfs Security Plugin Shim</name>
+ <description>Hdfs Security Plugins Shim</description>
+ <packaging>jar</packaging>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <parent>
+ <groupId>org.apache.ranger</groupId>
+ <artifactId>ranger</artifactId>
+ <version>0.5.0</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${commons.logging.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-common</artifactId>
+ <version>${hadoop.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-hdfs</artifactId>
+ <version>${hadoop.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugins-audit</groupId>
+ <artifactId>ranger-plugins-audit</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugins-common</groupId>
+ <artifactId>ranger-plugins-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugin-classloader</groupId>
+ <artifactId>ranger-plugin-classloader</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-hdfs-plugin-shim/src/main/java/org/apache/ranger/authorization/hadoop/RangerHdfsAuthorizer.java
----------------------------------------------------------------------
diff --git a/ranger-hdfs-plugin-shim/src/main/java/org/apache/ranger/authorization/hadoop/RangerHdfsAuthorizer.java b/ranger-hdfs-plugin-shim/src/main/java/org/apache/ranger/authorization/hadoop/RangerHdfsAuthorizer.java
new file mode 100644
index 0000000..a19d072
--- /dev/null
+++ b/ranger-hdfs-plugin-shim/src/main/java/org/apache/ranger/authorization/hadoop/RangerHdfsAuthorizer.java
@@ -0,0 +1,191 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.authorization.hadoop;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hdfs.server.namenode.INodeAttributeProvider;
+import org.apache.hadoop.hdfs.server.namenode.INodeAttributes;
+import org.apache.ranger.plugin.classloader.RangerPluginClassLoader;
+
+public class RangerHdfsAuthorizer extends INodeAttributeProvider {
+ private static final Log LOG = LogFactory.getLog(RangerHdfsAuthorizer.class);
+
+ private static final String RANGER_PLUGIN_TYPE = "hdfs";
+ private static final String[] RANGER_PLUGIN_LIB_DIR = new String[] {"lib/ranger-hdfs-plugin"};
+ private static final String RANGER_HDFS_AUTHORIZER_IMPL_CLASSNAME = "org.apache.ranger.authorization.hadoop.RangerHdfsAuthorizer";
+
+ private INodeAttributeProvider rangerHdfsAuthorizerImpl = null;
+ private static RangerPluginClassLoader rangerPluginClassLoader = null;
+
+ public RangerHdfsAuthorizer() {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerHdfsAuthorizer.RangerHdfsAuthorizer()");
+ }
+
+ this.init();
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerHdfsAuthorizer.RangerHdfsAuthorizer()");
+ }
+ }
+
+ public void init(){
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerHdfsAuthorizer.init()");
+ }
+
+ try {
+
+ rangerPluginClassLoader = RangerPluginClassLoader.getInstance(RANGER_PLUGIN_TYPE, this.getClass());
+
+ @SuppressWarnings("unchecked")
+ Class<INodeAttributeProvider> cls = (Class<INodeAttributeProvider>) Class.forName(RANGER_HDFS_AUTHORIZER_IMPL_CLASSNAME, true, rangerPluginClassLoader);
+
+ activatePluginClassLoader();
+
+ rangerHdfsAuthorizerImpl = cls.newInstance();
+ } catch (Exception e) {
+ // check what need to be done
+ LOG.error("Error Enabling RangerHdfsPluing", e);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerHdfsAuthorizer.init()");
+ }
+ }
+
+ @Override
+ public void start() {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerHdfsAuthorizer.start()");
+ }
+
+ try {
+ activatePluginClassLoader();
+
+ rangerHdfsAuthorizerImpl.start();
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerHdfsAuthorizer.start()");
+ }
+ }
+
+ @Override
+ public void stop() {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerHdfsAuthorizer.stop()");
+ }
+
+ try {
+ activatePluginClassLoader();
+
+ rangerHdfsAuthorizerImpl.stop();
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerHdfsAuthorizer.stop()");
+ }
+ }
+
+ @Override
+ public INodeAttributes getAttributes(String fullPath, INodeAttributes inode) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerHdfsAuthorizer.getAttributes(" + fullPath + ")");
+ }
+
+ INodeAttributes ret = null;
+
+ try {
+ activatePluginClassLoader();
+
+ ret = rangerHdfsAuthorizerImpl.getAttributes(fullPath,inode); // return default attributes
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerHdfsAuthorizer.getAttributes(" + fullPath + "): " + ret);
+ }
+
+ return ret;
+ }
+
+ @Override
+ public INodeAttributes getAttributes(String[] pathElements, INodeAttributes inode) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerHdfsAuthorizer.getAttributes(pathElementsCount=" + (pathElements == null ? 0 : pathElements.length) + ")");
+ }
+
+ INodeAttributes ret = null;
+
+ try {
+ activatePluginClassLoader();
+
+ ret = rangerHdfsAuthorizerImpl.getAttributes(pathElements,inode);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerHdfsAuthorizer.getAttributes(pathElementsCount=" + (pathElements == null ? 0 : pathElements.length) + "): " + ret);
+ }
+
+ return ret;
+ }
+
+ @Override
+ public AccessControlEnforcer getExternalAccessControlEnforcer(AccessControlEnforcer defaultEnforcer) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerHdfsAuthorizer.getExternalAccessControlEnforcer()");
+ }
+
+ AccessControlEnforcer ret = null;
+
+ ret = rangerHdfsAuthorizerImpl.getExternalAccessControlEnforcer(defaultEnforcer);
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerHdfsAuthorizer.getExternalAccessControlEnforcer()");
+ }
+
+ return ret;
+ }
+
+ private void activatePluginClassLoader() {
+ if(rangerPluginClassLoader != null) {
+ rangerPluginClassLoader.activate();
+ }
+ }
+
+ private void deactivatePluginClassLoader() {
+ if(rangerPluginClassLoader != null) {
+ rangerPluginClassLoader.deactivate();
+ }
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-hive-plugin-shim/pom.xml
----------------------------------------------------------------------
diff --git a/ranger-hive-plugin-shim/pom.xml b/ranger-hive-plugin-shim/pom.xml
new file mode 100644
index 0000000..1ff8349
--- /dev/null
+++ b/ranger-hive-plugin-shim/pom.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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>security_plugins.ranger-hive-plugin-shim</groupId>
+ <artifactId>ranger-hive-plugin-shim</artifactId>
+ <name>Hive Security Plugin Shim</name>
+ <description>Hive Security Plugins Shim</description>
+ <packaging>jar</packaging>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <parent>
+ <groupId>org.apache.ranger</groupId>
+ <artifactId>ranger</artifactId>
+ <version>0.5.0</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${commons.logging.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-common</artifactId>
+ <version>${hadoop.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-hdfs</artifactId>
+ <version>${hadoop.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-common</artifactId>
+ <version>${hive.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-service</artifactId>
+ <version>${hive.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-exec</artifactId>
+ <version>${hive.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-metastore</artifactId>
+ <version>${hive.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-jdbc</artifactId>
+ <version>${hive.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-jdbc</artifactId>
+ <version>${hive.version}</version>
+ <classifier>standalone</classifier>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugins-audit</groupId>
+ <artifactId>ranger-plugins-audit</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugins-common</groupId>
+ <artifactId>ranger-plugins-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugin-classloader</groupId>
+ <artifactId>ranger-plugin-classloader</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-hive-plugin-shim/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizerFactory.java
----------------------------------------------------------------------
diff --git a/ranger-hive-plugin-shim/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizerFactory.java b/ranger-hive-plugin-shim/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizerFactory.java
new file mode 100644
index 0000000..592b667
--- /dev/null
+++ b/ranger-hive-plugin-shim/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizerFactory.java
@@ -0,0 +1,32 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.xasecure.authorization.hive.authorizer;
+
+import org.apache.ranger.authorization.hive.authorizer.RangerHiveAuthorizerFactory;
+
+/**
+ * This class exists only to provide for seamless upgrade/downgrade capabilities. Coprocessor name is in hbase config files in /etc/.../conf which
+ * is not only out of bounds for any upgrade script but also must be of a form to allow for downgrad! Thus when class names were changed XaSecure* -> Ranger*
+ * this shell class serves to allow for seamles upgrade as well as downgrade.
+ *
+ * This class is final because if one needs to customize coprocessor it is expected that RangerAuthorizationCoprocessor would be modified/extended as that is
+ * the "real" coprocessor! This class, hence, should NEVER be more than an EMPTY shell!
+ */
+public final class XaSecureHiveAuthorizerFactory extends RangerHiveAuthorizerFactory {
+}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-hive-plugin-shim/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizerFactory.java
----------------------------------------------------------------------
diff --git a/ranger-hive-plugin-shim/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizerFactory.java b/ranger-hive-plugin-shim/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizerFactory.java
new file mode 100644
index 0000000..02d6db3
--- /dev/null
+++ b/ranger-hive-plugin-shim/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizerFactory.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.authorization.hive.authorizer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.ql.security.HiveAuthenticationProvider;
+import org.apache.hadoop.hive.ql.security.authorization.plugin.HiveAuthorizer;
+import org.apache.hadoop.hive.ql.security.authorization.plugin.HiveAuthorizerFactory;
+import org.apache.hadoop.hive.ql.security.authorization.plugin.HiveAuthzPluginException;
+import org.apache.hadoop.hive.ql.security.authorization.plugin.HiveMetastoreClientFactory;
+import org.apache.hadoop.hive.ql.security.authorization.plugin.HiveAuthzSessionContext;
+import org.apache.ranger.plugin.classloader.RangerPluginClassLoader;
+
+
+public class RangerHiveAuthorizerFactory implements HiveAuthorizerFactory {
+
+ private static final Log LOG = LogFactory.getLog(RangerHiveAuthorizerFactory.class);
+
+ private static final String RANGER_PLUGIN_TYPE = "hive";
+ private static final String[] RANGER_PLUGIN_LIB_DIR = new String[] {"lib/ranger-hive-plugin"};
+ private static final String RANGER_HIVE_AUTHORIZER_IMPL_CLASSNAME = "org.apache.ranger.authorization.hive.authorizer.RangerHiveAuthorizerFactory";
+
+ private HiveAuthorizerFactory rangerHiveAuthorizerFactoryImpl = null;
+ private RangerPluginClassLoader rangerPluginClassLoader = null;
+
+
+ public RangerHiveAuthorizerFactory() {
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerHiveAuthorizerFactory.RangerHiveAuthorizerFactory()");
+ }
+
+ this.init();
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerHiveAuthorizerFactory.RangerHiveAuthorizerFactory()");
+ }
+ }
+
+ public void init(){
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerHiveAuthorizerFactory.init()");
+ }
+
+ try {
+
+ rangerPluginClassLoader = RangerPluginClassLoader.getInstance(RANGER_PLUGIN_TYPE, this.getClass());
+
+ @SuppressWarnings("unchecked")
+ Class<HiveAuthorizerFactory> cls = (Class<HiveAuthorizerFactory>) Class.forName(RANGER_HIVE_AUTHORIZER_IMPL_CLASSNAME, true, rangerPluginClassLoader);
+
+ activatePluginClassLoader();
+
+ rangerHiveAuthorizerFactoryImpl = cls.newInstance();
+
+ } catch (Exception e) {
+ // check what need to be done
+ LOG.error("Error Enabling RangerHivePluing", e);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerHiveAuthorizerFactory.init()");
+ }
+ }
+
+ @Override
+ public HiveAuthorizer createHiveAuthorizer(HiveMetastoreClientFactory metastoreClientFactory,
+ HiveConf conf,
+ HiveAuthenticationProvider hiveAuthenticator,
+ HiveAuthzSessionContext sessionContext)
+ throws HiveAuthzPluginException {
+
+ HiveAuthorizer ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerHiveAuthorizerFactory.createHiveAuthorizer()");
+ }
+
+ ret = rangerHiveAuthorizerFactoryImpl.createHiveAuthorizer(metastoreClientFactory, conf, hiveAuthenticator, sessionContext);
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerHiveAuthorizerFactory.createHiveAuthorizer()");
+ }
+
+ return ret;
+ }
+
+ private void activatePluginClassLoader() {
+ if(rangerPluginClassLoader != null) {
+ rangerPluginClassLoader.activate();
+ }
+ }
+
+ private void deactivatePluginClassLoader() {
+ if(rangerPluginClassLoader != null) {
+ rangerPluginClassLoader.deactivate();
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-kafka-plugin-shim/pom.xml
----------------------------------------------------------------------
diff --git a/ranger-kafka-plugin-shim/pom.xml b/ranger-kafka-plugin-shim/pom.xml
new file mode 100644
index 0000000..2d29868
--- /dev/null
+++ b/ranger-kafka-plugin-shim/pom.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to
+ You under the Apache License, Version 2.0 (the "License"); you may not use
+ this file except in compliance with the License. You may obtain a copy of
+ the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
+ by applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ OF ANY KIND, either express or implied. See the License for the specific
+ language governing permissions and limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ 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>security_plugins.ranger-kafka-plugin-shim</groupId>
+ <artifactId>ranger-kafka-plugin-shim</artifactId>
+ <name>KAFKA Security Plugin Shim</name>
+ <description>KAFKA Security Plugin shim</description>
+ <packaging>jar</packaging>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <parent>
+ <groupId>org.apache.ranger</groupId>
+ <artifactId>ranger</artifactId>
+ <version>0.5.0</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>security_plugins.ranger-plugins-common</groupId>
+ <artifactId>ranger-plugins-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugins-audit</groupId>
+ <artifactId>ranger-plugins-audit</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugin-classloader</groupId>
+ <artifactId>ranger-plugin-classloader</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ranger</groupId>
+ <artifactId>credentialbuilder</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.kafka</groupId>
+ <artifactId>kafka_2.10</artifactId>
+ <version>${kafka.version}</version>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-kafka-plugin-shim/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
----------------------------------------------------------------------
diff --git a/ranger-kafka-plugin-shim/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java b/ranger-kafka-plugin-shim/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
new file mode 100644
index 0000000..d39cac2
--- /dev/null
+++ b/ranger-kafka-plugin-shim/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
@@ -0,0 +1,248 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.authorization.kafka.authorizer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ranger.plugin.classloader.RangerPluginClassLoader;
+
+import scala.collection.immutable.Set;
+import kafka.network.RequestChannel.Session;
+import kafka.security.auth.Acl;
+import kafka.security.auth.Authorizer;
+import kafka.security.auth.KafkaPrincipal;
+import kafka.security.auth.Operation;
+import kafka.security.auth.Resource;
+import kafka.server.KafkaConfig;
+
+
+//public class RangerKafkaAuthorizer extends Authorizer {
+public class RangerKafkaAuthorizer implements Authorizer {
+ private static final Log LOG = LogFactory.getLog(RangerKafkaAuthorizer.class);
+
+ private static final String RANGER_PLUGIN_TYPE = "kafka";
+ private static final String[] RANGER_PLUGIN_LIB_DIR = new String[] {"lib/ranger-kafka-plugin"};
+ private static final String RANGER_KAFKA_AUTHORIZER_IMPL_CLASSNAME = "org.apache.ranger.authorization.kafka.authorizer.RangerKafkaAuthorizer";
+
+ private Authorizer rangerKakfaAuthorizerImpl = null;
+ private static RangerPluginClassLoader rangerPluginClassLoader = null;
+
+ public RangerKafkaAuthorizer() {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerKafkaAuthorizer.RangerKafkaAuthorizer()");
+ }
+
+ this.init();
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerKafkaAuthorizer.RangerKafkaAuthorizer()");
+ }
+ }
+
+ private void init(){
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerKafkaAuthorizer.init()");
+ }
+
+ try {
+
+ rangerPluginClassLoader = RangerPluginClassLoader.getInstance(RANGER_PLUGIN_TYPE, this.getClass());
+
+ @SuppressWarnings("unchecked")
+ Class<Authorizer> cls = (Class<Authorizer>) Class.forName(RANGER_KAFKA_AUTHORIZER_IMPL_CLASSNAME, true, rangerPluginClassLoader);
+
+ activatePluginClassLoader();
+
+ rangerKakfaAuthorizerImpl = cls.newInstance();
+ } catch (Exception e) {
+ // check what need to be done
+ LOG.error("Error Enabling RangerKafkaPluing", e);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerKafkaAuthorizer.init()");
+ }
+ }
+
+
+ @Override
+ public void initialize(KafkaConfig kafkaConfig) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerKafkaAuthorizer.initialize()");
+ }
+
+ try {
+ activatePluginClassLoader();
+
+ rangerKakfaAuthorizerImpl.initialize(kafkaConfig);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerKafkaAuthorizer.initialize()");
+ }
+ }
+
+ @Override
+ public boolean authorize(Session session, Operation operation,Resource resource) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerKafkaAuthorizer.authorize()");
+ }
+
+ boolean ret = false;
+
+ try {
+ activatePluginClassLoader();
+
+ ret = rangerKakfaAuthorizerImpl.authorize(session, operation, resource);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerKafkaAuthorizer.authorize()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void addAcls(Set<Acl> acls, Resource resource) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerKafkaAuthorizer.addAcls()");
+ }
+
+ try {
+ activatePluginClassLoader();
+
+ rangerKakfaAuthorizerImpl.addAcls(acls, resource);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerKafkaAuthorizer.addAcls()");
+ }
+ }
+
+ @Override
+ public boolean removeAcls(Set<Acl> acls, Resource resource) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerKafkaAuthorizer.removeAcls()");
+ }
+ boolean ret = false;
+ try {
+ activatePluginClassLoader();
+
+ ret = rangerKakfaAuthorizerImpl.removeAcls(acls, resource);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerKafkaAuthorizer.removeAcls()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public boolean removeAcls(Resource resource) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerKafkaAuthorizer.removeAcls()");
+ }
+ boolean ret = false;
+ try {
+ activatePluginClassLoader();
+
+ ret = rangerKakfaAuthorizerImpl.removeAcls(resource);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerKafkaAuthorizer.removeAcls()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public Set<Acl> getAcls(Resource resource) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerKafkaAuthorizer.getAcls()");
+ }
+
+ Set<Acl> ret = null;
+
+ try {
+ activatePluginClassLoader();
+
+ ret = rangerKakfaAuthorizerImpl.getAcls(resource);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerKafkaAuthorizer.getAcls()");
+ }
+
+ return ret;
+ }
+
+ @Override
+ public Set<Acl> getAcls(KafkaPrincipal principal) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerKafkaAuthorizer.getAcls()");
+ }
+
+ Set<Acl> ret = null;
+
+ try {
+ activatePluginClassLoader();
+
+ ret = rangerKakfaAuthorizerImpl.getAcls(principal);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerKafkaAuthorizer.getAcls()");
+ }
+
+ return ret;
+ }
+
+ private void activatePluginClassLoader() {
+ if(rangerPluginClassLoader != null) {
+ rangerPluginClassLoader.activate();
+ }
+ }
+
+ private void deactivatePluginClassLoader() {
+ if(rangerPluginClassLoader != null) {
+ rangerPluginClassLoader.deactivate();
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-knox-plugin-shim/pom.xml
----------------------------------------------------------------------
diff --git a/ranger-knox-plugin-shim/pom.xml b/ranger-knox-plugin-shim/pom.xml
new file mode 100644
index 0000000..eef7913
--- /dev/null
+++ b/ranger-knox-plugin-shim/pom.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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>security_plugins.ranger-knox-plugin-shim</groupId>
+ <artifactId>ranger-knox-plugin-shim</artifactId>
+ <name>Knox Security Plugin Shim</name>
+ <description>Knox Security Plugins Shim</description>
+ <packaging>jar</packaging>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <parent>
+ <groupId>org.apache.ranger</groupId>
+ <artifactId>ranger</artifactId>
+ <version>0.5.0</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.knox</groupId>
+ <artifactId>gateway-spi</artifactId>
+ <version>0.5.0</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>${javax.servlet.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-integration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>${codehaus.jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-core-asl</artifactId>
+ <version>${codehaus.jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugins-common</groupId>
+ <artifactId>ranger-plugins-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugin-classloader</groupId>
+ <artifactId>ranger-plugin-classloader</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugins-audit</groupId>
+ <artifactId>ranger-plugins-audit</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-knox-plugin-shim/src/main/java/com/xasecure/pdp/knox/filter/XASecurePDPKnoxFilter.java
----------------------------------------------------------------------
diff --git a/ranger-knox-plugin-shim/src/main/java/com/xasecure/pdp/knox/filter/XASecurePDPKnoxFilter.java b/ranger-knox-plugin-shim/src/main/java/com/xasecure/pdp/knox/filter/XASecurePDPKnoxFilter.java
new file mode 100644
index 0000000..6b9d6fd
--- /dev/null
+++ b/ranger-knox-plugin-shim/src/main/java/com/xasecure/pdp/knox/filter/XASecurePDPKnoxFilter.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.xasecure.pdp.knox.filter;
+
+import org.apache.ranger.authorization.knox.RangerPDPKnoxFilter;
+
+public class XASecurePDPKnoxFilter extends RangerPDPKnoxFilter {
+}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-knox-plugin-shim/src/main/java/org/apache/ranger/authorization/knox/RangerPDPKnoxFilter.java
----------------------------------------------------------------------
diff --git a/ranger-knox-plugin-shim/src/main/java/org/apache/ranger/authorization/knox/RangerPDPKnoxFilter.java b/ranger-knox-plugin-shim/src/main/java/org/apache/ranger/authorization/knox/RangerPDPKnoxFilter.java
new file mode 100644
index 0000000..af4d947
--- /dev/null
+++ b/ranger-knox-plugin-shim/src/main/java/org/apache/ranger/authorization/knox/RangerPDPKnoxFilter.java
@@ -0,0 +1,153 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ranger.authorization.knox;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ranger.plugin.classloader.RangerPluginClassLoader;
+
+public class RangerPDPKnoxFilter implements Filter {
+
+ private static final Log LOG = LogFactory.getLog(RangerPDPKnoxFilter.class);
+
+ private static final String RANGER_PLUGIN_TYPE = "knox";
+ private static final String[] RANGER_PLUGIN_LIB_DIR = new String[] {"lib/ranger-hdfs-plugin"};
+ private static final String RANGER_PDP_KNOX_FILTER_IMPL_CLASSNAME = "org.apache.ranger.authorization.knox.RangerPDPKnoxFilter";
+
+ private RangerPDPKnoxFilter rangerPDPKnoxFilteImpl = null;
+ private static RangerPluginClassLoader rangerPluginClassLoader = null;
+
+ public RangerPDPKnoxFilter() {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerPDPKnoxFilter.RangerPDPKnoxFilter()");
+ }
+
+ this.init0();
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerPDPKnoxFilter.RangerPDPKnoxFilter()");
+ }
+ }
+
+ private void init0(){
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerPDPKnoxFilter.init()");
+ }
+
+ try {
+ rangerPluginClassLoader = RangerPluginClassLoader.getInstance(RANGER_PLUGIN_TYPE, this.getClass());
+
+ @SuppressWarnings("unchecked")
+ Class<Filter> cls = (Class<Filter>) Class.forName(RANGER_PDP_KNOX_FILTER_IMPL_CLASSNAME, true, rangerPluginClassLoader);
+
+ activatePluginClassLoader();
+
+ rangerPDPKnoxFilteImpl = (RangerPDPKnoxFilter) cls.newInstance();
+ } catch (Exception e) {
+ // check what need to be done
+ LOG.error("Error Enabling RangerKnoxPlugin", e);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerPDPKnoxFilter.init()");
+ }
+ }
+
+ @Override
+ public void destroy() {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerPDPKnoxFilter.destroy()");
+ }
+
+ try {
+ activatePluginClassLoader();
+
+ rangerPDPKnoxFilteImpl.destroy();
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerPDPKnoxFilter.destroy()");
+ }
+ }
+
+ @Override
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerPDPKnoxFilter.doFilter()");
+ }
+
+ try {
+ activatePluginClassLoader();
+
+ rangerPDPKnoxFilteImpl.doFilter(servletRequest, servletResponse, filterChain);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerPDPKnoxFilter.doFilter()");
+ }
+ }
+
+ @Override
+ public void init(FilterConfig fiterConfig) throws ServletException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerPDPKnoxFilter.init()");
+ }
+
+ try {
+ activatePluginClassLoader();
+
+ rangerPDPKnoxFilteImpl.init(fiterConfig);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerPDPKnoxFilter.init()");
+ }
+ }
+
+
+ private void activatePluginClassLoader() {
+ if(rangerPluginClassLoader != null) {
+ rangerPluginClassLoader.activate();
+ }
+ }
+
+ private void deactivatePluginClassLoader() {
+ if(rangerPluginClassLoader != null) {
+ rangerPluginClassLoader.deactivate();
+ }
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-plugin-classloader/pom.xml
----------------------------------------------------------------------
diff --git a/ranger-plugin-classloader/pom.xml b/ranger-plugin-classloader/pom.xml
new file mode 100644
index 0000000..d8504e6
--- /dev/null
+++ b/ranger-plugin-classloader/pom.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>security_plugins.ranger-plugin-classloader</groupId>
+ <artifactId>ranger-plugin-classloader</artifactId>
+ <version>0.5.0</version>
+ <name>ranger-plugin-classloader</name>
+ <description>Ranger Plugin ClassLoader</description>
+ <packaging>jar</packaging>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <parent>
+ <groupId>org.apache.ranger</groupId>
+ <artifactId>ranger</artifactId>
+ <version>0.5.0</version>
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${commons.logging.version}</version>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j-api.version}</version>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-plugin-classloader/src/main/java/org/apache/ranger/plugin/classloader/RangerPluginClassLoader.java
----------------------------------------------------------------------
diff --git a/ranger-plugin-classloader/src/main/java/org/apache/ranger/plugin/classloader/RangerPluginClassLoader.java b/ranger-plugin-classloader/src/main/java/org/apache/ranger/plugin/classloader/RangerPluginClassLoader.java
new file mode 100644
index 0000000..eafcd27
--- /dev/null
+++ b/ranger-plugin-classloader/src/main/java/org/apache/ranger/plugin/classloader/RangerPluginClassLoader.java
@@ -0,0 +1,292 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.plugin.classloader;
+
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Enumeration;
+
+//import org.apache.commons.logging.Log;
+//import org.apache.commons.logging.LogFactory;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RangerPluginClassLoader extends URLClassLoader {
+ private static Logger LOG = LoggerFactory.getLogger(RangerPluginClassLoader.class);
+
+ private static volatile RangerPluginClassLoader me = null;
+ private static MyClassLoader componentClassLoader = null;
+ //private static ThreadLocal<MyClassLoader> componentClassLoader = new ThreadLocal<MyClassLoader>();
+
+ public RangerPluginClassLoader(String pluginType, Class<?> pluginClass ) throws Exception {
+ super(RangerPluginClassLoaderUtil.getInstance().getPluginFilesForServiceTypeAndPluginclass(pluginType, pluginClass), null);
+ //componentClassLoader.set(new MyClassLoader(Thread.currentThread().getContextClassLoader()));
+ componentClassLoader = new MyClassLoader(Thread.currentThread().getContextClassLoader());
+ }
+
+ public static RangerPluginClassLoader getInstance(String pluginType, Class<?> pluginClass ) throws Exception {
+ RangerPluginClassLoader ret = me;
+ if ( ret == null) {
+ synchronized(RangerPluginClassLoader.class) {
+ ret = me;
+ if ( ret == null){
+ me = ret = new RangerPluginClassLoader(pluginType,pluginClass);
+ }
+ }
+ }
+ return ret;
+ }
+
+ @Override
+ public Class<?> findClass(String name) throws ClassNotFoundException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerPluginClassLoader.findClass(" + name + ")");
+ }
+
+ Class<?> ret = null;
+
+ try {
+ // first we try to find a class inside the child classloader
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("RangerPluginClassLoader.findClass(" + name + "): calling childClassLoader().findClass() ");
+ }
+
+ ret = super.findClass(name);
+ } catch( Throwable e ) {
+ // Use the Component ClassLoader findclass to load when childClassLoader fails to find
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("RangerPluginClassLoader.findClass(" + name + "): calling componentClassLoader.findClass()");
+ }
+
+ MyClassLoader savedClassLoader = getComponentClassLoader();
+ if (savedClassLoader != null) {
+ ret = savedClassLoader.findClass(name);
+ }
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerPluginClassLoader.findClass(" + name + "): " + ret);
+ }
+ return ret;
+ }
+
+ @Override
+ public synchronized Class<?> loadClass(String name) throws ClassNotFoundException {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerPluginClassLoader.loadClass(" + name + ")" );
+ }
+
+ Class<?> ret = null;
+
+ try {
+ // first we try to load a class inside the child classloader
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("RangerPluginClassLoader.loadClass(" + name + "): calling childClassLoader.findClass()");
+ }
+ ret = super.loadClass(name);
+ } catch(Throwable e) {
+ // Use the Component ClassLoader loadClass to load when childClassLoader fails to find
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("RangerPluginClassLoader.loadClass(" + name + "): calling componentClassLoader.loadClass()");
+ }
+
+ MyClassLoader savedClassLoader = getComponentClassLoader();
+
+ if(savedClassLoader != null) {
+ ret = savedClassLoader.loadClass(name);
+ }
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerPluginClassLoader.loadClass" + name + "): " + ret);
+ }
+
+ return ret;
+ }
+
+ @Override
+ public URL findResource(String name) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerPluginClassLoader.findResource(" + name + ") ");
+ }
+
+ URL ret = super.findResource(name);
+
+ if (ret == null) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("RangerPluginClassLoader.findResource(" + name + "): calling componentClassLoader.getResources()");
+ }
+
+ MyClassLoader savedClassLoader = getComponentClassLoader();
+ if (savedClassLoader != null) {
+ ret = savedClassLoader.getResource(name);
+ }
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerPluginClassLoader.findResource(" + name + "): " + ret);
+ }
+
+ return ret;
+ }
+
+ @Override
+ public Enumeration<URL> findResources(String name) throws IOException {
+ Enumeration<URL> ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerPluginClassLoader.findResources(" + name + ") ");
+ }
+
+ ret = new MergeEnumeration(findResourcesUsingChildClassLoader(name),findResourcesUsingComponentClassLoader(name));
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerPluginClassLoader.findResources(" + name + ") ");
+ }
+
+ return ret;
+ }
+
+ public Enumeration<URL> findResourcesUsingChildClassLoader(String name) {
+
+ Enumeration<URL> ret = null;
+
+ try {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("RangerPluginClassLoader.findResourcesUsingChildClassLoader(" + name + "): calling childClassLoader.findResources()");
+ }
+
+ ret = super.findResources(name);
+
+ } catch ( Throwable t) {
+ //Ignore any exceptions. Null / Empty return is handle in following statements
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("RangerPluginClassLoader.findResourcesUsingChildClassLoader(" + name + "): class not found in child. Falling back to componentClassLoader", t);
+ }
+ }
+ return ret;
+ }
+
+ public Enumeration<URL> findResourcesUsingComponentClassLoader(String name) {
+
+ Enumeration<URL> ret = null;
+
+ try {
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("RangerPluginClassLoader.findResourcesUsingComponentClassLoader(" + name + "): calling componentClassLoader.getResources()");
+ }
+
+ MyClassLoader savedClassLoader = getComponentClassLoader();
+
+ if (savedClassLoader != null) {
+ ret = savedClassLoader.getResources(name);
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerPluginClassLoader.findResourcesUsingComponentClassLoader(" + name + "): " + ret);
+ }
+ } catch( Throwable t) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("RangerPluginClassLoader.findResourcesUsingComponentClassLoader(" + name + "): class not found in componentClassLoader.", t);
+ }
+ }
+
+ return ret;
+ }
+
+ public void activate() {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerPluginClassLoader.activate()");
+ }
+
+ //componentClassLoader.set(new MyClassLoader(Thread.currentThread().getContextClassLoader()));
+
+ Thread.currentThread().setContextClassLoader(this);
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerPluginClassLoader.activate()");
+ }
+ }
+
+ public void deactivate() {
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerPluginClassLoader.deactivate()");
+ }
+
+ MyClassLoader savedClassLoader = getComponentClassLoader();
+
+ if(savedClassLoader != null && savedClassLoader.getParent() != null) {
+ Thread.currentThread().setContextClassLoader(savedClassLoader.getParent());
+ } else {
+ LOG.warn("RangerPluginClassLoader.deactivate() was not successful.Couldn't not get the saved componentClassLoader...");
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerPluginClassLoader.deactivate()");
+ }
+ }
+
+ private MyClassLoader getComponentClassLoader() {
+ return componentClassLoader;
+ //return componentClassLoader.get();
+ }
+
+ static class MyClassLoader extends ClassLoader {
+ public MyClassLoader(ClassLoader realClassLoader) {
+ super(realClassLoader);
+ }
+
+ @Override
+ public Class<?> findClass(String name) throws ClassNotFoundException {
+ return super.findClass(name);
+ }
+ }
+
+ class MergeEnumeration implements Enumeration<URL> {
+
+ Enumeration<URL> e1 = null;
+ Enumeration<URL> e2 = null;
+
+ public MergeEnumeration(Enumeration<URL> e1, Enumeration<URL> e2 ) {
+ this.e1 = e1;
+ this.e2 = e2;
+ }
+
+ @Override
+ public boolean hasMoreElements() {
+ return ( (e1 != null && e1.hasMoreElements() ) || ( e2 != null && e2.hasMoreElements()) );
+ }
+
+ @Override
+ public URL nextElement() {
+ URL ret = null;
+ if (e1 != null && e1.hasMoreElements())
+ ret = e1.nextElement();
+ else if ( e2 != null && e2.hasMoreElements() ) {
+ ret = e2.nextElement();
+ }
+ return ret;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-plugin-classloader/src/main/java/org/apache/ranger/plugin/classloader/RangerPluginClassLoaderUtil.java
----------------------------------------------------------------------
diff --git a/ranger-plugin-classloader/src/main/java/org/apache/ranger/plugin/classloader/RangerPluginClassLoaderUtil.java b/ranger-plugin-classloader/src/main/java/org/apache/ranger/plugin/classloader/RangerPluginClassLoaderUtil.java
new file mode 100644
index 0000000..ea18883
--- /dev/null
+++ b/ranger-plugin-classloader/src/main/java/org/apache/ranger/plugin/classloader/RangerPluginClassLoaderUtil.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.plugin.classloader;
+
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+
+//import org.apache.commons.logging.Log;
+//import org.apache.commons.logging.LogFactory;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RangerPluginClassLoaderUtil {
+
+ private static final Logger LOG = LoggerFactory.getLogger(RangerPluginClassLoaderUtil.class) ;
+
+ private static RangerPluginClassLoaderUtil config = null;
+ private static String rangerPluginLibDir = "ranger-%-plugin-impl";
+
+ public static RangerPluginClassLoaderUtil getInstance() {
+ RangerPluginClassLoaderUtil result = config;
+ if (result == null) {
+ synchronized (RangerPluginClassLoaderUtil.class) {
+ result = config;
+ if (result == null) {
+ config = result = new RangerPluginClassLoaderUtil();
+ }
+ }
+ }
+ return result;
+ }
+
+
+ public URL[] getPluginFilesForServiceTypeAndPluginclass( String serviceType, Class<?> pluginClass) throws Exception {
+
+ URL[] ret = null;
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerPluginClassLoaderUtil.getPluginFilesForServiceTypeAndPluginclass(" + serviceType + ")" + " Pluging Class :" + pluginClass.getName());
+ }
+
+ String[] libDirs = new String[] { getPluginImplLibPath(serviceType, pluginClass) };
+
+ ret = getPluginFiles(libDirs);
+
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerPluginClassLoaderUtil.getPluginFilesForServiceTypeAndPluginclass(" + serviceType + ")" + " Pluging Class :" + pluginClass.getName());
+ }
+
+ return ret;
+
+ }
+
+ private URL[] getPluginFiles(String[] libDirs) throws Exception {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerPluginClassLoaderUtil.getPluginFiles()");
+ }
+
+ List<URL> ret = new ArrayList<URL>();
+ for ( String libDir : libDirs) {
+ getFilesInDirectory(libDir,ret);
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerPluginClassLoaderUtil.getPluginFilesForServiceType(): " + ret.size() + " files");
+ }
+
+ return ret.toArray(new URL[] { });
+ }
+
+ private void getFilesInDirectory(String dirPath, List<URL> files) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerPluginClassLoaderUtil.getPluginFiles()");
+ }
+
+ if ( dirPath != null) {
+ try {
+
+ File[] dirFiles = new File(dirPath).listFiles();
+
+ if(dirFiles != null) {
+ for(File dirFile : dirFiles) {
+ try {
+ URL jarPath = dirFile.toURI().toURL();
+
+ LOG.info("getFilesInDirectory('" + dirPath + "'): adding " + dirFile.getAbsolutePath());
+
+ files.add(jarPath);
+ } catch(Exception excp) {
+ LOG.warn("getFilesInDirectory('" + dirPath + "'): failed to get URI for file " + dirFile.getAbsolutePath(), excp);
+ }
+ }
+ }
+ } catch(Exception excp) {
+ LOG.warn("getFilesInDirectory('" + dirPath + "'): error", excp);
+ }
+ } else {
+ LOG.warn("getFilesInDirectory('" + dirPath + "'): could not find directory in path " + dirPath);
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerPluginClassLoaderUtil.getFilesInDirectory(" + dirPath + ")");
+ }
+ }
+
+ private String getPluginImplLibPath(String serviceType, Class<?> pluginClass) throws Exception {
+
+ String ret = null;
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerPluginClassLoaderUtil.getPluginImplLibPath for Class (" + pluginClass.getName() + ")");
+ }
+
+ URI uri = pluginClass.getProtectionDomain().getCodeSource().getLocation().toURI();
+
+ Path path = Paths.get(URI.create(uri.toString()));
+
+ ret = path.getParent().toString() + File.separatorChar + rangerPluginLibDir.replaceAll("%", serviceType);
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerPluginClassLoaderUtil.getPluginImplLibPath for Class (" + pluginClass.getName() + " PATH :" + ret + ")");
+ }
+
+ return ret;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/Impl/TestChildFistClassLoader.java
----------------------------------------------------------------------
diff --git a/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/Impl/TestChildFistClassLoader.java b/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/Impl/TestChildFistClassLoader.java
new file mode 100644
index 0000000..de45520
--- /dev/null
+++ b/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/Impl/TestChildFistClassLoader.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.plugin.classloader.test.Impl;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import org.apache.ranger.plugin.classloader.RangerPluginClassLoader;
+import org.apache.ranger.plugin.classloader.test.TestPlugin;
+import org.apache.ranger.plugin.classloader.test.TestPrintParent;
+
+public class TestChildFistClassLoader {
+
+ public static void main(String [] args){
+ TestPrintParent testPrint = new TestPrintParent();
+ System.out.println(testPrint.getString());
+ File file = null;
+ URL[] urls = null;
+ try {
+ file = new File(".." + File.separatorChar + "TestPluginImpl.class");
+ URL url = file.toPath().toUri().toURL();
+ urls = new URL[] {url};
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ String[] libdirs = new String[] { file.getAbsolutePath() };
+
+ try {
+ @SuppressWarnings("resource")
+ RangerPluginClassLoader rangerPluginClassLoader = new RangerPluginClassLoader("hdfs", TestChildFistClassLoader.class);
+ TestPlugin testPlugin = (TestPlugin) rangerPluginClassLoader.loadClass("org.apache.ranger.plugin.classloader.test.Impl.TestPluginImpl").newInstance();
+ System.out.println(testPlugin.print());
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/Impl/TestPluginImpl.java
----------------------------------------------------------------------
diff --git a/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/Impl/TestPluginImpl.java b/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/Impl/TestPluginImpl.java
new file mode 100644
index 0000000..cbb3c67
--- /dev/null
+++ b/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/Impl/TestPluginImpl.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.plugin.classloader.test.Impl;
+
+import org.apache.ranger.plugin.classloader.test.TestPlugin;
+
+public class TestPluginImpl implements TestPlugin {
+
+ @Override
+ public String print() {
+ String ret = new TestPrint().getString();
+ return ret;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/Impl/TestPrint.java
----------------------------------------------------------------------
diff --git a/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/Impl/TestPrint.java b/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/Impl/TestPrint.java
new file mode 100644
index 0000000..8626ec4
--- /dev/null
+++ b/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/Impl/TestPrint.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.plugin.classloader.test.Impl;
+
+public class TestPrint {
+
+ public String getString(){
+ String ret = "Class Loaded by RangerPlugingClassLoader";
+ return ret;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/TestPlugin.java
----------------------------------------------------------------------
diff --git a/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/TestPlugin.java b/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/TestPlugin.java
new file mode 100644
index 0000000..145d7a5
--- /dev/null
+++ b/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/TestPlugin.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.plugin.classloader.test;
+
+public interface TestPlugin {
+ public String print();
+}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/TestPrintParent.java
----------------------------------------------------------------------
diff --git a/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/TestPrintParent.java b/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/TestPrintParent.java
new file mode 100644
index 0000000..9524dfa
--- /dev/null
+++ b/ranger-plugin-classloader/src/test/java/org/apache/ranger/plugin/classloader/test/TestPrintParent.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.plugin.classloader.test;
+
+public class TestPrintParent {
+
+ public String getString(){
+ String ret = "Loaded by Component ClassLoader";
+ return ret;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-storm-plugin-shim/pom.xml
----------------------------------------------------------------------
diff --git a/ranger-storm-plugin-shim/pom.xml b/ranger-storm-plugin-shim/pom.xml
new file mode 100644
index 0000000..397bb2f
--- /dev/null
+++ b/ranger-storm-plugin-shim/pom.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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>security_plugins.ranger-storm-plugin-shim</groupId>
+ <artifactId>ranger-storm-plugin-shim</artifactId>
+ <name>Storm Security Plugin shim</name>
+ <description>Storm Security Plugins shim</description>
+ <packaging>jar</packaging>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <parent>
+ <groupId>org.apache.ranger</groupId>
+ <artifactId>ranger</artifactId>
+ <version>0.5.0</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.storm</groupId>
+ <artifactId>storm-core</artifactId>
+ <version>${storm.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugins-common</groupId>
+ <artifactId>ranger-plugins-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugins-audit</groupId>
+ <artifactId>ranger-plugins-audit</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ranger</groupId>
+ <artifactId>credentialbuilder</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-hdfs</artifactId>
+ <version>${hadoop.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ <version>${commons.cli.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.htrace</groupId>
+ <artifactId>htrace-core</artifactId>
+ <version>${htrace-core.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugin-classloader</groupId>
+ <artifactId>ranger-plugin-classloader</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-storm-plugin-shim/src/main/java/com/xasecure/authorization/storm/authorizer/XaSecureStormAuthorizer.java
----------------------------------------------------------------------
diff --git a/ranger-storm-plugin-shim/src/main/java/com/xasecure/authorization/storm/authorizer/XaSecureStormAuthorizer.java b/ranger-storm-plugin-shim/src/main/java/com/xasecure/authorization/storm/authorizer/XaSecureStormAuthorizer.java
new file mode 100644
index 0000000..723dd79
--- /dev/null
+++ b/ranger-storm-plugin-shim/src/main/java/com/xasecure/authorization/storm/authorizer/XaSecureStormAuthorizer.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.xasecure.authorization.storm.authorizer;
+
+import org.apache.ranger.authorization.storm.authorizer.RangerStormAuthorizer;
+
+/**
+ * This class exists only to provide for seamless upgrade/downgrade capabilities. Class name is in storm conf which must allow for seamles upgrade and downgrade.
+ * Thus when class names were changed XaSecure* -> Ranger* this shell class serves to allow for seamles upgrade as well as downgrade.
+ *
+ * This class is final because if one needs to customize coprocessor it is expected that RangerStormAuthorizer would be modified/extended as that is
+ * the "real" authorizer! This class, hence, should NEVER be more than an EMPTY shell!
+ */
+final public class XaSecureStormAuthorizer extends RangerStormAuthorizer {
+}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-storm-plugin-shim/src/main/java/org/apache/ranger/authorization/storm/authorizer/RangerStormAuthorizer.java
----------------------------------------------------------------------
diff --git a/ranger-storm-plugin-shim/src/main/java/org/apache/ranger/authorization/storm/authorizer/RangerStormAuthorizer.java b/ranger-storm-plugin-shim/src/main/java/org/apache/ranger/authorization/storm/authorizer/RangerStormAuthorizer.java
new file mode 100644
index 0000000..7c620ec
--- /dev/null
+++ b/ranger-storm-plugin-shim/src/main/java/org/apache/ranger/authorization/storm/authorizer/RangerStormAuthorizer.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.authorization.storm.authorizer;
+
+
+
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.ranger.plugin.classloader.RangerPluginClassLoader;
+
+import backtype.storm.security.auth.IAuthorizer;
+import backtype.storm.security.auth.ReqContext;
+
+public class RangerStormAuthorizer implements IAuthorizer {
+ private static final Logger LOG = LoggerFactory.getLogger(RangerStormAuthorizer.class);
+
+ private static final String RANGER_PLUGIN_TYPE = "storm";
+ private static final String[] RANGER_PLUGIN_LIB_DIR = new String[] {"lib/ranger-storm-plugin"};
+ private static final String RANGER_STORM_AUTHORIZER_IMPL_CLASSNAME = "org.apache.ranger.authorization.storm.authorizer.RangerStormAuthorizer";
+
+ private IAuthorizer rangerStormAuthorizerImpl = null;
+ private static RangerPluginClassLoader rangerPluginClassLoader = null;
+
+ public RangerStormAuthorizer() {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerStormAuthorizer.RangerStormAuthorizer()");
+ }
+
+ this.init();
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerStormAuthorizer.RangerStormAuthorizer()");
+ }
+ }
+
+ private void init(){
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerStormAuthorizer.init()");
+ }
+
+ try {
+
+ rangerPluginClassLoader = RangerPluginClassLoader.getInstance(RANGER_PLUGIN_TYPE, this.getClass());
+
+ @SuppressWarnings("unchecked")
+ Class<IAuthorizer> cls = (Class<IAuthorizer>) Class.forName(RANGER_STORM_AUTHORIZER_IMPL_CLASSNAME, true, rangerPluginClassLoader);
+
+ activatePluginClassLoader();
+
+ rangerStormAuthorizerImpl = cls.newInstance();
+ } catch (Exception e) {
+ // check what need to be done
+ LOG.error("Error Enabling RangerStormPlugin", e);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerStormAuthorizer.init()");
+ }
+ }
+
+ @Override
+ public void prepare(Map storm_conf) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerStormAuthorizer.prepare()");
+ }
+
+ try {
+ activatePluginClassLoader();
+
+ rangerStormAuthorizerImpl.prepare(storm_conf);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerStormAuthorizer.prepare()");
+ }
+
+ }
+
+ @Override
+ public boolean permit(ReqContext context, String operation, Map topology_conf) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerStormAuthorizer.permit()");
+ }
+
+ boolean ret = false;
+
+ try {
+ activatePluginClassLoader();
+
+ ret = rangerStormAuthorizerImpl.permit(context, operation, topology_conf);
+ } finally {
+ deactivatePluginClassLoader();
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerStormAuthorizer.permit()");
+ }
+
+ return ret;
+ }
+
+
+ private void activatePluginClassLoader() {
+ if(rangerPluginClassLoader != null) {
+ rangerPluginClassLoader.activate();
+ }
+ }
+
+ private void deactivatePluginClassLoader() {
+ if(rangerPluginClassLoader != null) {
+ rangerPluginClassLoader.deactivate();
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-yarn-plugin-shim/pom.xml
----------------------------------------------------------------------
diff --git a/ranger-yarn-plugin-shim/pom.xml b/ranger-yarn-plugin-shim/pom.xml
new file mode 100644
index 0000000..d461ca5
--- /dev/null
+++ b/ranger-yarn-plugin-shim/pom.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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>security_plugins.ranger-yarn-plugin-shim</groupId>
+ <artifactId>ranger-yarn-plugin-shim</artifactId>
+ <name>YARN Security Plugin Shim</name>
+ <description>YARN Security Plugin Shim</description>
+ <packaging>jar</packaging>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <parent>
+ <groupId>org.apache.ranger</groupId>
+ <artifactId>ranger</artifactId>
+ <version>0.5.0</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>security_plugins.ranger-plugins-common</groupId>
+ <artifactId>ranger-plugins-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugins-audit</groupId>
+ <artifactId>ranger-plugins-audit</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ranger</groupId>
+ <artifactId>credentialbuilder</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-yarn-common</artifactId>
+ <version>${hadoop.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-yarn-api</artifactId>
+ <version>${hadoop.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugin-classloader</groupId>
+ <artifactId>ranger-plugin-classloader</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
[4/4] incubator-ranger git commit: RANGER-586:Ranger plugins should
not add dependent libraries to component's CLASSPATH
Posted by rm...@apache.org.
RANGER-586:Ranger plugins should not add dependent libraries to component's CLASSPATH
Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/a2c72902
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/a2c72902
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/a2c72902
Branch: refs/heads/master
Commit: a2c729021d7e3c04680c1c1002a17dac92b06d32
Parents: 11f73cd
Author: rmani <rm...@hortonworks.com>
Authored: Tue Oct 27 16:30:08 2015 -0700
Committer: rmani <rm...@hortonworks.com>
Committed: Tue Oct 27 16:30:08 2015 -0700
----------------------------------------------------------------------
agents-common/scripts/enable-agent.sh | 24 +-
hbase-agent/pom.xml | 5 +
.../hbase/XaSecureAuthorizationCoprocessor.java | 35 -
.../access/RangerAccessControlLists.java | 104 -
.../access/RangerAccessControlListsTest.java | 61 -
.../pdp/knox/filter/XASecurePDPKnoxFilter.java | 25 -
plugin-kafka/pom.xml | 5 +
.../kafka/authorizer/RangerKafkaAuthorizer.java | 6 +-
pom.xml | 16 +-
ranger-hbase-plugin-shim/pom.xml | 73 +
.../hbase/XaSecureAuthorizationCoprocessor.java | 33 +
.../access/RangerAccessControlLists.java | 104 +
.../hbase/RangerAuthorizationCoprocessor.java | 3701 ++++++++++++++++++
.../access/RangerAccessControlListsTest.java | 61 +
ranger-hdfs-plugin-shim/pom.xml | 74 +
.../hadoop/RangerHdfsAuthorizer.java | 191 +
ranger-hive-plugin-shim/pom.xml | 105 +
.../XaSecureHiveAuthorizerFactory.java | 32 +
.../authorizer/RangerHiveAuthorizerFactory.java | 121 +
ranger-kafka-plugin-shim/pom.xml | 56 +
.../kafka/authorizer/RangerKafkaAuthorizer.java | 248 ++
ranger-knox-plugin-shim/pom.xml | 91 +
.../pdp/knox/filter/XASecurePDPKnoxFilter.java | 25 +
.../authorization/knox/RangerPDPKnoxFilter.java | 153 +
ranger-plugin-classloader/pom.xml | 55 +
.../classloader/RangerPluginClassLoader.java | 292 ++
.../RangerPluginClassLoaderUtil.java | 150 +
.../test/Impl/TestChildFistClassLoader.java | 56 +
.../classloader/test/Impl/TestPluginImpl.java | 32 +
.../plugin/classloader/test/Impl/TestPrint.java | 28 +
.../plugin/classloader/test/TestPlugin.java | 24 +
.../classloader/test/TestPrintParent.java | 29 +
ranger-storm-plugin-shim/pom.xml | 76 +
.../authorizer/XaSecureStormAuthorizer.java | 32 +
.../storm/authorizer/RangerStormAuthorizer.java | 138 +
ranger-yarn-plugin-shim/pom.xml | 66 +
.../yarn/authorizer/RangerYarnAuthorizer.java | 205 +
src/main/assembly/hbase-agent.xml | 25 +-
src/main/assembly/hdfs-agent.xml | 65 +-
src/main/assembly/hive-agent.xml | 25 +-
src/main/assembly/knox-agent.xml | 23 +-
src/main/assembly/plugin-kafka.xml | 40 +-
src/main/assembly/plugin-yarn.xml | 24 +-
src/main/assembly/storm-agent.xml | 23 +-
.../authorizer/XaSecureStormAuthorizer.java | 32 -
45 files changed, 6454 insertions(+), 335 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/agents-common/scripts/enable-agent.sh
----------------------------------------------------------------------
diff --git a/agents-common/scripts/enable-agent.sh b/agents-common/scripts/enable-agent.sh
index f3db125..32e922d 100755
--- a/agents-common/scripts/enable-agent.sh
+++ b/agents-common/scripts/enable-agent.sh
@@ -121,6 +121,9 @@ INSTALL_ARGS="${PROJ_INSTALL_DIR}/install.properties"
COMPONENT_INSTALL_ARGS="${PROJ_INSTALL_DIR}/${COMPONENT_NAME}-install.properties"
JAVA=$JAVA_HOME/bin/java
+PLUGIN_DEPENDENT_LIB_DIR=lib/"${PROJ_NAME}-${COMPONENT_NAME}-impl"
+PROJ_LIB_PLUGIN_DIR=${PROJ_INSTALL_DIR}/${PLUGIN_DEPENDENT_LIB_DIR}
+
HCOMPONENT_INSTALL_DIR_NAME=$(getInstallProperty 'COMPONENT_INSTALL_DIR_NAME')
@@ -179,6 +182,8 @@ elif [ "${HCOMPONENT_NAME}" = "solr" ]; then
HCOMPONENT_LIB_DIR=${HCOMPONENT_INSTALL_DIR}/solr-webapp/webapp/WEB-INF/lib
elif [ "${HCOMPONENT_NAME}" = "kafka" ]; then
HCOMPONENT_LIB_DIR=${HCOMPONENT_INSTALL_DIR}/libs
+elif [ "${HCOMPONENT_NAME}" = "storm" ]; then
+ HCOMPONENT_LIB_DIR=${HCOMPONENT_INSTALL_DIR}/extlib-daemon
fi
HCOMPONENT_CONF_DIR=${HCOMPONENT_INSTALL_DIR}/conf
@@ -496,8 +501,7 @@ then
#if [ -d "${PROJ_LIB_DIR}" ]
#then
dt=`date '+%Y%m%d%H%M%S'`
- dbJar=$(getInstallProperty 'SQL_CONNECTOR_JAR')
- for f in ${PROJ_LIB_DIR}/*.jar ${dbJar}
+ for f in ${PROJ_LIB_DIR}/*.jar
do
if [ -f "${f}" ]
then
@@ -513,6 +517,22 @@ then
fi
fi
done
+
+ # ADD SQL CONNECTOR JAR TO PLUGIN DEPENDENCY JAR FOLDER
+ dbJar=$(getInstallProperty 'SQL_CONNECTOR_JAR')
+ if [ -f "${dbJar}" ]
+ then
+ bn=`basename ${dbJar}`
+ if [ -f ${PROJ_LIB_PLUGIN_DIR}/${bn} ]
+ then
+ rm ${PROJ_LIB_PLUGIN_DIR}/${bn}
+ fi
+ if [ ! -f ${PROJ_LIB_PLUGIN_DIR}/${bn} ]
+ then
+ ln -s ${dbJar} ${PROJ_LIB_PLUGIN_DIR}/${bn}
+ fi
+ fi
+
#fi
#
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/hbase-agent/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-agent/pom.xml b/hbase-agent/pom.xml
index b4664f3..edad495 100644
--- a/hbase-agent/pom.xml
+++ b/hbase-agent/pom.xml
@@ -48,6 +48,11 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>security_plugins.ranger-hbase-plugin-shim</groupId>
+ <artifactId>ranger-hbase-plugin-shim</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>security_plugins.ranger-plugins-audit</groupId>
<artifactId>ranger-plugins-audit</artifactId>
<version>${project.version}</version>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/hbase-agent/src/main/java/com/xasecure/authorization/hbase/XaSecureAuthorizationCoprocessor.java
----------------------------------------------------------------------
diff --git a/hbase-agent/src/main/java/com/xasecure/authorization/hbase/XaSecureAuthorizationCoprocessor.java b/hbase-agent/src/main/java/com/xasecure/authorization/hbase/XaSecureAuthorizationCoprocessor.java
deleted file mode 100644
index 574a07c..0000000
--- a/hbase-agent/src/main/java/com/xasecure/authorization/hbase/XaSecureAuthorizationCoprocessor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.xasecure.authorization.hbase;
-
-import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
-import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos;
-import org.apache.ranger.authorization.hbase.RangerAuthorizationCoprocessor;
-
-/**
- * This class exists only to provide for seamless upgrade/downgrade capabilities. Coprocessor name is in hbase config files in /etc/.../conf which
- * is not only out of bounds for any upgrade script but also must be of a form to allow for downgrad! Thus when class names were changed XaSecure* -> Ranger*
- * this shell class serves to allow for seamles upgrade as well as downgrade.
- *
- * This class is final because if one needs to customize coprocessor it is expected that RangerAuthorizationCoprocessor would be modified/extended as that is
- * the "real" coprocessor! This class, hence, should NEVER be more than an EMPTY shell!
- */
-public final class XaSecureAuthorizationCoprocessor extends RangerAuthorizationCoprocessor implements AccessControlProtos.AccessControlService.Interface, CoprocessorService {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/hbase-agent/src/main/java/org/apache/hadoop/hbase/security/access/RangerAccessControlLists.java
----------------------------------------------------------------------
diff --git a/hbase-agent/src/main/java/org/apache/hadoop/hbase/security/access/RangerAccessControlLists.java b/hbase-agent/src/main/java/org/apache/hadoop/hbase/security/access/RangerAccessControlLists.java
deleted file mode 100644
index 7f33b15..0000000
--- a/hbase-agent/src/main/java/org/apache/hadoop/hbase/security/access/RangerAccessControlLists.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.security.access;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.apache.hadoop.hbase.TableExistsException;
-import org.apache.hadoop.hbase.master.MasterServices;
-import org.apache.log4j.Logger;
-
-
-public class RangerAccessControlLists {
-
- private static final Logger LOG = Logger.getLogger(RangerAccessControlLists.class) ;
-
- public static void init(MasterServices master) throws IOException {
-
- Class<AccessControlLists> accessControlListsClass = AccessControlLists.class ;
- String cName = accessControlListsClass.getName() ;
-
- Class<?>[] params = new Class[1] ;
- params[0] = MasterServices.class ;
-
- for (String mname : new String[] { "init", "createACLTable" } ) {
- try {
- try {
- Method m = accessControlListsClass.getDeclaredMethod(mname, params) ;
- if (m != null) {
- try {
-
- try {
- m.invoke(null, master) ;
- logInfo("Execute method name [" + mname + "] in Class [" + cName + "] is successful.");
- } catch (InvocationTargetException e) {
- Throwable cause = e ;
- boolean tableExistsExceptionFound = false ;
- if (e != null) {
- Throwable ecause = e.getTargetException() ;
- if (ecause != null) {
- cause = ecause ;
- if (ecause instanceof TableExistsException) {
- tableExistsExceptionFound = true ;
- }
- }
- }
- if (! tableExistsExceptionFound) {
- logError("Unable to execute the method [" + mname + "] on [" + cName + "] due to exception", cause) ;
- throw new IOException(cause) ;
- }
- }
- return ;
- } catch (IllegalArgumentException e) {
- logError("Unable to execute method name [" + mname + "] in Class [" + cName + "].", e);
- throw new IOException(e) ;
- } catch (IllegalAccessException e) {
- logError("Unable to execute method name [" + mname + "] in Class [" + cName + "].", e);
- throw new IOException(e) ;
- }
- }
- }
- catch(NoSuchMethodException nsme) {
- logInfo("Unable to get method name [" + mname + "] in Class [" + cName + "]. Ignoring the exception");
- }
- } catch (SecurityException e) {
- logError("Unable to get method name [" + mname + "] in Class [" + cName + "].", e);
- throw new IOException(e) ;
- }
- }
- throw new IOException("Unable to initialize() [" + cName + "]") ;
- }
-
-
- private static void logInfo(String msg) {
- // System.out.println(msg) ;
- LOG.info(msg) ;
- }
-
- private static void logError(String msg, Throwable t) {
-// System.err.println(msg) ;
-// if (t != null) {
-// t.printStackTrace(System.err);
-// }
- LOG.error(msg, t);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/hbase-agent/src/test/java/org/apache/hadoop/hbase/security/access/RangerAccessControlListsTest.java
----------------------------------------------------------------------
diff --git a/hbase-agent/src/test/java/org/apache/hadoop/hbase/security/access/RangerAccessControlListsTest.java b/hbase-agent/src/test/java/org/apache/hadoop/hbase/security/access/RangerAccessControlListsTest.java
deleted file mode 100644
index aa66d08..0000000
--- a/hbase-agent/src/test/java/org/apache/hadoop/hbase/security/access/RangerAccessControlListsTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.hadoop.hbase.security.access;
-
-import java.io.IOException;
-
-import org.apache.hadoop.hbase.master.MasterServices;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class RangerAccessControlListsTest {
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Before
- public void setUp() throws Exception {
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testInit() {
- IOException exceptionFound = null ;
- try {
- MasterServices service = null ;
- RangerAccessControlLists.init(service) ;
- } catch (IOException e) {
- exceptionFound = e ;
- }
- Assert.assertFalse("Expected to get a NullPointerExecution after init method Execution - Found [" + exceptionFound + "]", (!(exceptionFound != null && exceptionFound.getCause() instanceof NullPointerException))) ;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/knox-agent/src/main/java/com/xasecure/pdp/knox/filter/XASecurePDPKnoxFilter.java
----------------------------------------------------------------------
diff --git a/knox-agent/src/main/java/com/xasecure/pdp/knox/filter/XASecurePDPKnoxFilter.java b/knox-agent/src/main/java/com/xasecure/pdp/knox/filter/XASecurePDPKnoxFilter.java
deleted file mode 100644
index 6b9d6fd..0000000
--- a/knox-agent/src/main/java/com/xasecure/pdp/knox/filter/XASecurePDPKnoxFilter.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.xasecure.pdp.knox.filter;
-
-import org.apache.ranger.authorization.knox.RangerPDPKnoxFilter;
-
-public class XASecurePDPKnoxFilter extends RangerPDPKnoxFilter {
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/plugin-kafka/pom.xml
----------------------------------------------------------------------
diff --git a/plugin-kafka/pom.xml b/plugin-kafka/pom.xml
index afee47d..e14e48c 100644
--- a/plugin-kafka/pom.xml
+++ b/plugin-kafka/pom.xml
@@ -47,5 +47,10 @@
<artifactId>kafka_2.10</artifactId>
<version>${kafka.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-hdfs</artifactId>
+ <version>${hadoop.version}</version>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/plugin-kafka/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
----------------------------------------------------------------------
diff --git a/plugin-kafka/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java b/plugin-kafka/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
index dbb2723..c5e955d 100644
--- a/plugin-kafka/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
+++ b/plugin-kafka/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
@@ -19,10 +19,7 @@
package org.apache.ranger.authorization.kafka.authorizer;
-import java.io.IOException;
-import java.security.Principal;
import java.util.Date;
-
import javax.security.auth.Subject;
import kafka.security.auth.Acl;
@@ -104,8 +101,7 @@ public class RangerKafkaAuthorizer implements Authorizer {
}
@Override
- public boolean authorize(Session session, Operation operation,
- Resource resource) {
+ public boolean authorize(Session session, Operation operation, Resource resource) {
if (rangerPlugin == null) {
MiscUtil.logErrorMessageByInterval(logger,
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0ccf12e..835894d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,8 +14,7 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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>
<parent>
<groupId>org.apache</groupId>
@@ -97,6 +96,13 @@
<module>unixauthservice</module>
<module>ranger-util</module>
<module>plugin-kms</module>
+ <module>ranger-hdfs-plugin-shim</module>
+ <module>ranger-plugin-classloader</module>
+ <module>ranger-hive-plugin-shim</module>
+ <module>ranger-hbase-plugin-shim</module>
+ <module>ranger-knox-plugin-shim</module>
+ <module>ranger-yarn-plugin-shim</module>
+ <module>ranger-storm-plugin-shim</module>
</modules>
<properties>
<javac.source.version>1.7</javac.source.version>
@@ -151,7 +157,7 @@
<jersey-client.version>2.6</jersey-client.version>
<junit.version>4.11</junit.version>
<kafka.version>0.8.2.0</kafka.version>
- <!-- <kafka.version>0.8.2.2.3.0.0-2208</kafka.version> -->
+ <!-- <kafka.version>0.8.2.2.3.2.0-2950</kafka.version> -->
<mockito.version>1.8.4</mockito.version>
<hamcrest-version>1.3</hamcrest-version>
<knox.gateway.version>0.6.0</knox.gateway.version>
@@ -505,7 +511,7 @@
<phase>process-resources</phase>
<configuration>
<target>
- <echo message="${project.version}" file="${project.build.directory}/version" />
+ <echo message="${project.version}" file="${project.build.directory}/version"/>
</target>
</configuration>
<goals>
@@ -524,4 +530,4 @@
</plugin>
</plugins>
</build>
-</project>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-hbase-plugin-shim/pom.xml
----------------------------------------------------------------------
diff --git a/ranger-hbase-plugin-shim/pom.xml b/ranger-hbase-plugin-shim/pom.xml
new file mode 100644
index 0000000..39fa139
--- /dev/null
+++ b/ranger-hbase-plugin-shim/pom.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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>security_plugins.ranger-hbase-plugin-shim</groupId>
+ <artifactId>ranger-hbase-plugin-shim</artifactId>
+ <name>HBase Security Plugin Shim</name>
+ <description>HBase Security Plugins Shim</description>
+ <packaging>jar</packaging>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <parent>
+ <groupId>org.apache.ranger</groupId>
+ <artifactId>ranger</artifactId>
+ <version>0.5.0</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-server</artifactId>
+ <version>${hbase.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-hdfs</artifactId>
+ <version>${hadoop.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugins-common</groupId>
+ <artifactId>ranger-plugins-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugins-audit</groupId>
+ <artifactId>ranger-plugins-audit</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>security_plugins.ranger-plugin-classloader</groupId>
+ <artifactId>ranger-plugin-classloader</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-integration</artifactId>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-hbase-plugin-shim/src/main/java/com/xasecure/authorization/hbase/XaSecureAuthorizationCoprocessor.java
----------------------------------------------------------------------
diff --git a/ranger-hbase-plugin-shim/src/main/java/com/xasecure/authorization/hbase/XaSecureAuthorizationCoprocessor.java b/ranger-hbase-plugin-shim/src/main/java/com/xasecure/authorization/hbase/XaSecureAuthorizationCoprocessor.java
new file mode 100644
index 0000000..bc01e51
--- /dev/null
+++ b/ranger-hbase-plugin-shim/src/main/java/com/xasecure/authorization/hbase/XaSecureAuthorizationCoprocessor.java
@@ -0,0 +1,33 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.xasecure.authorization.hbase;
+
+import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
+import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService;
+import org.apache.ranger.authorization.hbase.RangerAuthorizationCoprocessor;
+/**
+ * This class exists only to provide for seamless upgrade/downgrade capabilities. Coprocessor name is in hbase config files in /etc/.../conf which
+ * is not only out of bounds for any upgrade script but also must be of a form to allow for downgrad! Thus when class names were changed XaSecure* -> Ranger*
+ * this shell class serves to allow for seamles upgrade as well as downgrade.
+ *
+ * This class is final because if one needs to customize coprocessor it is expected that RangerAuthorizationCoprocessor would be modified/extended as that is
+ * the "real" coprocessor! This class, hence, should NEVER be more than an EMPTY shell!
+ */
+public final class XaSecureAuthorizationCoprocessor extends RangerAuthorizationCoprocessor implements AccessControlService.Interface, CoprocessorService {
+}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a2c72902/ranger-hbase-plugin-shim/src/main/java/org/apache/hadoop/hbase/security/access/RangerAccessControlLists.java
----------------------------------------------------------------------
diff --git a/ranger-hbase-plugin-shim/src/main/java/org/apache/hadoop/hbase/security/access/RangerAccessControlLists.java b/ranger-hbase-plugin-shim/src/main/java/org/apache/hadoop/hbase/security/access/RangerAccessControlLists.java
new file mode 100644
index 0000000..7f33b15
--- /dev/null
+++ b/ranger-hbase-plugin-shim/src/main/java/org/apache/hadoop/hbase/security/access/RangerAccessControlLists.java
@@ -0,0 +1,104 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.security.access;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.hadoop.hbase.TableExistsException;
+import org.apache.hadoop.hbase.master.MasterServices;
+import org.apache.log4j.Logger;
+
+
+public class RangerAccessControlLists {
+
+ private static final Logger LOG = Logger.getLogger(RangerAccessControlLists.class) ;
+
+ public static void init(MasterServices master) throws IOException {
+
+ Class<AccessControlLists> accessControlListsClass = AccessControlLists.class ;
+ String cName = accessControlListsClass.getName() ;
+
+ Class<?>[] params = new Class[1] ;
+ params[0] = MasterServices.class ;
+
+ for (String mname : new String[] { "init", "createACLTable" } ) {
+ try {
+ try {
+ Method m = accessControlListsClass.getDeclaredMethod(mname, params) ;
+ if (m != null) {
+ try {
+
+ try {
+ m.invoke(null, master) ;
+ logInfo("Execute method name [" + mname + "] in Class [" + cName + "] is successful.");
+ } catch (InvocationTargetException e) {
+ Throwable cause = e ;
+ boolean tableExistsExceptionFound = false ;
+ if (e != null) {
+ Throwable ecause = e.getTargetException() ;
+ if (ecause != null) {
+ cause = ecause ;
+ if (ecause instanceof TableExistsException) {
+ tableExistsExceptionFound = true ;
+ }
+ }
+ }
+ if (! tableExistsExceptionFound) {
+ logError("Unable to execute the method [" + mname + "] on [" + cName + "] due to exception", cause) ;
+ throw new IOException(cause) ;
+ }
+ }
+ return ;
+ } catch (IllegalArgumentException e) {
+ logError("Unable to execute method name [" + mname + "] in Class [" + cName + "].", e);
+ throw new IOException(e) ;
+ } catch (IllegalAccessException e) {
+ logError("Unable to execute method name [" + mname + "] in Class [" + cName + "].", e);
+ throw new IOException(e) ;
+ }
+ }
+ }
+ catch(NoSuchMethodException nsme) {
+ logInfo("Unable to get method name [" + mname + "] in Class [" + cName + "]. Ignoring the exception");
+ }
+ } catch (SecurityException e) {
+ logError("Unable to get method name [" + mname + "] in Class [" + cName + "].", e);
+ throw new IOException(e) ;
+ }
+ }
+ throw new IOException("Unable to initialize() [" + cName + "]") ;
+ }
+
+
+ private static void logInfo(String msg) {
+ // System.out.println(msg) ;
+ LOG.info(msg) ;
+ }
+
+ private static void logError(String msg, Throwable t) {
+// System.err.println(msg) ;
+// if (t != null) {
+// t.printStackTrace(System.err);
+// }
+ LOG.error(msg, t);
+ }
+
+}