ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sneet...@apache.org
Subject [1/2] incubator-ranger git commit: RANGER-197: Fixed the source code compilation issues related to SNAPSHOT library dependencies
Date Wed, 10 Dec 2014 14:50:09 GMT
Repository: incubator-ranger
Updated Branches:
  refs/heads/ranger-0.4 e88740f5f -> 539e3d195


RANGER-197: Fixed the source code compilation issues related to SNAPSHOT library dependencies

Conflicts:
	pom.xml


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

Branch: refs/heads/ranger-0.4
Commit: ccba56eb0c82e89241997184102edf0cf71eaddf
Parents: e88740f
Author: sneethiraj <sneethir@apache.org>
Authored: Tue Dec 9 18:47:19 2014 -0500
Committer: sneethiraj <sneethir@apache.org>
Committed: Wed Dec 10 09:45:45 2014 -0500

----------------------------------------------------------------------
 .../security/access/XaAccessControlLists.java   | 79 ++++++++++++++++++--
 .../access/XaAccessControlListsTest.java        | 43 +++++++++++
 pom.xml                                         | 11 +--
 3 files changed, 123 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/ccba56eb/hbase-agent/src/main/java/org/apache/hadoop/hbase/security/access/XaAccessControlLists.java
----------------------------------------------------------------------
diff --git a/hbase-agent/src/main/java/org/apache/hadoop/hbase/security/access/XaAccessControlLists.java
b/hbase-agent/src/main/java/org/apache/hadoop/hbase/security/access/XaAccessControlLists.java
index 6dcb985..8313532 100644
--- a/hbase-agent/src/main/java/org/apache/hadoop/hbase/security/access/XaAccessControlLists.java
+++ b/hbase-agent/src/main/java/org/apache/hadoop/hbase/security/access/XaAccessControlLists.java
@@ -19,17 +19,86 @@
 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.hadoop.hbase.security.access.AccessControlLists;
+import org.apache.log4j.Logger;
+
 
 public class XaAccessControlLists {
+	
+	private static final Logger LOG = Logger.getLogger(XaAccessControlLists.class) ;
+	
 	public static void init(MasterServices master) throws IOException {
-		try {
-			AccessControlLists.init(master);
-		} catch(TableExistsException excp) {
-			// ignore
+
+		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/ccba56eb/hbase-agent/src/test/java/org/apache/hadoop/hbase/security/access/XaAccessControlListsTest.java
----------------------------------------------------------------------
diff --git a/hbase-agent/src/test/java/org/apache/hadoop/hbase/security/access/XaAccessControlListsTest.java
b/hbase-agent/src/test/java/org/apache/hadoop/hbase/security/access/XaAccessControlListsTest.java
new file mode 100644
index 0000000..4035ab4
--- /dev/null
+++ b/hbase-agent/src/test/java/org/apache/hadoop/hbase/security/access/XaAccessControlListsTest.java
@@ -0,0 +1,43 @@
+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 XaAccessControlListsTest {
+
+	@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 ;
+			XaAccessControlLists.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/ccba56eb/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6c56a05..835507f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -78,11 +78,11 @@
 		<google.guava.version>17.0</google.guava.version>
 		<gson.version>2.2.4</gson.version>
 		<guava.version>11.0.2</guava.version>
-		<hadoop-auth.version>3.0.0-SNAPSHOT</hadoop-auth.version>
-		<hadoop-common.version>3.0.0-SNAPSHOT</hadoop-common.version>
-		<hadoop.version>3.0.0-SNAPSHOT</hadoop.version>
+		<hadoop-auth.version>2.6.0</hadoop-auth.version>
+		<hadoop-common.version>2.6.0</hadoop-common.version>
+		<hadoop.version>2.6.0</hadoop.version>
 		<hamcrest.all.version>1.3</hamcrest.all.version>
-		<hbase.version>0.99.2-SNAPSHOT</hbase.version>
+		<hbase.version>0.99.2</hbase.version>
 		<hive.version>0.14.0-SNAPSHOT</hive.version>
 		<javassist.version>3.12.1.GA</javassist.version>
 		<javax.persistence.version>2.1.0</javax.persistence.version>
@@ -91,7 +91,8 @@
 		<jersey-bundle.version>1.17.1</jersey-bundle.version>
 		<junit.version>4.11</junit.version>
 		<mockito.version>1.8.4</mockito.version>
-		<knox.gateway.version>0.5.0-SNAPSHOT</knox.gateway.version>
+		<hamcrest-version>1.3</hamcrest-version>
+		<knox.gateway.version>0.5.0</knox.gateway.version>
 		<local.lib.dir>${project.basedir}/../lib/local</local.lib.dir>
 		<log4j.version>1.2.17</log4j.version>
 		<mysql-connector-java.version>5.1.31</mysql-connector-java.version>


Mime
View raw message