sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shreepa...@apache.org
Subject git commit: SENTRY-64: Break Circular dependency between sentry-binding-solr and sentry-core (Gregory Chanan via Shreepadma Venugopalan)
Date Fri, 15 Nov 2013 21:10:59 GMT
Updated Branches:
  refs/heads/master 68998d011 -> 45cf5fb4f


SENTRY-64: Break Circular dependency between sentry-binding-solr and sentry-core (Gregory
Chanan via Shreepadma Venugopalan)


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

Branch: refs/heads/master
Commit: 45cf5fb4fb6a01d3035d370cdcdb0ee00c2669d9
Parents: 68998d0
Author: Shreepadma Venugopalan <shreepadma@apache.org>
Authored: Fri Nov 15 13:10:44 2013 -0800
Committer: Shreepadma Venugopalan <shreepadma@apache.org>
Committed: Fri Nov 15 13:10:44 2013 -0800

----------------------------------------------------------------------
 pom.xml                                         |  7 -----
 sentry-binding/sentry-binding-solr/pom.xml      |  4 ---
 .../binding/solr/authz/SolrAuthzBinding.java    | 29 ++++++++++++++------
 3 files changed, 21 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/45cf5fb4/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f5cf265..997b1f4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -53,7 +53,6 @@ limitations under the License.
     <maven.compile.source>1.6</maven.compile.source>
     <maven.compile.target>1.6</maven.compile.target>
     <hive.version>0.10.0-cdh4.4.0-SNAPSHOT</hive.version>
-    <solr.version>4.4.0-search-1.1.0-SNAPSHOT</solr.version>
     <hadoop.version>2.0.0-cdh4.4.0-SNAPSHOT</hadoop.version>
     <junit.version>4.9</junit.version>
     <fest.reflect.version>1.4.1</fest.reflect.version>
@@ -240,12 +239,6 @@ limitations under the License.
         <scope>provided</scope>
       </dependency>
       <dependency>
-        <groupId>org.apache.solr</groupId>
-        <artifactId>solr-core</artifactId>
-        <version>${solr.version}</version>
-        <scope>provided</scope>
-      </dependency>
-      <dependency>
         <groupId>org.apache.sentry</groupId>
         <artifactId>sentry-binding-hive</artifactId>
         <version>${project.version}</version>

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/45cf5fb4/sentry-binding/sentry-binding-solr/pom.xml
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-solr/pom.xml b/sentry-binding/sentry-binding-solr/pom.xml
index a1c8dbf..4ed491a 100644
--- a/sentry-binding/sentry-binding-solr/pom.xml
+++ b/sentry-binding/sentry-binding-solr/pom.xml
@@ -59,10 +59,6 @@ limitations under the License.
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-common</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.apache.solr</groupId>
-      <artifactId>solr-core</artifactId>
-    </dependency>
   </dependencies>
 
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/45cf5fb4/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/authz/SolrAuthzBinding.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/authz/SolrAuthzBinding.java
b/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/authz/SolrAuthzBinding.java
index d7b766c..5c2d7bc 100644
--- a/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/authz/SolrAuthzBinding.java
+++ b/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/authz/SolrAuthzBinding.java
@@ -16,12 +16,14 @@
  */
 package org.apache.sentry.binding.solr.authz;
 
+import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.Constructor;
 import java.util.Arrays;
 import java.util.Set;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
 import org.apache.sentry.core.common.Subject;
 import org.apache.sentry.core.model.search.Collection;
 import org.apache.sentry.core.model.search.SearchModelAction;
@@ -30,9 +32,6 @@ import org.apache.sentry.binding.solr.conf.SolrAuthzConf.AuthzConfVars;
 import org.apache.sentry.policy.common.PolicyEngine;
 import org.apache.sentry.provider.common.AuthorizationProvider;
 import org.apache.sentry.provider.common.ProviderBackend;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.core.HdfsDirectoryFactory;
-import org.apache.solr.util.HdfsUtil;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -40,6 +39,8 @@ import org.slf4j.LoggerFactory;
 public class SolrAuthzBinding {
   private static final Logger LOG = LoggerFactory
       .getLogger(SolrAuthzBinding.class);
+  private static final String[] HADOOP_CONF_FILES = {"core-site.xml",
+    "hdfs-site.xml", "mapred-site.xml", "yarn-site.xml", "hadoop-site.xml"};
 
   private final SolrAuthzConf authzConf;
   private final AuthorizationProvider authProvider;
@@ -109,11 +110,23 @@ public class SolrAuthzBinding {
 
   private Configuration getConf() throws IOException {
     Configuration conf = new Configuration();
-    String confDir = System.getProperty(HdfsDirectoryFactory.CONFIG_DIRECTORY);
-    try {
-      HdfsUtil.addHdfsResources(conf, confDir);
-    } catch (SolrException se) {
-      throw new IOException("Sentry binding encountered an exception trying to create Configuration",
se);
+    String confDir = System.getProperty("solr.hdfs.confdir");
+    if (confDir != null && confDir.length() > 0) {
+      File confDirFile = new File(confDir);
+      if (!confDirFile.exists()) {
+        throw new IOException("Resource directory does not exist: " + confDirFile.getAbsolutePath());
+      }
+      if (!confDirFile.isDirectory()) {
+        throw new IOException("Specified resource directory is not a directory" + confDirFile.getAbsolutePath());
+      }
+      if (!confDirFile.canRead()) {
+        throw new IOException("Resource directory must be readable by the Solr process: "
+ confDirFile.getAbsolutePath());
+      }
+      for (String file : HADOOP_CONF_FILES) {
+        if (new File(confDirFile, file).exists()) {
+          conf.addResource(new Path(confDir, file));
+        }
+      }
     }
     return conf;
   }


Mime
View raw message