You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by co...@apache.org on 2016/09/28 09:33:04 UTC
[11/19] incubator-ranger git commit: Removing trailing whitespace
(via sed)
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/main/java/org/apache/ranger/services/hbase/client/HBaseClient.java
----------------------------------------------------------------------
diff --git a/hbase-agent/src/main/java/org/apache/ranger/services/hbase/client/HBaseClient.java b/hbase-agent/src/main/java/org/apache/ranger/services/hbase/client/HBaseClient.java
index 1c9a57e..f0f086c 100644
--- a/hbase-agent/src/main/java/org/apache/ranger/services/hbase/client/HBaseClient.java
+++ b/hbase-agent/src/main/java/org/apache/ranger/services/hbase/client/HBaseClient.java
@@ -6,9 +6,9 @@
* 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
@@ -64,7 +64,7 @@ public class HBaseClient extends BaseClient {
}
- //TODO: temporary solution - to be added to the UI for HBase
+ //TODO: temporary solution - to be added to the UI for HBase
private static Map<String,String> addDefaultHBaseProp(Map<String,String> connectionProp) {
if (connectionProp != null) {
String param = "zookeeper.znode.parent";
@@ -283,7 +283,7 @@ public class HBaseClient extends BaseClient {
} catch(IOException io) {
String msgDesc = "getTableList: Unable to get HBase table List for [repository:"
- + getConfigHolder().getDatasourceName() + ",table-match:"
+ + getConfigHolder().getDatasourceName() + ",table-match:"
+ tableNameMatching + "].";
HadoopException hdpException = new HadoopException(msgDesc, io);
hdpException.generateResponseDataMap(false, getMessage(io),
@@ -292,7 +292,7 @@ public class HBaseClient extends BaseClient {
throw hdpException;
} catch (Throwable e) {
String msgDesc = "getTableList : Unable to get HBase table List for [repository:"
- + getConfigHolder().getDatasourceName() + ",table-match:"
+ + getConfigHolder().getDatasourceName() + ",table-match:"
+ tableNameMatching + "].";
LOG.error(msgDesc + e);
HadoopException hdpException = new HadoopException(msgDesc, e);
@@ -395,7 +395,7 @@ public class HBaseClient extends BaseClient {
hdpException.generateResponseDataMap(false, getMessage(io),
msgDesc + errMsg, null, null);
LOG.error(msgDesc + io);
- throw hdpException;
+ throw hdpException;
} catch (SecurityException se) {
String msgDesc = "getColumnFamilyList: Unable to get HBase ColumnFamilyList for "
+ "[repository:" +getConfigHolder().getDatasourceName() + ",table:" + tblName
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/main/java/org/apache/ranger/services/hbase/client/HBaseConnectionMgr.java
----------------------------------------------------------------------
diff --git a/hbase-agent/src/main/java/org/apache/ranger/services/hbase/client/HBaseConnectionMgr.java b/hbase-agent/src/main/java/org/apache/ranger/services/hbase/client/HBaseConnectionMgr.java
index 8dd1c17..cafc8dc 100644
--- a/hbase-agent/src/main/java/org/apache/ranger/services/hbase/client/HBaseConnectionMgr.java
+++ b/hbase-agent/src/main/java/org/apache/ranger/services/hbase/client/HBaseConnectionMgr.java
@@ -6,9 +6,9 @@
* 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
@@ -95,10 +95,10 @@ public class HBaseConnectionMgr {
client = TimedEventUtil.timedTask(connectHBase, 5, TimeUnit.SECONDS);
}
} catch(Exception e){
- LOG.error("Error connecting HBase repository : "+
+ LOG.error("Error connecting HBase repository : "+
serviceName +" using config : "+ configs);
}
- }
+ }
if(client!=null){
HBaseClient oldClient = hbaseConnectionCache.putIfAbsent(serviceName, client);
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/main/java/org/apache/ranger/services/hbase/client/HBaseResourceMgr.java
----------------------------------------------------------------------
diff --git a/hbase-agent/src/main/java/org/apache/ranger/services/hbase/client/HBaseResourceMgr.java b/hbase-agent/src/main/java/org/apache/ranger/services/hbase/client/HBaseResourceMgr.java
index 9b3b326..32cfc25 100644
--- a/hbase-agent/src/main/java/org/apache/ranger/services/hbase/client/HBaseResourceMgr.java
+++ b/hbase-agent/src/main/java/org/apache/ranger/services/hbase/client/HBaseResourceMgr.java
@@ -6,9 +6,9 @@
* 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
@@ -73,8 +73,8 @@ public class HBaseResourceMgr {
if ( userInput != null && resource != null) {
if ( resourceMap != null && !resourceMap.isEmpty() ) {
- tableList = resourceMap.get(TABLE);
- columnFamilyList = resourceMap.get(COLUMNFAMILY);
+ tableList = resourceMap.get(TABLE);
+ columnFamilyList = resourceMap.get(COLUMNFAMILY);
}
switch (resource.trim().toLowerCase()) {
case TABLE:
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/AuthorizationSessionTest.java
----------------------------------------------------------------------
diff --git a/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/AuthorizationSessionTest.java b/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/AuthorizationSessionTest.java
index f1c0960..2c8f9af 100644
--- a/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/AuthorizationSessionTest.java
+++ b/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/AuthorizationSessionTest.java
@@ -6,9 +6,9 @@
* 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
@@ -110,7 +110,7 @@ public class AuthorizationSessionTest {
session.columnFamily("family");
try {
session.verifyBuildable();
- } catch (IllegalStateException e) {
+ } catch (IllegalStateException e) {
Assert.fail("Should have thrown an exception");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/ColumnIteratorTest.java
----------------------------------------------------------------------
diff --git a/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/ColumnIteratorTest.java b/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/ColumnIteratorTest.java
index d59881e..4b40038 100644
--- a/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/ColumnIteratorTest.java
+++ b/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/ColumnIteratorTest.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/HbaseAuthUtilsImplTest.java
----------------------------------------------------------------------
diff --git a/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/HbaseAuthUtilsImplTest.java b/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/HbaseAuthUtilsImplTest.java
index e40f31a..1b8edd4 100644
--- a/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/HbaseAuthUtilsImplTest.java
+++ b/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/HbaseAuthUtilsImplTest.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessorTest.java
----------------------------------------------------------------------
diff --git a/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessorTest.java b/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessorTest.java
index 19f390f..f982910 100644
--- a/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessorTest.java
+++ b/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessorTest.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/RangerAuthorizationFilterTest.java
----------------------------------------------------------------------
diff --git a/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/RangerAuthorizationFilterTest.java b/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/RangerAuthorizationFilterTest.java
index 643f08a..48b8a17 100644
--- a/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/RangerAuthorizationFilterTest.java
+++ b/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/RangerAuthorizationFilterTest.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/TestPolicyEngine.java
----------------------------------------------------------------------
diff --git a/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/TestPolicyEngine.java b/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/TestPolicyEngine.java
index cfac635..9f0e5ac 100644
--- a/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/TestPolicyEngine.java
+++ b/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/TestPolicyEngine.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/test/java/org/apache/ranger/services/hbase/TestRangerServiceHBase.java
----------------------------------------------------------------------
diff --git a/hbase-agent/src/test/java/org/apache/ranger/services/hbase/TestRangerServiceHBase.java b/hbase-agent/src/test/java/org/apache/ranger/services/hbase/TestRangerServiceHBase.java
index f771620..ac7a146 100644
--- a/hbase-agent/src/test/java/org/apache/ranger/services/hbase/TestRangerServiceHBase.java
+++ b/hbase-agent/src/test/java/org/apache/ranger/services/hbase/TestRangerServiceHBase.java
@@ -6,9 +6,9 @@
* 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
@@ -63,7 +63,7 @@ public class TestRangerServiceHBase {
HashMap<String,Object> ret = null;
String errorMessage = null;
- try {
+ try {
ret = svcHBase.validateConfig();
}catch (Exception e) {
errorMessage = e.getMessage();
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/HDFSAccessVerifier.java
----------------------------------------------------------------------
diff --git a/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/HDFSAccessVerifier.java b/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/HDFSAccessVerifier.java
index 1bbae6b..b1ecbd2 100644
--- a/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/HDFSAccessVerifier.java
+++ b/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/HDFSAccessVerifier.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/RangerHdfsAuthorizer.java
----------------------------------------------------------------------
diff --git a/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/RangerHdfsAuthorizer.java b/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/RangerHdfsAuthorizer.java
index 93dca87..0932956 100644
--- a/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/RangerHdfsAuthorizer.java
+++ b/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/RangerHdfsAuthorizer.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/agent/AuthCodeInjectionJavaAgent.java
----------------------------------------------------------------------
diff --git a/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/agent/AuthCodeInjectionJavaAgent.java b/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/agent/AuthCodeInjectionJavaAgent.java
index b7fd50a..065c8a5 100644
--- a/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/agent/AuthCodeInjectionJavaAgent.java
+++ b/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/agent/AuthCodeInjectionJavaAgent.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/agent/HadoopAuthClassTransformer.java
----------------------------------------------------------------------
diff --git a/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/agent/HadoopAuthClassTransformer.java b/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/agent/HadoopAuthClassTransformer.java
index 68867df..7356cae 100644
--- a/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/agent/HadoopAuthClassTransformer.java
+++ b/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/agent/HadoopAuthClassTransformer.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/exceptions/RangerAccessControlException.java
----------------------------------------------------------------------
diff --git a/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/exceptions/RangerAccessControlException.java b/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/exceptions/RangerAccessControlException.java
index 68ca895..3a66da3 100644
--- a/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/exceptions/RangerAccessControlException.java
+++ b/hdfs-agent/src/main/java/org/apache/ranger/authorization/hadoop/exceptions/RangerAccessControlException.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/RangerServiceHdfs.java
----------------------------------------------------------------------
diff --git a/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/RangerServiceHdfs.java b/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/RangerServiceHdfs.java
index bdf29f7..e1648dc 100644
--- a/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/RangerServiceHdfs.java
+++ b/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/RangerServiceHdfs.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsClient.java
----------------------------------------------------------------------
diff --git a/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsClient.java b/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsClient.java
index ecc406c..62db66f 100644
--- a/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsClient.java
+++ b/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsClient.java
@@ -6,9 +6,9 @@
* 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
@@ -133,7 +133,7 @@ public class HdfsClient extends BaseClient {
}
} catch (IOException ioe) {
String msgDesc = "listFilesInternal: Unable to get listing of files for directory "
- + baseDir + fileMatching
+ + baseDir + fileMatching
+ "] from Hadoop environment ["
+ getSerivceName()
+ "].";
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsConnectionMgr.java
----------------------------------------------------------------------
diff --git a/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsConnectionMgr.java b/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsConnectionMgr.java
index 18cbc12..ede8077 100644
--- a/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsConnectionMgr.java
+++ b/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsConnectionMgr.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsResourceMgr.java
----------------------------------------------------------------------
diff --git a/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsResourceMgr.java b/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsResourceMgr.java
index 8b49965..0a2eba0 100644
--- a/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsResourceMgr.java
+++ b/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsResourceMgr.java
@@ -6,9 +6,9 @@
* 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
@@ -108,7 +108,7 @@ public class HdfsResourceMgr {
};
if ( callableObj != null) {
synchronized(hdfsClient) {
- resultList = TimedEventUtil.timedTask(callableObj, 5,TimeUnit.SECONDS);
+ resultList = TimedEventUtil.timedTask(callableObj, 5,TimeUnit.SECONDS);
}
}
if(LOG.isDebugEnabled()) {
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hdfs-agent/src/test/java/org/apache/ranger/services/hdfs/HDFSRangerTest.java
----------------------------------------------------------------------
diff --git a/hdfs-agent/src/test/java/org/apache/ranger/services/hdfs/HDFSRangerTest.java b/hdfs-agent/src/test/java/org/apache/ranger/services/hdfs/HDFSRangerTest.java
index 56aac0b..726494a 100644
--- a/hdfs-agent/src/test/java/org/apache/ranger/services/hdfs/HDFSRangerTest.java
+++ b/hdfs-agent/src/test/java/org/apache/ranger/services/hdfs/HDFSRangerTest.java
@@ -40,18 +40,18 @@ import org.apache.ranger.authorization.hadoop.exceptions.RangerAccessControlExce
import org.junit.Assert;
/**
- * Here we plug the Ranger AccessControlEnforcer into HDFS.
- *
- * A custom RangerAdminClient is plugged into Ranger in turn, which loads security policies from a local file. These policies were
+ * Here we plug the Ranger AccessControlEnforcer into HDFS.
+ *
+ * A custom RangerAdminClient is plugged into Ranger in turn, which loads security policies from a local file. These policies were
* generated in the Ranger Admin UI for a service called "HDFSTest". It contains three policies, each of which grants read, write and
* execute permissions in turn to "/tmp/tmpdir", "/tmp/tmpdir2" and "/tmp/tmpdir3" to a user called "bob" and to a group called "IT".
*/
public class HDFSRangerTest {
-
+
private static final File baseDir = new File("./target/hdfs/").getAbsoluteFile();
private static MiniDFSCluster hdfsCluster;
private static String defaultFs;
-
+
@org.junit.BeforeClass
public static void setup() throws Exception {
Configuration conf = new Configuration();
@@ -61,17 +61,17 @@ public class HDFSRangerTest {
hdfsCluster = builder.build();
defaultFs = conf.get("fs.defaultFS");
}
-
+
@org.junit.AfterClass
public static void cleanup() throws Exception {
FileUtil.fullyDelete(baseDir);
hdfsCluster.shutdown();
}
-
+
@org.junit.Test
public void readTest() throws Exception {
FileSystem fileSystem = hdfsCluster.getFileSystem();
-
+
// Write a file - the AccessControlEnforcer won't be invoked as we are the "superuser"
final Path file = new Path("/tmp/tmpdir/data-file2");
FSDataOutputStream out = fileSystem.create(file);
@@ -80,10 +80,10 @@ public class HDFSRangerTest {
out.flush();
}
out.close();
-
+
// Change permissions to read-only
fileSystem.setPermission(file, new FsPermission(FsAction.READ, FsAction.NONE, FsAction.NONE));
-
+
// Now try to read the file as "bob" - this should be allowed (by the policy - user)
UserGroupInformation ugi = UserGroupInformation.createUserForTesting("bob", new String[] {});
ugi.doAs(new PrivilegedExceptionAction<Void>() {
@@ -91,21 +91,21 @@ public class HDFSRangerTest {
public Void run() throws Exception {
Configuration conf = new Configuration();
conf.set("fs.defaultFS", defaultFs);
-
+
FileSystem fs = FileSystem.get(conf);
-
+
// Read the file
FSDataInputStream in = fs.open(file);
ByteArrayOutputStream output = new ByteArrayOutputStream();
IOUtils.copy(in, output);
String content = new String(output.toByteArray());
Assert.assertTrue(content.startsWith("data0"));
-
+
fs.close();
return null;
}
});
-
+
// Now try to read the file as "alice" - this should be allowed (by the policy - group)
ugi = UserGroupInformation.createUserForTesting("alice", new String[] {"IT"});
ugi.doAs(new PrivilegedExceptionAction<Void>() {
@@ -113,21 +113,21 @@ public class HDFSRangerTest {
public Void run() throws Exception {
Configuration conf = new Configuration();
conf.set("fs.defaultFS", defaultFs);
-
+
FileSystem fs = FileSystem.get(conf);
-
+
// Read the file
FSDataInputStream in = fs.open(file);
ByteArrayOutputStream output = new ByteArrayOutputStream();
IOUtils.copy(in, output);
String content = new String(output.toByteArray());
Assert.assertTrue(content.startsWith("data0"));
-
+
fs.close();
return null;
}
});
-
+
// Now try to read the file as unknown user "eve" - this should not be allowed
ugi = UserGroupInformation.createUserForTesting("eve", new String[] {});
ugi.doAs(new PrivilegedExceptionAction<Void>() {
@@ -135,9 +135,9 @@ public class HDFSRangerTest {
public Void run() throws Exception {
Configuration conf = new Configuration();
conf.set("fs.defaultFS", defaultFs);
-
+
FileSystem fs = FileSystem.get(conf);
-
+
// Read the file
try {
fs.open(file);
@@ -146,18 +146,18 @@ public class HDFSRangerTest {
// expected
Assert.assertTrue(RangerAccessControlException.class.getName().equals(ex.getClassName()));
}
-
+
fs.close();
return null;
}
});
}
-
+
@org.junit.Test
public void writeTest() throws Exception {
-
+
FileSystem fileSystem = hdfsCluster.getFileSystem();
-
+
// Write a file - the AccessControlEnforcer won't be invoked as we are the "superuser"
final Path file = new Path("/tmp/tmpdir2/data-file3");
FSDataOutputStream out = fileSystem.create(file);
@@ -166,7 +166,7 @@ public class HDFSRangerTest {
out.flush();
}
out.close();
-
+
// Now try to write to the file as "bob" - this should be allowed (by the policy - user)
UserGroupInformation ugi = UserGroupInformation.createUserForTesting("bob", new String[] {});
ugi.doAs(new PrivilegedExceptionAction<Void>() {
@@ -174,17 +174,17 @@ public class HDFSRangerTest {
public Void run() throws Exception {
Configuration conf = new Configuration();
conf.set("fs.defaultFS", defaultFs);
-
+
FileSystem fs = FileSystem.get(conf);
-
+
// Write to the file
fs.append(file);
-
+
fs.close();
return null;
}
});
-
+
// Now try to write to the file as "alice" - this should be allowed (by the policy - group)
ugi = UserGroupInformation.createUserForTesting("alice", new String[] {"IT"});
ugi.doAs(new PrivilegedExceptionAction<Void>() {
@@ -192,17 +192,17 @@ public class HDFSRangerTest {
public Void run() throws Exception {
Configuration conf = new Configuration();
conf.set("fs.defaultFS", defaultFs);
-
+
FileSystem fs = FileSystem.get(conf);
-
+
// Write to the file
fs.append(file);
-
+
fs.close();
return null;
}
});
-
+
// Now try to read the file as unknown user "eve" - this should not be allowed
ugi = UserGroupInformation.createUserForTesting("eve", new String[] {});
ugi.doAs(new PrivilegedExceptionAction<Void>() {
@@ -210,9 +210,9 @@ public class HDFSRangerTest {
public Void run() throws Exception {
Configuration conf = new Configuration();
conf.set("fs.defaultFS", defaultFs);
-
+
FileSystem fs = FileSystem.get(conf);
-
+
// Write to the file
try {
fs.append(file);
@@ -221,17 +221,17 @@ public class HDFSRangerTest {
// expected
Assert.assertTrue(RangerAccessControlException.class.getName().equals(ex.getClassName()));
}
-
+
fs.close();
return null;
}
});
}
-
+
@org.junit.Test
public void executeTest() throws Exception {
FileSystem fileSystem = hdfsCluster.getFileSystem();
-
+
// Write a file - the AccessControlEnforcer won't be invoked as we are the "superuser"
final Path file = new Path("/tmp/tmpdir3/data-file2");
FSDataOutputStream out = fileSystem.create(file);
@@ -240,14 +240,14 @@ public class HDFSRangerTest {
out.flush();
}
out.close();
-
+
// Change permissions to read-only
fileSystem.setPermission(file, new FsPermission(FsAction.READ, FsAction.NONE, FsAction.NONE));
-
+
// Change the parent directory permissions to be execute only for the owner
Path parentDir = new Path("/tmp/tmpdir3");
fileSystem.setPermission(parentDir, new FsPermission(FsAction.EXECUTE, FsAction.NONE, FsAction.NONE));
-
+
// Try to read the directory as "bob" - this should be allowed (by the policy - user)
UserGroupInformation ugi = UserGroupInformation.createUserForTesting("bob", new String[] {});
ugi.doAs(new PrivilegedExceptionAction<Void>() {
@@ -255,17 +255,17 @@ public class HDFSRangerTest {
public Void run() throws Exception {
Configuration conf = new Configuration();
conf.set("fs.defaultFS", defaultFs);
-
+
FileSystem fs = FileSystem.get(conf);
-
+
RemoteIterator<LocatedFileStatus> iter = fs.listFiles(file.getParent(), false);
Assert.assertTrue(iter.hasNext());
-
+
fs.close();
return null;
}
});
-
+
// Try to read the directory as "alice" - this should be allowed (by the policy - group)
ugi = UserGroupInformation.createUserForTesting("alice", new String[] {"IT"});
ugi.doAs(new PrivilegedExceptionAction<Void>() {
@@ -273,17 +273,17 @@ public class HDFSRangerTest {
public Void run() throws Exception {
Configuration conf = new Configuration();
conf.set("fs.defaultFS", defaultFs);
-
+
FileSystem fs = FileSystem.get(conf);
-
+
RemoteIterator<LocatedFileStatus> iter = fs.listFiles(file.getParent(), false);
Assert.assertTrue(iter.hasNext());
-
+
fs.close();
return null;
}
});
-
+
// Now try to read the directory as unknown user "eve" - this should not be allowed
ugi = UserGroupInformation.createUserForTesting("eve", new String[] {});
ugi.doAs(new PrivilegedExceptionAction<Void>() {
@@ -291,9 +291,9 @@ public class HDFSRangerTest {
public Void run() throws Exception {
Configuration conf = new Configuration();
conf.set("fs.defaultFS", defaultFs);
-
+
FileSystem fs = FileSystem.get(conf);
-
+
// Write to the file
try {
RemoteIterator<LocatedFileStatus> iter = fs.listFiles(file.getParent(), false);
@@ -303,12 +303,12 @@ public class HDFSRangerTest {
// expected
Assert.assertTrue(RangerAccessControlException.class.getName().equals(ex.getClassName()));
}
-
+
fs.close();
return null;
}
});
-
+
}
-
+
}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hdfs-agent/src/test/java/org/apache/ranger/services/hdfs/RangerAdminClientImpl.java
----------------------------------------------------------------------
diff --git a/hdfs-agent/src/test/java/org/apache/ranger/services/hdfs/RangerAdminClientImpl.java b/hdfs-agent/src/test/java/org/apache/ranger/services/hdfs/RangerAdminClientImpl.java
index 06150f9..5c612e9 100644
--- a/hdfs-agent/src/test/java/org/apache/ranger/services/hdfs/RangerAdminClientImpl.java
+++ b/hdfs-agent/src/test/java/org/apache/ranger/services/hdfs/RangerAdminClientImpl.java
@@ -64,21 +64,21 @@ public class RangerAdminClientImpl implements RangerAdminClient {
}
public void grantAccess(GrantRevokeRequest request) throws Exception {
-
+
}
public void revokeAccess(GrantRevokeRequest request) throws Exception {
-
+
}
public ServiceTags getServiceTagsIfUpdated(long lastKnownVersion) throws Exception {
return null;
-
+
}
public List<String> getTagTypes(String tagTypePattern) throws Exception {
return null;
}
-
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hdfs-agent/src/test/java/org/apache/ranger/services/hdfs/client/HdfsClientTest.java
----------------------------------------------------------------------
diff --git a/hdfs-agent/src/test/java/org/apache/ranger/services/hdfs/client/HdfsClientTest.java b/hdfs-agent/src/test/java/org/apache/ranger/services/hdfs/client/HdfsClientTest.java
index d7fc26d..fbc2e37 100644
--- a/hdfs-agent/src/test/java/org/apache/ranger/services/hdfs/client/HdfsClientTest.java
+++ b/hdfs-agent/src/test/java/org/apache/ranger/services/hdfs/client/HdfsClientTest.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizerFactory.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizerFactory.java b/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizerFactory.java
index e941704..5bbeb87 100644
--- a/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizerFactory.java
+++ b/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizerFactory.java
@@ -22,9 +22,9 @@ import org.apache.ranger.authorization.hive.authorizer.RangerHiveAuthorizerFacto
/**
* 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*
+ * 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!
*/
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAccessRequest.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAccessRequest.java b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAccessRequest.java
index 6f1c8a4..b9f1cde 100644
--- a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAccessRequest.java
+++ b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAccessRequest.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuditHandler.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuditHandler.java b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuditHandler.java
index d98fe81..184a448 100644
--- a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuditHandler.java
+++ b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuditHandler.java
@@ -6,9 +6,9 @@
* 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
@@ -100,7 +100,7 @@ public class RangerHiveAuditHandler extends RangerDefaultAuditHandler {
RangerAccessResult result = iterator.next();
if(result.getIsAudited()) {
if (!result.getIsAllowed()) {
- deniedAuditEvent = createAuditEvent(result);
+ deniedAuditEvent = createAuditEvent(result);
} else {
long policyId = result.getPolicyId();
if (auditEvents.containsKey(policyId)) { // add this result to existing event by updating column values
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java
index aff915e..4b1cd09 100644
--- a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java
+++ b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java
@@ -6,9 +6,9 @@
* 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
@@ -436,14 +436,14 @@ public class RangerHiveAuthorizer extends RangerHiveAuthorizerBase {
List<HivePrivilegeObject> ret = null;
// bail out early if nothing is there to validate!
- if (objs == null) {
+ if (objs == null) {
LOG.debug("filterListCmdObjects: meta objects list was null!");
} else if (objs.isEmpty()) {
LOG.debug("filterListCmdObjects: meta objects list was empty!");
ret = objs;
} else if (getCurrentUserGroupInfo() == null) {
/*
- * This is null for metastore and there doesn't seem to be a way to tell if one is running as metastore or hiveserver2!
+ * This is null for metastore and there doesn't seem to be a way to tell if one is running as metastore or hiveserver2!
*/
LOG.warn("filterListCmdObjects: user information not available");
ret = objs;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizerBase.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizerBase.java b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizerBase.java
index 724c931..c313870 100644
--- a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizerBase.java
+++ b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizerBase.java
@@ -6,9 +6,9 @@
* 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
@@ -50,7 +50,7 @@ public abstract class RangerHiveAuthorizerBase implements HiveAuthorizer {
private HiveAuthenticationProvider mHiveAuthenticator;
private HiveAuthzSessionContext mSessionContext;
private UserGroupInformation mUgi;
-
+
public RangerHiveAuthorizerBase(HiveMetastoreClientFactory metastoreClientFactory,
HiveConf hiveConf,
HiveAuthenticationProvider hiveAuthenticator,
@@ -122,7 +122,7 @@ public abstract class RangerHiveAuthorizerBase implements HiveAuthorizer {
* @throws HiveAccessControlException
*/
@Override
- public List<HivePrivilegeInfo> showPrivileges(HivePrincipal principal, HivePrivilegeObject privObj)
+ public List<HivePrivilegeInfo> showPrivileges(HivePrincipal principal, HivePrivilegeObject privObj)
throws HiveAuthzPluginException, HiveAccessControlException {
LOG.debug("RangerHiveAuthorizerBase.showPrivileges()");
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizerFactory.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizerFactory.java b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizerFactory.java
index bd410b7..fc4821a 100644
--- a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizerFactory.java
+++ b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizerFactory.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveResource.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveResource.java b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveResource.java
index a29acea..09ecd1e 100644
--- a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveResource.java
+++ b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveResource.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hive-agent/src/main/java/org/apache/ranger/authorization/hive/constants/RangerHiveConstants.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/constants/RangerHiveConstants.java b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/constants/RangerHiveConstants.java
index 711683e..cb7044c 100644
--- a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/constants/RangerHiveConstants.java
+++ b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/constants/RangerHiveConstants.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hive-agent/src/main/java/org/apache/ranger/services/hive/RangerServiceHive.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/org/apache/ranger/services/hive/RangerServiceHive.java b/hive-agent/src/main/java/org/apache/ranger/services/hive/RangerServiceHive.java
index 32d212c..9ce0347 100644
--- a/hive-agent/src/main/java/org/apache/ranger/services/hive/RangerServiceHive.java
+++ b/hive-agent/src/main/java/org/apache/ranger/services/hive/RangerServiceHive.java
@@ -6,9 +6,9 @@
* 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
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveClient.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveClient.java b/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveClient.java
index b9dd949..0bc4946 100644
--- a/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveClient.java
+++ b/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveClient.java
@@ -6,9 +6,9 @@
* 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
@@ -318,10 +318,10 @@ public class HiveClient extends BaseClient implements Closeable {
String sql = null ;
- if (dbList != null && !dbList.isEmpty() &&
+ if (dbList != null && !dbList.isEmpty() &&
tblList != null && !tblList.isEmpty()) {
for (String db: dbList) {
- for(String tbl:tblList) {
+ for(String tbl:tblList) {
try {
sql = "use " + db;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveConnectionMgr.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveConnectionMgr.java b/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveConnectionMgr.java
index c60a2fc..19badc8 100644
--- a/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveConnectionMgr.java
+++ b/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveConnectionMgr.java
@@ -6,9 +6,9 @@
* 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
@@ -41,7 +41,7 @@ public class HiveConnectionMgr {
hiveConnectionCache = new ConcurrentHashMap<String, HiveClient>();
repoConnectStatusMap = new ConcurrentHashMap<String, Boolean>();
}
-
+
public HiveClient getHiveConnection(final String serviceName, final String serviceType, final Map<String,String> configs) {
HiveClient hiveClient = null;
@@ -61,7 +61,7 @@ public class HiveConnectionMgr {
try {
hiveClient = TimedEventUtil.timedTask(connectHive, 5, TimeUnit.SECONDS);
} catch(Exception e){
- LOG.error("Error connecting hive repository : "+
+ LOG.error("Error connecting hive repository : "+
serviceName +" using config : "+ configs, e);
}
HiveClient oldClient = hiveConnectionCache.putIfAbsent(serviceName, hiveClient);
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveResourceMgr.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveResourceMgr.java b/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveResourceMgr.java
index 73feff9..ff13fcf 100644
--- a/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveResourceMgr.java
+++ b/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveResourceMgr.java
@@ -6,9 +6,9 @@
* 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
@@ -79,11 +79,11 @@ public class HiveResourceMgr {
}
if ( userInput != null && resource != null) {
- if ( resourceMap != null && !resourceMap.isEmpty() ) {
- databaseList = resourceMap.get(DATABASE);
- tableList = resourceMap.get(TABLE);
- columnList = resourceMap.get(COLUMN);
- }
+ if ( resourceMap != null && !resourceMap.isEmpty() ) {
+ databaseList = resourceMap.get(DATABASE);
+ tableList = resourceMap.get(TABLE);
+ columnList = resourceMap.get(COLUMN);
+ }
switch (resource.trim().toLowerCase()) {
case DATABASE:
databaseName = userInput;
@@ -103,7 +103,7 @@ public class HiveResourceMgr {
try {
if(LOG.isDebugEnabled()) {
- LOG.debug("==> HiveResourceMgr.getHiveResources() UserInput: "+ userInput + " configs: " + configs + " databaseList: " + databaseList + " tableList: "
+ LOG.debug("==> HiveResourceMgr.getHiveResources() UserInput: "+ userInput + " configs: " + configs + " databaseList: " + databaseList + " tableList: "
+ tableList + " columnList: " + columnList ) ;
}
@@ -180,7 +180,7 @@ public class HiveResourceMgr {
}
if(LOG.isDebugEnabled()) {
- LOG.debug("<== HiveResourceMgr.getHiveResources() UserInput: "+ userInput + " configs: " + configs + " databaseList: " + databaseList + " tableList: "
+ LOG.debug("<== HiveResourceMgr.getHiveResources() UserInput: "+ userInput + " configs: " + configs + " databaseList: " + databaseList + " tableList: "
+ tableList + " columnList: " + columnList + "Result :" + resultList ) ;
}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hive-agent/src/test/java/org/apache/ranger/services/hive/HIVERangerAuthorizerTest.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/test/java/org/apache/ranger/services/hive/HIVERangerAuthorizerTest.java b/hive-agent/src/test/java/org/apache/ranger/services/hive/HIVERangerAuthorizerTest.java
index 1caf1cb..3faa097 100644
--- a/hive-agent/src/test/java/org/apache/ranger/services/hive/HIVERangerAuthorizerTest.java
+++ b/hive-agent/src/test/java/org/apache/ranger/services/hive/HIVERangerAuthorizerTest.java
@@ -37,87 +37,87 @@ import org.junit.Assert;
import org.junit.Test;
/**
- *
+ *
* Here we plug the Ranger RangerHiveAuthorizerFactory into HIVE.
- *
- * A custom RangerAdminClient is plugged into Ranger in turn, which loads security policies from a local file. These policies were
+ *
+ * A custom RangerAdminClient is plugged into Ranger in turn, which loads security policies from a local file. These policies were
* generated in the Ranger Admin UI for a service called "HIVETest":
- *
+ *
* a) A user "bob" can do a select/update on the table "words"
* b) A group called "IT" can do a select only on the "count" column in "words"
* c) "bob" can create any database
* d) "dave" can do a select on the table "words" but only if the "count" column is >= 80
- * e) "jane" can do a select on the table "words", but only get a "hash" of the word, and not the word itself.
- *
+ * e) "jane" can do a select on the table "words", but only get a "hash" of the word, and not the word itself.
+ *
*/
public class HIVERangerAuthorizerTest {
-
+
private static final File hdfsBaseDir = new File("./target/hdfs/").getAbsoluteFile();
private static HiveServer2 hiveServer;
private static int port;
-
+
@org.junit.BeforeClass
public static void setup() throws Exception {
// Get a random port
ServerSocket serverSocket = new ServerSocket(0);
port = serverSocket.getLocalPort();
serverSocket.close();
-
+
HiveConf conf = new HiveConf();
-
+
// Warehouse
File warehouseDir = new File("./target/hdfs/warehouse").getAbsoluteFile();
conf.set(HiveConf.ConfVars.METASTOREWAREHOUSE.varname, warehouseDir.getPath());
-
+
// Scratchdir
File scratchDir = new File("./target/hdfs/scratchdir").getAbsoluteFile();
conf.set("hive.exec.scratchdir", scratchDir.getPath());
-
+
// Create a temporary directory for the Hive metastore
File metastoreDir = new File("./target/rangerauthzmetastore/").getAbsoluteFile();
conf.set(HiveConf.ConfVars.METASTORECONNECTURLKEY.varname,
String.format("jdbc:derby:;databaseName=%s;create=true", metastoreDir.getPath()));
-
+
conf.set(HiveConf.ConfVars.METASTORE_AUTO_CREATE_ALL.varname, "true");
conf.set(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_PORT.varname, "" + port);
-
+
// Enable authorization
conf.set(HiveConf.ConfVars.HIVE_AUTHORIZATION_ENABLED.varname, "true");
conf.set(HiveConf.ConfVars.HIVE_SERVER2_ENABLE_DOAS.varname, "true");
- conf.set(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER.varname,
+ conf.set(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER.varname,
"org.apache.ranger.authorization.hive.authorizer.RangerHiveAuthorizerFactory");
conf.set(HiveConf.ConfVars.METASTORE_SCHEMA_VERIFICATION.toString(), "false");
-
+
hiveServer = new HiveServer2();
hiveServer.init(conf);
hiveServer.start();
-
+
Class.forName("org.apache.hive.jdbc.HiveDriver");
-
+
// Create database
String initialUrl = "jdbc:hive2://localhost:" + port;
Connection connection = DriverManager.getConnection(initialUrl, "admin", "admin");
Statement statement = connection.createStatement();
-
+
statement.execute("CREATE DATABASE IF NOT EXISTS rangerauthz");
-
+
statement.close();
connection.close();
-
+
// Load data into HIVE
String url = "jdbc:hive2://localhost:" + port + "/rangerauthz";
connection = DriverManager.getConnection(url, "admin", "admin");
statement = connection.createStatement();
// statement.execute("CREATE TABLE WORDS (word STRING, count INT)");
statement.execute("create table if not exists words (word STRING, count INT) row format delimited fields terminated by '\t' stored as textfile");
-
+
// Copy "wordcount.txt" to "target" to avoid overwriting it during load
File inputFile = new File(HIVERangerAuthorizerTest.class.getResource("../../../../../wordcount.txt").toURI());
Path outputPath = Paths.get(inputFile.toPath().getParent().getParent().toString() + File.separator + "wordcountout.txt");
Files.copy(inputFile.toPath(), outputPath);
-
+
statement.execute("LOAD DATA INPATH '" + outputPath + "' OVERWRITE INTO TABLE words");
-
+
// Just test to make sure it's working
ResultSet resultSet = statement.executeQuery("SELECT * FROM words where count == '100'");
if (resultSet.next()) {
@@ -125,11 +125,11 @@ public class HIVERangerAuthorizerTest {
} else {
Assert.fail("No ResultSet found");
}
-
+
statement.close();
connection.close();
}
-
+
@org.junit.AfterClass
public static void cleanup() throws Exception {
hiveServer.stop();
@@ -137,11 +137,11 @@ public class HIVERangerAuthorizerTest {
File metastoreDir = new File("./target/rangerauthzmetastore/").getAbsoluteFile();
FileUtil.fullyDelete(metastoreDir);
}
-
+
// this should be allowed (by the policy - user)
@Test
public void testHiveSelectAllAsBob() throws Exception {
-
+
String url = "jdbc:hive2://localhost:" + port + "/rangerauthz";
Connection connection = DriverManager.getConnection(url, "bob", "bob");
Statement statement = connection.createStatement();
@@ -157,36 +157,36 @@ public class HIVERangerAuthorizerTest {
statement.close();
connection.close();
}
-
+
// the "IT" group doesn't have permission to select all
@Test
public void testHiveSelectAllAsAlice() throws Exception {
-
+
UserGroupInformation ugi = UserGroupInformation.createUserForTesting("alice", new String[] {"IT"});
ugi.doAs(new PrivilegedExceptionAction<Void>() {
public Void run() throws Exception {
String url = "jdbc:hive2://localhost:" + port + "/rangerauthz";
Connection connection = DriverManager.getConnection(url, "alice", "alice");
Statement statement = connection.createStatement();
-
+
try {
statement.executeQuery("SELECT * FROM words where count == '100'");
Assert.fail("Failure expected on an unauthorized call");
} catch (SQLException ex) {
// expected
}
-
+
statement.close();
connection.close();
return null;
}
});
}
-
+
// this should be allowed (by the policy - user)
@Test
public void testHiveSelectSpecificColumnAsBob() throws Exception {
-
+
String url = "jdbc:hive2://localhost:" + port + "/rangerauthz";
Connection connection = DriverManager.getConnection(url, "bob", "bob");
Statement statement = connection.createStatement();
@@ -201,11 +201,11 @@ public class HIVERangerAuthorizerTest {
statement.close();
connection.close();
}
-
+
// this should be allowed (by the policy - group)
@Test
public void testHiveSelectSpecificColumnAsAlice() throws Exception {
-
+
UserGroupInformation ugi = UserGroupInformation.createUserForTesting("alice", new String[] {"IT"});
ugi.doAs(new PrivilegedExceptionAction<Void>() {
@@ -227,11 +227,11 @@ public class HIVERangerAuthorizerTest {
}
});
}
-
+
// An unknown user shouldn't be allowed
@Test
public void testHiveSelectSpecificColumnAsEve() throws Exception {
-
+
String url = "jdbc:hive2://localhost:" + port + "/rangerauthz";
Connection connection = DriverManager.getConnection(url, "eve", "eve");
Statement statement = connection.createStatement();
@@ -246,11 +246,11 @@ public class HIVERangerAuthorizerTest {
statement.close();
connection.close();
}
-
+
// test "alice", but in the wrong group
@Test
public void testHiveSelectSpecificColumnAsAliceWrongGroup() throws Exception {
-
+
UserGroupInformation ugi = UserGroupInformation.createUserForTesting("alice", new String[] {"DevOps"});
ugi.doAs(new PrivilegedExceptionAction<Void>() {
@@ -272,17 +272,17 @@ public class HIVERangerAuthorizerTest {
}
});
}
-
+
// this should be allowed (by the policy - user)
@Test
public void testHiveUpdateAllAsBob() throws Exception {
-
+
String url = "jdbc:hive2://localhost:" + port + "/rangerauthz";
Connection connection = DriverManager.getConnection(url, "bob", "bob");
Statement statement = connection.createStatement();
statement.execute("insert into words (word, count) values ('newword', 5)");
-
+
ResultSet resultSet = statement.executeQuery("SELECT * FROM words where word == 'newword'");
if (resultSet.next()) {
Assert.assertEquals("newword", resultSet.getString(1));
@@ -294,7 +294,7 @@ public class HIVERangerAuthorizerTest {
statement.close();
connection.close();
}
-
+
// this should not be allowed as "alice" can't insert into the table
@Test
public void testHiveUpdateAllAsAlice() throws Exception {
@@ -304,27 +304,27 @@ public class HIVERangerAuthorizerTest {
String url = "jdbc:hive2://localhost:" + port + "/rangerauthz";
Connection connection = DriverManager.getConnection(url, "alice", "alice");
Statement statement = connection.createStatement();
-
+
try {
statement.execute("insert into words (word, count) values ('newword2', 5)");
Assert.fail("Failure expected on an unauthorized call");
} catch (SQLException ex) {
// expected
}
-
-
+
+
statement.close();
connection.close();
return null;
}
});
}
-
+
@Test
public void testHiveCreateDropDatabase() throws Exception {
-
+
String url = "jdbc:hive2://localhost:" + port;
-
+
// Try to create a database as "bob" - this should be allowed
Connection connection = DriverManager.getConnection(url, "bob", "bob");
Statement statement = connection.createStatement();
@@ -333,7 +333,7 @@ public class HIVERangerAuthorizerTest {
statement.close();
connection.close();
-
+
// Try to create a database as "alice" - this should not be allowed
connection = DriverManager.getConnection(url, "alice", "alice");
statement = connection.createStatement();
@@ -344,7 +344,7 @@ public class HIVERangerAuthorizerTest {
} catch (SQLException ex) {
// expected
}
-
+
// Try to drop a database as "bob" - this should not be allowed
connection = DriverManager.getConnection(url, "bob", "bob");
statement = connection.createStatement();
@@ -355,7 +355,7 @@ public class HIVERangerAuthorizerTest {
} catch (SQLException ex) {
// expected
}
-
+
// Try to drop a database as "admin" - this should be allowed
connection = DriverManager.getConnection(url, "admin", "admin");
statement = connection.createStatement();
@@ -365,12 +365,12 @@ public class HIVERangerAuthorizerTest {
statement.close();
connection.close();
}
-
+
@Test
public void testBobSelectOnDifferentDatabase() throws Exception {
-
+
String url = "jdbc:hive2://localhost:" + port;
-
+
// Create a database as "admin"
Connection connection = DriverManager.getConnection(url, "admin", "admin");
Statement statement = connection.createStatement();
@@ -379,16 +379,16 @@ public class HIVERangerAuthorizerTest {
statement.close();
connection.close();
-
+
// Create a "words" table in "admintemp"
url = "jdbc:hive2://localhost:" + port + "/admintemp";
connection = DriverManager.getConnection(url, "admin", "admin");
statement = connection.createStatement();
statement.execute("CREATE TABLE if not exists WORDS (word STRING, count INT)");
-
+
statement.close();
connection.close();
-
+
// Now try to read it as "bob"
connection = DriverManager.getConnection(url, "bob", "bob");
statement = connection.createStatement();
@@ -402,7 +402,7 @@ public class HIVERangerAuthorizerTest {
statement.close();
connection.close();
-
+
// Drop the table and database as "admin"
connection = DriverManager.getConnection(url, "admin", "admin");
statement = connection.createStatement();
@@ -413,19 +413,19 @@ public class HIVERangerAuthorizerTest {
statement.close();
connection.close();
}
-
+
@Test
public void testBobSelectOnDifferentTables() throws Exception {
-
+
// Create a "words2" table in "rangerauthz"
String url = "jdbc:hive2://localhost:" + port + "/rangerauthz";
Connection connection = DriverManager.getConnection(url, "admin", "admin");
Statement statement = connection.createStatement();
statement.execute("CREATE TABLE if not exists WORDS2 (word STRING, count INT)");
-
+
statement.close();
connection.close();
-
+
// Now try to read it as "bob"
connection = DriverManager.getConnection(url, "bob", "bob");
statement = connection.createStatement();
@@ -439,7 +439,7 @@ public class HIVERangerAuthorizerTest {
statement.close();
connection.close();
-
+
// Drop the table as "admin"
connection = DriverManager.getConnection(url, "admin", "admin");
statement = connection.createStatement();
@@ -449,67 +449,67 @@ public class HIVERangerAuthorizerTest {
statement.close();
connection.close();
}
-
+
@Test
public void testBobAlter() throws Exception {
-
+
String url = "jdbc:hive2://localhost:" + port + "/rangerauthz";
-
+
// Create a new table as admin
Connection connection = DriverManager.getConnection(url, "admin", "admin");
Statement statement = connection.createStatement();
statement.execute("CREATE TABLE IF NOT EXISTS WORDS2 (word STRING, count INT)");
-
+
statement.close();
connection.close();
-
+
// Try to add a new column in words as "bob" - this should fail
url = "jdbc:hive2://localhost:" + port + "/rangerauthz";
connection = DriverManager.getConnection(url, "bob", "bob");
statement = connection.createStatement();
-
+
try {
statement.execute("ALTER TABLE WORDS2 ADD COLUMNS (newcol STRING)");
Assert.fail("Failure expected on an unauthorized call");
} catch (SQLException ex) {
// expected
}
-
+
statement.close();
connection.close();
-
+
// Now alter it as "admin"
connection = DriverManager.getConnection(url, "admin", "admin");
statement = connection.createStatement();
-
+
statement.execute("ALTER TABLE WORDS2 ADD COLUMNS (newcol STRING)");
-
+
statement.close();
connection.close();
-
+
// Try to alter it as "bob" - this should fail
connection = DriverManager.getConnection(url, "bob", "bob");
statement = connection.createStatement();
-
+
try {
statement.execute("ALTER TABLE WORDS2 REPLACE COLUMNS (word STRING, count INT)");
Assert.fail("Failure expected on an unauthorized call");
} catch (SQLException ex) {
// expected
}
-
+
statement.close();
connection.close();
-
+
// Now alter it as "admin"
connection = DriverManager.getConnection(url, "admin", "admin");
statement = connection.createStatement();
-
+
statement.execute("ALTER TABLE WORDS2 REPLACE COLUMNS (word STRING, count INT)");
-
+
statement.close();
connection.close();
-
+
// Drop the table as "admin"
connection = DriverManager.getConnection(url, "admin", "admin");
statement = connection.createStatement();
@@ -519,10 +519,10 @@ public class HIVERangerAuthorizerTest {
statement.close();
connection.close();
}
-
+
@Test
public void testHiveRowFilter() throws Exception {
-
+
// dave can do a select where the count is >= 80
String url = "jdbc:hive2://localhost:" + port + "/rangerauthz";
Connection connection = DriverManager.getConnection(url, "dave", "dave");
@@ -536,19 +536,19 @@ public class HIVERangerAuthorizerTest {
} else {
Assert.fail("No ResultSet found");
}
-
+
resultSet = statement.executeQuery("SELECT * FROM words where count == '79'");
if (resultSet.next()) {
Assert.fail("Authorization should not be granted for count < 80");
}
-
+
statement.close();
connection.close();
-
+
// "bob" should be able to read a count of "79" as the filter doesn't apply to him
connection = DriverManager.getConnection(url, "bob", "bob");
statement = connection.createStatement();
-
+
resultSet = statement.executeQuery("SELECT * FROM words where count == '79'");
if (resultSet.next()) {
Assert.assertEquals("cannot", resultSet.getString(1));
@@ -556,14 +556,14 @@ public class HIVERangerAuthorizerTest {
} else {
Assert.fail("No ResultSet found");
}
-
+
statement.close();
connection.close();
}
-
+
@Test
public void testHiveDataMasking() throws Exception {
-
+
String url = "jdbc:hive2://localhost:" + port + "/rangerauthz";
Connection connection = DriverManager.getConnection(url, "jane", "jane");
Statement statement = connection.createStatement();
@@ -576,7 +576,7 @@ public class HIVERangerAuthorizerTest {
} else {
Assert.fail("No ResultSet found");
}
-
+
statement.close();
connection.close();
}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hive-agent/src/test/java/org/apache/ranger/services/hive/RangerAdminClientImpl.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/test/java/org/apache/ranger/services/hive/RangerAdminClientImpl.java b/hive-agent/src/test/java/org/apache/ranger/services/hive/RangerAdminClientImpl.java
index 32e1966..43770c2 100644
--- a/hive-agent/src/test/java/org/apache/ranger/services/hive/RangerAdminClientImpl.java
+++ b/hive-agent/src/test/java/org/apache/ranger/services/hive/RangerAdminClientImpl.java
@@ -64,21 +64,21 @@ public class RangerAdminClientImpl implements RangerAdminClient {
}
public void grantAccess(GrantRevokeRequest request) throws Exception {
-
+
}
public void revokeAccess(GrantRevokeRequest request) throws Exception {
-
+
}
public ServiceTags getServiceTagsIfUpdated(long lastKnownVersion) throws Exception {
return null;
-
+
}
public List<String> getTagTypes(String tagTypePattern) throws Exception {
return null;
}
-
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/jisql/src/main/java/org/apache/util/outputformatter/CSVFormatter.java
----------------------------------------------------------------------
diff --git a/jisql/src/main/java/org/apache/util/outputformatter/CSVFormatter.java b/jisql/src/main/java/org/apache/util/outputformatter/CSVFormatter.java
index 6e80b42..158e25c 100644
--- a/jisql/src/main/java/org/apache/util/outputformatter/CSVFormatter.java
+++ b/jisql/src/main/java/org/apache/util/outputformatter/CSVFormatter.java
@@ -6,9 +6,9 @@
* 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
@@ -40,28 +40,28 @@ public class CSVFormatter implements JisqlFormatter {
private char delimiter = ',';
private boolean includeColumnNames = false;
-
+
/**
* Sets a the supported option list for this formatter. This formatter accepts
* the following options:
- *
+ *
* <p> </p>
- *
+ *
* <ul>
* <li><<b>delimiter</b> specifies the delimiter to use. By default a comma is
* used</li>
* <li><b>colnames</b> if included then column names are printed as the first
* line of output. By default they are not included</li>
* </ul>
- *
+ *
* @param parser the OptionParser to use.
- *
+ *
*/
public void setSupportedOptions( OptionParser parser ) {
parser.accepts( "delimiter" ).withRequiredArg().ofType( String.class );
parser.accepts( "colnames" );
}
-
+
/**
* Consumes any options that were specified on the command line.
*
@@ -73,7 +73,7 @@ public class CSVFormatter implements JisqlFormatter {
public void consumeOptions( OptionSet options ) throws Exception {
if( options.has( "delimiter" ) )
delimiter = ((String)(options.valueOf( "delimiter" ))).charAt( 0 );
-
+
if( options.has( "colnames" ) )
includeColumnNames = true;
}
@@ -83,7 +83,7 @@ public class CSVFormatter implements JisqlFormatter {
* message should contain information on how to call the formatter.
*
* @param out the PrintStream to display the usage message on.
- *
+ *
*/
public void usage( PrintStream out ) {
out.println("\t-delimiter specifies the character to use as the delimiter. This defaults to \"" + delimiter + "\"" );
@@ -140,10 +140,10 @@ public class CSVFormatter implements JisqlFormatter {
else
csvWriter.write( "" );
}
-
+
csvWriter.endRecord();
}
-
+
csvWriter.flush();
}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/jisql/src/main/java/org/apache/util/outputformatter/DefaultFormatter.java
----------------------------------------------------------------------
diff --git a/jisql/src/main/java/org/apache/util/outputformatter/DefaultFormatter.java b/jisql/src/main/java/org/apache/util/outputformatter/DefaultFormatter.java
index a3bb626..f58e91e 100644
--- a/jisql/src/main/java/org/apache/util/outputformatter/DefaultFormatter.java
+++ b/jisql/src/main/java/org/apache/util/outputformatter/DefaultFormatter.java
@@ -6,9 +6,9 @@
* 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
@@ -41,11 +41,11 @@ public class DefaultFormatter implements JisqlFormatter {
private boolean debug = false;
private String delimiter = " | ";
-
+
/**
* Sets a the option list for this formatter. This formatter accepts the
* following options:
- *
+ *
* <li><b>-noheader</b> do not print the header column info.</li>
* <li><b>-spacer</b> The character to use for "empty" space. This
* defaults to the space character. From mrider - "I added the ability to
@@ -62,9 +62,9 @@ public class DefaultFormatter implements JisqlFormatter {
* <li><b>-w</b> specify the max width of a column. The default is 2048</li>
* <li><b>-debug</b> add debug headers to the output</li>
* </ul>
- *
+ *
* @param parser the OptionParser to use.
- *
+ *
*/
public void setSupportedOptions( OptionParser parser ) {
parser.accepts( "trim" );
@@ -80,7 +80,7 @@ public class DefaultFormatter implements JisqlFormatter {
/**
* Consumes any options that were specified on the command line.
*
- * @param options the OptionSet that the main driver is using.
+ * @param options the OptionSet that the main driver is using.
*
* @throws Exception if there is a problem parsing the command line arguments.
*
@@ -104,14 +104,14 @@ public class DefaultFormatter implements JisqlFormatter {
if( options.has( "noheader" ) )
printHeader = false;
-
+
if( options.has( "debug" ) )
debug = true;
if( options.hasArgument( "delimiter" ) )
delimiter = (String)options.valueOf( "delimiter" );
}
-
+
/**
@@ -119,7 +119,7 @@ public class DefaultFormatter implements JisqlFormatter {
* message should contain information on how to call the formatter.
*
* @param out the stream to print the output on
- *
+ *
*/
public void usage( PrintStream out ) {
out.println("\t-w specifies the maximum field width for a column. The default is to output the full width of the column");
@@ -222,12 +222,12 @@ public class DefaultFormatter implements JisqlFormatter {
/**
* Formats a label for output.
- *
+ *
* @param s - the label to format
* @param width - the width of the field
- *
+ *
* @return the formated label
- *
+ *
*/
private String formatLabel(String s, int width) {
if (s == null)
@@ -260,12 +260,12 @@ public class DefaultFormatter implements JisqlFormatter {
/**
* Formats a separator for display.
- *
+ *
* @param s - the field for which the separator is being generated
* @param width - the width of the field
- *
+ *
* @return the formated separator
- *
+ *
*/
private String formatSeparator(String s, int width) {
s = "NULL";
@@ -295,13 +295,13 @@ public class DefaultFormatter implements JisqlFormatter {
/**
* Formats a value for display.
- *
+ *
* @param label the label associated with the value (for width purposes)
* @param s - the value to format
* @param width - the width of the field from the db.
- *
+ *
* @return the formatted field.
- *
+ *
*/
private String formatValue(String label, String s, int width) {
if (s == null) {
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/jisql/src/main/java/org/apache/util/outputformatter/JisqlFormatter.java
----------------------------------------------------------------------
diff --git a/jisql/src/main/java/org/apache/util/outputformatter/JisqlFormatter.java b/jisql/src/main/java/org/apache/util/outputformatter/JisqlFormatter.java
index aac7b8e..ec6d1f0 100644
--- a/jisql/src/main/java/org/apache/util/outputformatter/JisqlFormatter.java
+++ b/jisql/src/main/java/org/apache/util/outputformatter/JisqlFormatter.java
@@ -6,9 +6,9 @@
* 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
@@ -31,14 +31,14 @@ import joptsimple.OptionSet;
*
*/
public interface JisqlFormatter {
-
+
/**
* Sets a the option list for this formatter.
- *
+ *
* @param parser - the OptionParser to use.
*/
void setSupportedOptions( OptionParser parser );
-
+
/**
* Consumes any options that were specified on the command line.
*
@@ -63,14 +63,14 @@ public interface JisqlFormatter {
*/
void usage( PrintStream out );
-
+
/**
* Outputs a header for a query. This is called before any data is
* output.
*
* @param out where to put header output.
* @param metaData the ResultSetMetaData for the output.
- *
+ *
*/
void formatHeader( PrintStream out, ResultSetMetaData metaData ) throws Exception;
@@ -90,7 +90,7 @@ public interface JisqlFormatter {
*
* @param out where to put footer output.
* @param metaData the ResultSetMetaData for the output.
- *
+ *
*/
void formatFooter( PrintStream out, ResultSetMetaData metaData ) throws Exception;
}